cls #################### #By Tony Unger #Purpose: inventory all services and user accounts running them with jobs # ## $myCol = @() $i =0 $servers = get-adcomputer -filter * | select -expand name $scriptblock = { param([string]$server) get-wmiobject win32_service -computername $Server | select * } $ServersCount = $Servers.count foreach($server in $Servers){ $i++ $running = @(Get-Job | Where-Object { $_.State -eq 'Running' }) Write-Progress -Activity "Gathering computer info" -status "Currently on $server -- $i of $ServersCount" -percentComplete ($i / $ServersCount*100) if ($running.Count -le 50) { Start-Job -ScriptBlock $scriptblock -Name $server -ArgumentList $server, $creds } else { $running | Wait-Job } } while ($running.Count -ge 1) { sleep 1 $running = @(Get-Job | Where-Object { $_.State -eq 'Running' }) } foreach ($job in Get-Job ){ $recjobs = Receive-Job -Keep -Job $job foreach ($recjob in $recjobs){ $Detail = New-Object PSObject $Detail | Add-Member Noteproperty Caption $recjob.Caption $Detail | Add-Member Noteproperty Name $recjob.name $Detail | Add-Member Noteproperty Startname $recjob.startname $Detail | Add-Member Noteproperty Server $recjob.__SERVER $myCol += $Detail } }
These are just random notes and programs that may have incomplete descriptions. Any scripts or programs use at your risk
Monday, April 18, 2016
Powershell: Get services and accounts used to run them on all computers using Jobs
Subscribe to:
Post Comments (Atom)
-
Here is an excel document I created that will ping a list of nodes in column A and give results in column B. There are much better tools th...
-
Running solidcore you may run into a problem where you have to disable it with out using epo or the local CLI Here are the steps. ...
-
#reads event logs for filter and exports to $Date = (Get-Date).AddMinutes(-30) $LogName = 'Security' $ProviderName = "Microsof...
No comments:
Post a Comment