How can I get the printer shares on a print server using Powershell?
Posted
by
Ben
on Server Fault
See other posts from Server Fault
or by Ben
Published on 2010-07-18T20:35:25Z
Indexed on
2011/11/29
1:52 UTC
Read the original article
Hit count: 627
I'm trying to use Powershell to get the print shares from a remote print server.
I'm using:
Get-WmiObject Win32_Share -computerName "print-server"
I'm getting an "access denied" error:
Get-WmiObject : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
At line:1 char:14
+ Get-WmiObject <<<< Win32_Share -computerName "print-server"
+ CategoryInfo : NotSpecified: (:) [Get-WmiObject], UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
I don't get why I can's see the shares, though, as if I connect through My Computer (e.g. \\print-server\) I can see all the print shares fine.
Any ideas?
Thanks.
Ben
© Server Fault or respective owner