Zezima Posted February 3, 2016 Posted February 3, 2016 The user name or password is incorrect. (Exception from HRESULT: 0x8007052E) At E:\mapPrinter.ps1:24 char:1 + $net.AddWindowsPrinterConnection($printerpath) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: ( [], COMException + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException $password = "hidden" | ConvertTo-SecureString -asPlainText -Force $username = "hidden\sy2" $cred = New-Object System.Management.Automation.PSCredential($username, $password) New-PSDrive -Name "P" -PSProvider FileSystem -Root "\\svr-001.hidden.internal\RMPublic" -Persist -credential $cred $net = new-object -com WScript.Network $printerpath = "\\svr-001\CR2 New" $net.AddWindowsPrinterConnection($printerpath) above is my error and my powershell script. The New-PSDrive to map the P Drive is working. The adding printer part is not workng and that is what gives me the error. I can't figure out how I'd pass through credentials with the AddWindowsPrnterConnection function. I didn't think credentials were even needed, because printers are fully shared for anyone to access on the network. Anyone got any ideas? been trying this all morning - i've wasted an amazing amount of time :S
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now