Assign Printers to computers via GPO startup via vb script

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Good day to you all!
Could not find the answer in previous posts, therefore I'm posting a new
topic.

I'm running Windows 2000 domain in native mode, under 2000 SP4 Standart.

The task is to automate shared network printers installation.
I have created GPO, that will run VB script on startup and map those printers.

Here's the script:

Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection "\\server\HPLaserJet_nd"
objNetwork.AddWindowsPrinterConnection "\\server\DuPrinter"
objNetwork.AddWindowsPrinterConnection "\\server\HPLJ@Hallway"
objNetwork.SetDefaultPrinter "\\server\HPLaserJet_nd"
WScript.Quit

Now for some reason the script does not run when applied to computer, and no
mapping occur. On other hand if the same script is applied to user, script
works fine.

Permission on the shared printer is set to Everyone = Print.

What can be done to resolve this situation?
 
these are "user" connections written to the user registry. You need to use
rundll32. This can be performed remotely as well.

http://members.shaw.ca/bsanders/NetPrinterAllUsers.htm

Add per machine printer connection (the connection will be propagated to
the user upon logon):
rundll32 printui.dll,PrintUIEntry /ga /c\\machine /n\\machine\printer
/j"LanMan Print Services"
Delete per machine printer connection (the connection will be deleted
upon user logon):
rundll32 printui.dll,PrintUIEntry /gd /c\\machine /n\\machine\printer
Enumerate per machine printer connections:
rundll32 printui.dll,PrintUIEntry /ge /c\\machine


--
Alan Morris
Windows Printing Team
Search the Microsoft Knowledge Base here:
http://support.microsoft.com/default.aspx?scid=fh;[ln];kbhowto

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Thanks a lot!
That is very helpful info

Alan Morris said:
these are "user" connections written to the user registry. You need to use
rundll32. This can be performed remotely as well.

http://members.shaw.ca/bsanders/NetPrinterAllUsers.htm

Add per machine printer connection (the connection will be propagated to
the user upon logon):
rundll32 printui.dll,PrintUIEntry /ga /c\\machine /n\\machine\printer
/j"LanMan Print Services"
Delete per machine printer connection (the connection will be deleted
upon user logon):
rundll32 printui.dll,PrintUIEntry /gd /c\\machine /n\\machine\printer
Enumerate per machine printer connections:
rundll32 printui.dll,PrintUIEntry /ge /c\\machine


--
Alan Morris
Windows Printing Team
Search the Microsoft Knowledge Base here:
http://support.microsoft.com/default.aspx?scid=fh;[ln];kbhowto

This posting is provided "AS IS" with no warranties, and confers no rights.

Igors Belijs said:
Good day to you all!
Could not find the answer in previous posts, therefore I'm posting a new
topic.

I'm running Windows 2000 domain in native mode, under 2000 SP4 Standart.

The task is to automate shared network printers installation.
I have created GPO, that will run VB script on startup and map those
printers.

Here's the script:

Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection "\\server\HPLaserJet_nd"
objNetwork.AddWindowsPrinterConnection "\\server\DuPrinter"
objNetwork.AddWindowsPrinterConnection "\\server\HPLJ@Hallway"
objNetwork.SetDefaultPrinter "\\server\HPLaserJet_nd"
WScript.Quit

Now for some reason the script does not run when applied to computer, and
no
mapping occur. On other hand if the same script is applied to user, script
works fine.

Permission on the shared printer is set to Everyone = Print.

What can be done to resolve this situation?
 
Back
Top