Hi,
Can someone tell me what is wrong with my .count statement that it returns no value (null) instead of one. See my code snip below and result. This does work if I have >1 job returned
Code:
$thresholdTime = (Get-Date).Addhours(-4)
$printJobs = Get-WmiObject Win32_PrintJob -ComputerName gdceps02w12v | Where-Object {[System.Management.ManagementDateTimeConverter]::ToDateTime($_.TimeSubmitted) -lt $thresholdTime -and $_.Name -like '*mbprt*'}
$printjobs
$pcnt = $printJobs.count
Write-Host "Server $server : Found ["$pcnt"] print jobs."
====================
Here's the output:
Document : 6628207BE12744FBA141193013DA97AC-tmpacea
JobId : 254
JobStatus : Error | Printing
Owner : srve
Priority : 1
Size : 1314
Name : bkr_tst9_mbprt, 254
Server gdceps02w12v : Found [ ] print jobs.
Thanks
Lee
Can someone tell me what is wrong with my .count statement that it returns no value (null) instead of one. See my code snip below and result. This does work if I have >1 job returned
Code:
$thresholdTime = (Get-Date).Addhours(-4)
$printJobs = Get-WmiObject Win32_PrintJob -ComputerName gdceps02w12v | Where-Object {[System.Management.ManagementDateTimeConverter]::ToDateTime($_.TimeSubmitted) -lt $thresholdTime -and $_.Name -like '*mbprt*'}
$printjobs
$pcnt = $printJobs.count
Write-Host "Server $server : Found ["$pcnt"] print jobs."
====================
Here's the output:
Document : 6628207BE12744FBA141193013DA97AC-tmpacea
JobId : 254
JobStatus : Error | Printing
Owner : srve
Priority : 1
Size : 1314
Name : bkr_tst9_mbprt, 254
Server gdceps02w12v : Found [ ] print jobs.
Thanks
Lee