Ok so I have this script:$Computer = "." gwmi win32_printer -computer $Computer| select Name,DriverName,PortName | export-csv "C]except when I run it I get the followingGet-WmiObject : Out of memory At \\my.domain.com\netlogon\Scripts\PS\get-printer.ps1:2 char:5 + gwmi < <<< win32_printer -computer $Computer| select Name,DriverName,PortName | export-csv "C:\ServerName-Printers .csv" + CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommandI am running this locally on the print server and have even tried to run the following command as suggested by another article I found on the internetset-item wsman:localhost\Shell\MaxMemoryPerShellMB 512thenPS n] But the results are the same.
I am confused, could someone tell me if I am doing something wrong or what I can do to get this to run? Is there a problem with my code?
by coderaven at 2012-11-16 07:55:39
I would look into the hotfix noted in this article. You do not mention OS but I am assuming this is your issue.
let me know.
by Lahru at 2012-11-19 11:41:58
Sorry, OS is Windows Server 2003 R2 sp2 (32-bit)
by psdk at 2013-03-11 03:05:07
I'm having the exact same issue, and have struggled with it for some time w. no luck.
Did you come across a solution?
by MasterOfTheHat at 2013-03-11 13:47:26
So is that all there is to your script? Have you tried running just the Get-WMIObject portion of the script by itself and see if you still get the exception?
What does this line return on that server? Get-Item wsman]