liminal
asked on
How to Setup a VBS Logon Script by Group Membership
Hi all,
Im really new to the whole VBS scripting thing, but what im trying to do is make a script to map drives to groups.
So
Group Fdrive = \\server\Fdrive.
Group Tdrive = \\server\accounts
That kinda thing,
And then printers,
Group AccountsPrinter = \\server\AccountingPrinter Name
Group SkillsPrinter = \\server\SkillsPrinterName
Or am I creating to many groups here… what’s the best way to do this
Would it be better to create a group like, Accounts T Drive and Printing
Thanks guys
Im really new to the whole VBS scripting thing, but what im trying to do is make a script to map drives to groups.
So
Group Fdrive = \\server\Fdrive.
Group Tdrive = \\server\accounts
That kinda thing,
And then printers,
Group AccountsPrinter = \\server\AccountingPrinter
Group SkillsPrinter = \\server\SkillsPrinterName
Or am I creating to many groups here… what’s the best way to do this
Would it be better to create a group like, Accounts T Drive and Printing
Thanks guys
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hey thanks so much for the quick response... Yeah its a domain... let me have a look, ill come back to you.
ASKER
Ok, testing now.
I’m just wondering about the RHO_finance… what’s with the underscore? Is that how your groups are named? Or do you need that if you have a space in the group name.
I’m just wondering about the RHO_finance… what’s with the underscore? Is that how your groups are named? Or do you need that if you have a space in the group name.
That's just how we've named our groups. I believe you should be fine if your groups have a space in the name as the code is surrounded by quotes anyways.
Hope it does what you needed :)
Hope it does what you needed :)
ASKER
Yeah i figured it out... it's working well.
One thing i have noted is that it wont seem to delete the drive, im just double clicking the file... it maps... but if i remove myself from a group and and run again... the drive is still there.
One thing i have noted is that it wont seem to delete the drive, im just double clicking the file... it maps... but if i remove myself from a group and and run again... the drive is still there.
ASKER
LOL, yeah it helps if you actually do remove yourself from the group in order to delete the share :)
You need a separate line for each drive mapping you want removed.
ie. to remove F: Drive you use the following.
WshNetwork.RemoveNetworkDr ive "F:",true,true
The problem isn't as simple as you've mapped the drive to a letter other than the ones listed to remove is it?
Although if you use the script at group policy then you'll never come across that anyway as the drives are only mapped at logon.
ie. to remove F: Drive you use the following.
WshNetwork.RemoveNetworkDr
The problem isn't as simple as you've mapped the drive to a letter other than the ones listed to remove is it?
Although if you use the script at group policy then you'll never come across that anyway as the drives are only mapped at logon.
ASKER
I didnt remove myself from the group, all good... thanks
are you using this for printers as well?
are you using this for printers as well?
No sorry we don't.
Google found me this though which looks good, not sure if you'd already seen it but doesn't look like it would be difficult to integrate to the script i posted.
http://www.computerperformance.co.uk/Logon/LogonScript_Printer_Method.htm
ie. Just add these two lines to the top of the script
Dim objNetwork
Set objNetwork = CreateObject("WScript.Netw ork")
Then customise this line for each of the Select cases in the script i posted
objNetwork.AddWindowsPrint erConnecti on \\server\SkillsPrinterName
Maybe someone else can give better help with the printers.
Google found me this though which looks good, not sure if you'd already seen it but doesn't look like it would be difficult to integrate to the script i posted.
http://www.computerperformance.co.uk/Logon/LogonScript_Printer_Method.htm
ie. Just add these two lines to the top of the script
Dim objNetwork
Set objNetwork = CreateObject("WScript.Netw
Then customise this line for each of the Select cases in the script i posted
objNetwork.AddWindowsPrint
Maybe someone else can give better help with the printers.
ASKER
Thanks heaps for the help :)
No worries, hope you got what you needed.
I can give you a copy of the VBScript we use if so.
Basically it maps drives based on username (home directories) or groups (department shares etc)