-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWaitforJob.ps1
More file actions
26 lines (21 loc) · 794 Bytes
/
Copy pathWaitforJob.ps1
File metadata and controls
26 lines (21 loc) · 794 Bytes
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
#######################################################
# PowerShell Jobs - Wait to be completed
#######################################################
# Waits for the PowerShell job on the server to reach the required state.
function WaitForJob([string]$jobName, [string]$jobState)
{
LoggerLee -text "`n`nWaiting for a background job to be $jobState" low nonewline
do
{
Start-Sleep 1
Write-Host -foregroundcolor DarkGray -NoNewline "."
$jobstatus = get-job -name $jobName
}
while ($jobstatus.State -ne $jobState)
Write-Host " "
Write-Host " "
#Write-Host -foregroundcolor DarkGray -NoNewLine " The job $jobName is "
#Write-Host -foregroundcolor Gray $jobState
#LoggerLee " The background job is " low nonewline
#LoggerLee "$jobState`n" low
}