-
Notifications
You must be signed in to change notification settings - Fork 86
Description
I ran a script to return the number of days that a list of 10,000 computers has been online. I sent the output to a CSV file, but when I opened it I was missing results from over 4,000 machines. I have had other scripts that I've fed into Start-RSJob that have performed in a similar manner where the output results do not come back 100%.
I have to rerun the script over on everything that Start-RSJob did not return the first time around. Sometimes I have to do this several times. I'm not sure what the problem could be since I was able to verify that all machines were online and reachable. Is this a known bug that was fixed or is being worked on in a later release of PoshRSJob?
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
` $computers = Get-Content "C:\Users\Admin\Desktop\PowerShell Testing\DifferenceResults.txt"
Param($Computer)
$PSBoundParameters.GetEnumerator() | ForEach {
$OSObject = Get-WmiObject win32_operatingsystem -ComputerName $Computer
$Today = Get-Date
$Uptime = $OSObject.ConvertToDateTime($OSObject.LastBootUpTime)
$Diff = $Today.Subtract($Uptime)
$DaysUp = $Diff.days
$results = @()
$eachcomputer = [ordered]@{"Computer"=$Computer;
"DaysOnline"=$DaysUp}
$newobj = New-Object psobject -property $eachcomputer
$results += $newobj }
$results | Export-Csv "C:\Users\Admin\Desktop\PowerShell Testing\DaysSinceLastReboot2.csv" -Append -NoTypeInformation }`
What is the expected behavior?
The script should return 100% of the uptime results into the CSV file that I named, but seems to only return about half of the results.
Which versions of Powershell and which OS are affected by this issue? Did this work in previous versions of our scripts?
I am running PS5 on Win7.