I'm trying to create a simple VBS logon script that sets the default printer for users logging into Server 2003 through a terminal server environment. The printer is a network printer that is not going through a print server. It's DNS name is "Front MailRoom Printer" and port is \192.168.0.82.
The script I have is this:
Set WSHNetwork = CreateObject("WScript.Network")
WSHNetwork.SetDefaultPrinter "Front MailRoom Printer"
When it runs, an error 80070002 (the开发者_运维百科 system cannot find the file specified) points to line 2 character 1 comes up. Any ideas are welcome.
This was a user profile issue that impacted printers, not an issue with the code itself. If anyone cares, this registry key didn't exist for the user:
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows
Once it was added added and user logged off and back on, the root issue was resolved and script ran successfully.
精彩评论