Skip to content

Commit

Permalink
Update for Training in Larvik
Browse files Browse the repository at this point in the history
  • Loading branch information
DeploymentBunny committed May 9, 2017
1 parent 475ec6a commit 41ae873
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Tools/Running-ParJobs/Running-ParJobs.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
$Servers = "Server1","Server2"
$AdminPassword = "P@ssw0rd"
$DomainName = "corp.viamonstra.com"
$DomainAdminPassword = "P@ssw0rd"
$domainCred = New-Object -typename System.Management.Automation.PSCredential -argumentlist "$($domainName)\Administrator", (ConvertTo-SecureString $domainAdminPassword -AsPlainText -Force)
$Session = New-PSSession -VMName $Servers -Credential $domainCred
#$Session = New-PSSession -ComputerName $Servers -Credential $domainCred


$InstallJob = Invoke-Command -ScriptBlock {
Get-ChildItem -Path c:\
} -Session $Session -AsJob
do{$InstallJob}until($($InstallJob.State) -eq "Completed")

foreach($Job in $InstallJob.ChildJobs){
Write-Host ""
Write-Host "Result on: $($Job.Location)"
Write-Host ""
Receive-Job -Job $Job -Keep
}

0 comments on commit 41ae873

Please sign in to comment.