1
0
-1
3 answers
- 10-1Hello,Here a small script I have done that should help you in PowerShell.Basicaly It will launch as many audit script as you set in $instance.
Then the script will wait jobs to complete before launching new audit on other pc.
It will also terminate Job when they are completed (not sure if need but it limit the memory consumption when you have many assets to scan.)Create a Pclist.txt with all pc name Inside and put in a folder like c:\OAV\ with the audit_windows.vbs***************************************************************# $Instance value = Number of audit Running at the same time# Adapt Path in line 6 & 10 to your environment.$Instance = 10$Running = 0$Completed = 0$list_pcs = Get-Content "C:\OAV\PcList.txt"ForEach ($pc in $list_pcs){start-job -ScriptBlock {cscript "C:\OAV\audit_Windows.vbs" $args[0] } -ArgumentList $pc$Running = (Get-Job | Where-Object State -eq "Running").countWrite-host $pcWhile ($Running -ge $Instance){Write-Host "Waiting Job to Continue"Start-Sleep 10$Running = (Get-Job | Where-Object State -eq "Running").count$Completed = (Get-Job | Where-Object State -eq "Completed") | Select-Object IdIf ($Completed.id.count -ne 0){Foreach ($c in $Completed.Id){Remove-Job -id $c}}}}$Running = (Get-Job | Where-Object State -eq "Running").countWhile ($Running -ne 0){Write-Host "Waiting Job to finish"Start-Sleep 10$Running = (Get-Job | Where-Object State -eq "Running").count}Remove-Job * -force***************************************************Add your comment... - 10-1Add your comment...
- 10-1
Use powershell. import the list of a 100+PCs. then foreach PC start a job invoking the task cscript audit_windows.vbs $computername. Create a counter in the foreach loopp to limit the concurrent jobs so you do not have all 100 running at the same time.
- aiman najmi
Basically all i need it to work is using powershell only? and im im abit concern about your answer because i dont understand that much on how to do it
Add your comment...
Im currently on a problem on how could i possibly run the script on more than 100pc's that i have , a help would be a would be alot of meaning thanks.