forked from timmcmic/DLConversionV2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-sleepProgress.ps1
More file actions
82 lines (58 loc) · 2.29 KB
/
start-sleepProgress.ps1
File metadata and controls
82 lines (58 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<#
.SYNOPSIS
This function performs a sleep operation with progress.
.DESCRIPTION
This function performs a sleep operation with progress.
.PARAMETER sleepString
String to display in the status window.
.PARAMETER sleepSeconds
Seconds to sleep.
.PARAMETER sleepID
The sleep id for text display.
.PARAMETER sleepParentID
The status message parent ID for sub progress status.
.OUTPUTS
No return.
.EXAMPLE
start-sleepProgess -sleepString "String" -seconds Seconds
#>
Function start-sleepProgress
{
[cmdletbinding()]
Param
(
[Parameter(Mandatory = $true)]
[string]$sleepString,
[Parameter(Mandatory = $true)]
[int]$sleepSeconds,
[Parameter(Mandatory = $false)]
[int]$sleepParentID=0,
[Parameter(Mandatory = $false)]
[int]$sleepID=0
)
#Output all parameters bound or unbound and their associated values.
write-functionParameters -keyArray $MyInvocation.MyCommand.Parameters.Keys -parameterArray $PSBoundParameters -variableArray (Get-Variable -Scope Local -ErrorAction Ignore)
Out-LogFile -string "********************************************************************************"
Out-LogFile -string "BEGIN start-sleepProgess"
Out-LogFile -string "********************************************************************************"
if(($sleepId -eq 0)-and ($sleepParentID -eq 0))
{
For ($i=$sleepSeconds; $i -gt 0; $i--)
{
Write-Progress -Activity $sleepString -SecondsRemaining $i
Start-Sleep 1
}
write-progress -activity $sleepString -Completed
}
else
{
For ($i=$sleepSeconds; $i -gt 0; $i--)
{
Write-Progress -Activity $sleepString -SecondsRemaining $i -Id $sleepID -ParentId $sleepParentID
Start-Sleep 1
}
Write-Progress -Activity $sleepString -Id $sleepID -ParentId $sleepParentID -Completed
}
Out-LogFile -string "END start-sleepProgess"
Out-LogFile -string "********************************************************************************"
}