ebizdatacom
asked on
VBScript: Map Printers based on computer group in Active Directory
I have a site that has several areas (ie front desk, reception, billing, nurses station,) and each area has a printer. I have a script that I'm using that runs on the local W2K and XP workstations and maps specified printers and drive mappings. I would like to improve on this though and have a script that maps a printer based on computer membership. I'm very new to scripting and have pieced together the one I use from other folks kind examples online. I have inputed part of my script below to give an idea as to what I'm looking for and how things are running now.
Currently I have something like...
Set objWSHNetwork = CreateObject("WScript.Netw ork") 'create network object
strConnectString = "\\server\CanonS82"
strResult = objWSHNetwork.AddWindowsPr interConne ction(strC onnectStri ng)
I'd like an example script given what I have above thats something like this in concept...
If member of computergroup (front desk) then
Set objWSHNetwork = CreateObject("WScript.Netw ork") 'create network object
strConnectString = "\\web_development\CanonS8 2"
strResult = objWSHNetwork.AddWindowsPr interConne ction(strC onnectStri ng)
end if
If member of computergroup (back office) then
Set objWSHNetwork = CreateObject("WScript.Netw ork") 'create network object
strConnectString = "\\Server\HPLJ6"
strResult = objWSHNetwork.AddWindowsPr interConne ction(strC onnectStri ng)
Thank you in advance for all of your help. I've learned a lot already, and am hoping that I can get an understandable answer to this problem.
Thank you
Currently I have something like...
Set objWSHNetwork = CreateObject("WScript.Netw
strConnectString = "\\server\CanonS82"
strResult = objWSHNetwork.AddWindowsPr
I'd like an example script given what I have above thats something like this in concept...
If member of computergroup (front desk) then
Set objWSHNetwork = CreateObject("WScript.Netw
strConnectString = "\\web_development\CanonS8
strResult = objWSHNetwork.AddWindowsPr
end if
If member of computergroup (back office) then
Set objWSHNetwork = CreateObject("WScript.Netw
strConnectString = "\\Server\HPLJ6"
strResult = objWSHNetwork.AddWindowsPr
Thank you in advance for all of your help. I've learned a lot already, and am hoping that I can get an understandable answer to this problem.
Thank you
Hello,
If you wanted to try it with vbscript review this webpage.
http://www.rlmueller.net/freecode1.htm
It contains scripts to check for group membership of users or computers.
There are several there so make sure you find the one that suits your needs the best.
Once you find one let us know if you need help placing it into your existing code.
If you wanted to try it with vbscript review this webpage.
http://www.rlmueller.net/freecode1.htm
It contains scripts to check for group membership of users or computers.
There are several there so make sure you find the one that suits your needs the best.
Once you find one let us know if you need help placing it into your existing code.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
See here:
http://technet2.microsoft.com/WindowsServer/en/Library/f33624bc-7518-4c2d-8f73-8a3d4571dae91033.mspx