Get-WmiObject : Out of memory error?
Posted: Tue Jan 22, 2019 3:23 am
Hi All,
I am trying to learn to script with WMI object & PowerShell, so I'm not sure why the simple script below does not work for the some server, but work for the other?
The result is:
Any help would be appreciated.
Thanks.
I am trying to learn to script with WMI object & PowerShell, so I'm not sure why the simple script below does not work for the some server, but work for the other?
Code: Select all
$Server = 'PRDSQL17-VM'
Get-WmiObject -ComputerName $Server -Class Win32_LogicalDisk -Filter "DriveType = 3" | ft -AutoSize
Get-WmiObject -Query "SELECT * FROM Win32_Service WHERE DisplayName LIKE '%SQL%'" -ErrorAction Stop -ComputerName $Server | ft -AutoSize
Code: Select all
DeviceID DriveType ProviderName FreeSpace Size VolumeName
-------- --------- ------------ --------- ---- ----------
C: 3 50624507904 104751689728 SYSTEM
D: 3 135013552128 1915396026368 DATA
L: 3 71224967168 167772155904 LOGS
S: 3 131093495808 2198886936576 SQL
P: 3 107122515968 644108775424 PageFile
T: 3 8489771008 42946523136 TEMPDB
Get-WmiObject : Out of memory
At line:5 char:1
+ Get-WmiObject -Query "SELECT * FROM Win32_Service WHERE DisplayName LIKE '%SQL%' ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
Thanks.