Installing Printers Based on Active Directory Group
I'm looking to install all my printers based on security groups within active directory I was planning on using the script below:
*** START SCRIPT PRINTERS.VBS ***
Const IT_GROUP = "IT"
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshNetwork = CreateObject("WScript.Network")
Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & ADSysinfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))
ON ERROR RESUME NEXT
If InStr(strGroups, IT_GROUP) Then
WshShell.Run ("cscript c:windowssystem32prnport.vbs -a -o raw -r IP_192.168.0.10 -h 192.168.0.10")
WshShell.Run ("cscript c:windowssystem32prnmngr.vbs -a -p "The IT HP Laser" -m "hp LaserJet 1320 PCL 6" -r "IP_192.168.0.10")
End If
** END SCRIPT PRINTERS.VBS ***
This would work all well and good but my problems lies in this line:
WshShell.Run ("cscript c:windowssystem32prnmngr.vbs -a -p "My HP Printer" -m "hp LaserJet 1320 PCL 6" -r "IP_192.168.0.10")
Because when WshShell.Run gets to "My HP Printer" it assumes that that is the end of the command instead of after "IP_192.168.0.10" which is due to the cscript prnmngr.vbs using " " to specify The printer name, driver and IP Port.
Basically....I'm looking for way to install TCP/IP Printers based on group....I know there is quite a few ways to do this using shares i.e. \servernameprintershare but not IP Ports.....
Looking for further ideas or a way to run my problematic line...
Any thoughts ideas are welcomed
Thanks in Advance :-)



