New to the forum. I would like to see if anyone else have came across this issue that I am experiencing where running the code below:
$i = “\server\printer-shared-name”
$net = New-Object -COM WScript.Network
But i received this error message:
Value does not fall within the expected range.
At somelocation\powershell.ps1:94 char:13
- CategoryInfo : OperationStopped: ( , ArgumentException
- FullyQualifiedErrorId : System.ArgumentException
However, have the script retry running $net.AddWindowsPrinterConnection($i) again and sometimes it works and sometimes it fails with the same message.
Weird indeed. Anyone happen to have seen this issue before?
In addition, I have this powershell script run on login.
Different users login with their domain account and something it works perfectly and sometimes it doesn’t and return this error.