Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

startup printer mapping script

Status
Not open for further replies.

sibbir

IS-IT--Management
Dec 17, 2003
69
US
This should be very easy. I'm trying to map a default printer for all the computers in one room. I made a security group in AD and added the computers to that group; name of the group is room17.

Then in I made a new group policy and have it apply to only room17 group. Under the group policy settings (Computer Configuration --> Windows Settings --> Scripts (Startup/Shutdown) -->Startup) I added the script file:

Set WshNetwork = CreateObject("WScript.Network")
PrinterPath = "\\my server name\Lexmark"
PrinterDriver = "Lexmark Optra R Series"
WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver
WshNetwork.SetDefaultPrinter "\\my server name\Lexmark"

If I add the users to the same group (room17) and place the same script under the group policy settings (User Configuration --> Windows Settings --> Scripts(Logon/Logoff) --> Logoff) it works.

I need the printer mapped on the computers regardless of the users.

Thanks a lot for your help.
 
You could create a new OU in AD, add the computers to the OU, and then use GPO on that new container.

Search for Group membership, or Subnet if different.
Regards ACO
 
ACO,
thanks for your reply. I tried that too but it didn't work. does windows not support computer startup printer mapping??
 
Not sure why your GPO doesnt work, If you dont want to get bogged down with that,
Is there a way that you can Identify all these computers?
I.E. a computer name all starting with CL17
dedicated subnet, add a sub to the login script to say if Class17 connect printers

If not you could go to Class 17 and add a new reg value to HKLM\Software\Microsoft\Windows\Run
Add String Value ConnectPrinter REG_SZ "Path to Script"
Pain in the Backside to maintain.
I would recommend you spend a bit of time and work out why the GPO doesnt work.
Sorry no magic from me :)
 
aco,
how do i add the reg value only for one group? Thanks again.


Guy,
thanks for the reply. i will try to add the reg value as ACO suggested. Do you know of any other ways? Thanks
 
Do you mean;
You have a class with several computers.
Only Group memebrs should be able to map the lexmark printer
when other non group memebrs log in they do not get the Lexmark printer?

If so, add a routine to the script, if member of group connect printer, else dont bother or if exist disconnect?

I'm no vbs expert, however this will find groups user belongs to
Then just add the IF true connect printer.
I suggest you go to vbs forum for better help.
I have done what you are asking only based on subnets and computer names but not User Group
Sorry I cant be more help :)
 
Ha ha! Just read you question again
Dump your connect printer script in the AD Login/out directory and change permissions for the script to only allow group members to enumerate it. THat will do it.

So you will have a number of login scripts in the same directory but only group permissions set for you printer connect script.

HAve seen this approach used by Microsoft for something, cant recall what but should work.

Hope it works:)
ACO
 
Aco,
In previous post you said "add a new reg value to HKLM\Software\Microsoft\Windows\Run
Add String Value ConnectPrinter REG_SZ "Path to Script".

how do I add the reg value only for the computer in room17 group using GPO? Thanks

 
Why use a vb script to map a printer at startup? just give the machine a..........

net use lpt1: \\servername\printer /persistent:yes

????????

You are modifying registry values for something that is mapped to the HKCU in the registry. This is rewritten everytime a user logs on and logs off. If you are mapping it to a local machine, it would be easier to map it as one user, then copy their profiles to the default user profiles. Then blow away all of the user profiles on the machine, they'll get it when they log on next time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top