Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

powerhsell write to output file from multiple jobs

$sb =  {
   Param($computer, $fileName, $outLog)
   net use "$computerc$" $password /user:$userName | Out-Null
   if(test-path $computerc$sc$fileName){
      [xml]$periods = Get-Content $computerc$sc$fileName
      $endDate = $periods.IndataDbf.ingredient.PeriodDetail.PeriodEndDate | select -last 1
         $output = "$computer;$endDate"
      }
   Else {
      $output = "$computer;$fileName Not Found"
   }
   Write-Output -InputObject $output
   net use "$computerc$" /de | Out-Null
}

foreach($computer in $computerName){
   while ((Get-Job -State Running).Count -ge 20) {
      Start-Sleep -Seconds 5;
   }
   Start-Job -Scriptblock $sb -ArgumentList $computer,$fileName,$outLog
}
Get-Job | Wait-Job | Receive-Job | Out-File -Append -FilePath $outLog
Comment

PREVIOUS NEXT
Code Example
Shell :: bash temp file extension 
Shell :: ausgabe in variable speichern bash 
Shell :: bash check if cd successful 
Shell :: kernel version link 
Shell :: how to upgrade my psql client version cloud9 
Shell :: ffmpeg scale but keep aspect ratio 
Shell :: git grep line only 
Shell :: reac native /bin/sh: adb: command not found 
Shell :: terminal list files extension in subfolders 
Shell :: surface area of a spherical shell 
Shell :: Linux waitptid function 
Shell :: sigin failed for rsa github signing 
Shell :: SearchMonkey For Linux 
Shell :: ca(oh)2 là gì 
Shell :: download gradle for debian 
Shell :: workspace switch shortcur Gnome 
Shell :: ubuntu apt get without cd rom 
Shell :: ubuntu find install path 
Shell :: iiana github 
Shell :: butler push userversion 
Shell :: codition in bash 
Shell :: linux audacity installieren 
Shell :: wslcopy to system clipboard 
Shell :: How to enable a service on boot with systemctl command 
Shell :: kali rm 
Shell :: check salt version 
Shell :: powershell symlink python as python3 
Shell :: git --init 
Shell :: how to remove a repository 
Shell :: what is force checkout in git 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =