I have several Windows machines and I am trying to ps remote into each one to run a command that will scan the entire host for specific file types while also tell me where they are located. So far, I've have the following command which work on most of them:
Get-WMIObject Win32_LogicalDisk -filter 'DriveType = 3' | Select-Object DeviceID | ForEach-Object {Get-Childitem -force -ErrorAction Ignore -include *.p12,*.pfx -recurse}
I get the output I expect to see on most:
Directory: C:\ ...
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 5/17/2021 10:14 AM 206 $example.pfx
but this one has me puzzled:
Get-WMIObject : Call cancelled
At line:1 char:1
+ Get-WMIObject Win32_LogicalDisk -filter 'DriveType = 3' | Select-Obje ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
Is this referring to a timeout of the command? The machine I am scanning that results with this has a fairly large amount of files, so I'm not surprised if this is the case...
If so, is there some way to outlast the timer?