使用Add-Printer命令连接共享打印机报错的技术咨询
Let’s break down why you’re hitting this error even when following official docs—this is a common gotcha with straightforward fixes:
1. Double-Check the Connection Path Format
The most likely issue is a missing leading backslash. Microsoft’s docs specify the connection name must start with two backslashes (\\), not one. If you entered \printserver\printername instead of \\printserver\printername, PowerShell will interpret that as an invalid local path instead of a network printer share.
Valid command example:
Add-Printer -ConnectionName \\your-actual-server\your-actual-printer-share
2. Check for Illegal Characters in Server/Printer Names
The error explicitly calls out , or \ as invalid characters—make sure:
- Your server name or printer share name doesn’t include a comma (a common oversight if using custom naming conventions)
- You haven’t accidentally added extra backslashes or commas in the path (e.g.,
\\server\,printerwould trigger this error)
If your printer share name includes spaces, wrap the entire path in quotes:
Add-Printer -ConnectionName "\\your-actual-server\3rd Floor Breakroom Printer"
3. Verify the Printer Share is Accessible
Sometimes the error message is misleading—even if the format looks correct, the server might be unreachable or the share name is wrong:
- Open File Explorer and paste
\\your-actual-server\your-actual-printer-shareinto the address bar. If this fails to load the printer, confirm:- The print server is online and on your network
- The printer share exists (check with your IT team if unsure)
- Your user account has permissions to access the share
4. Rule Out PowerShell Execution Context Issues
If you’re running the command in a remote PowerShell session or restricted environment, you might hit access limitations. Try running the command locally on your machine, or ensure your session has the necessary permissions to add network printers.
内容的提问来源于stack exchange,提问作者Viktor Axén

