PowerShell : System Audit (How to correctly use Invoke-Command for batch jobs)
I rececently revisted an old script that i had build to audit flash versions. In this 200+ line script, I pulled the machine list from AD then gone through this list one by one checking the Flash version of each machine, finally building a data table of all the relevant info. It worked but for 400+ machines took a long time. Many hours.
Today I revisited this script and replaced it with this
$parameters = @{
Computername = $TargetComputers
ScriptBlock = {(Get-ItemProperty C:\Windows\System32\Macromed\Flash\Flash.ocx).VersionInfo}
}
$RawResult = Invoke-Command @parameters
Which runs in a minute or so....