sparky2156
asked on
Set Default Printer via GPO Logon Script
Hi,
Currently i am trying to resolve an issue with my printer setup on a windows 2003 network. The issue is that the printer has already been creatied, shared and added to all of the users profiles. However, a local setting on the machiens keeps changing the default printer back to the one which comes first alphabetically - which i dont want to happen.
I have done a lot of research into the topic, and it seems that the best solution is to create a vbs script which assigns the printer as default. I have the line of code which actually sets the printer to be default:
objNetwork.SetDefaultPrint er \\servername\printer
however, i am not a programmer and i am getting syntax errors when i add this line into a notepad and rename the file as a .vbs script and deploy it via gpo - as i expected.
Could somebody please advise me on the correct syntax for this file. Like i said, the printer has already been created and is in use - i just need to simply set the printer to be default.
Thanks.
Currently i am trying to resolve an issue with my printer setup on a windows 2003 network. The issue is that the printer has already been creatied, shared and added to all of the users profiles. However, a local setting on the machiens keeps changing the default printer back to the one which comes first alphabetically - which i dont want to happen.
I have done a lot of research into the topic, and it seems that the best solution is to create a vbs script which assigns the printer as default. I have the line of code which actually sets the printer to be default:
objNetwork.SetDefaultPrint
however, i am not a programmer and i am getting syntax errors when i add this line into a notepad and rename the file as a .vbs script and deploy it via gpo - as i expected.
Could somebody please advise me on the correct syntax for this file. Like i said, the printer has already been created and is in use - i just need to simply set the printer to be default.
Thanks.
or this
Set objNetwork = CreateObject("WScript.Netw ork")
objNetwork.AddWindowsPrint erConnecti on "\\PrintServer1\Xerox300"
objNetwork.SetDefaultPrint er "\\PrintServer1\Xerox300"
Set objNetwork = CreateObject("WScript.Netw
objNetwork.AddWindowsPrint
objNetwork.SetDefaultPrint
ASKER
ms-pro:
When i add your script, i get an error to say the following:
There is no printer called "\\servername\printer"
code: 80020009
I removed the part which adds the printer, as the printer already exists in the users profiles - could this have affected it?
Thanks.
When i add your script, i get an error to say the following:
There is no printer called "\\servername\printer"
code: 80020009
I removed the part which adds the printer, as the printer already exists in the users profiles - could this have affected it?
Thanks.
Yes,
This could be the reason. That's why I didn't stated the add Windows Printer. Try the following (just because your printer IS installed):
Set WSHNetwork = CreateObject("WScript.Netw ork")
WSHNetwork.SetDefaultPrint er "[PRINTER_NAME]"
This could be the reason. That's why I didn't stated the add Windows Printer. Try the following (just because your printer IS installed):
Set WSHNetwork = CreateObject("WScript.Netw
WSHNetwork.SetDefaultPrint
ASKER
Hey,
I tried the modified script you posted - still the same error. Anything else i could try?
I tried the modified script you posted - still the same error. Anything else i could try?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Same message again.
Server is called DC, printers share name is iR2570CC, so i have added the following to a .vbs script:
Set WSHNetwork = CreateObject("WScript.Netw ork")
WSHNetwork.SetDefaultPrint er "\\dc\iR2570CC"
yet i am still getting the same error.
I really appreciate all the help you guys are giving me. Any more suggestions? Thanks.
Server is called DC, printers share name is iR2570CC, so i have added the following to a .vbs script:
Set WSHNetwork = CreateObject("WScript.Netw
WSHNetwork.SetDefaultPrint
yet i am still getting the same error.
I really appreciate all the help you guys are giving me. Any more suggestions? Thanks.
Hi
can you double click on the .vbs file you have, on the machine that you want to set the printer to default on?
It suggesting that the printer is not even installed on the machine you run the script on!? and thats assuming that you have the server and printer details correct which i'm sure you have :)
Perhaps send a screenshot of the "printer and faxes" page of the machine that throws the error
Krystian
can you double click on the .vbs file you have, on the machine that you want to set the printer to default on?
It suggesting that the printer is not even installed on the machine you run the script on!? and thats assuming that you have the server and printer details correct which i'm sure you have :)
Perhaps send a screenshot of the "printer and faxes" page of the machine that throws the error
Krystian
ASKER
Hi,
I did what you said about running the script directly form a workstation - no problems. I then refreshed the group policy on one of the clients, logged off and logged back on and perfect!
Up until now, i have been running it on the server, which is still getting this error for some reason - any ideas why?
So instead of adding this script to the default domain policy, which of course then affects servers as well, i will restructure AD to add users into specific OU's so i can add the logon script to the GPO attached to that OU, and we should sorted!
Thank you for all of your help, and if you could perhaps advise why this error will still be appearing on the server to which the printer is installed on (network printer but to save time and money, i added the drivers to the print server then shared it out from here). All other servers are fine with this new script.
Thanks.
I did what you said about running the script directly form a workstation - no problems. I then refreshed the group policy on one of the clients, logged off and logged back on and perfect!
Up until now, i have been running it on the server, which is still getting this error for some reason - any ideas why?
So instead of adding this script to the default domain policy, which of course then affects servers as well, i will restructure AD to add users into specific OU's so i can add the logon script to the GPO attached to that OU, and we should sorted!
Thank you for all of your help, and if you could perhaps advise why this error will still be appearing on the server to which the printer is installed on (network printer but to save time and money, i added the drivers to the print server then shared it out from here). All other servers are fine with this new script.
Thanks.
You can try this (change PRINTER_NAME into your printer name):
__________________________
Set WSHNetwork = CreateObject("WScript.Netw
WSHNetwork.SetDefaultPrint
__________________________