Re: Help with Script by Gavin
Gavin
Wed Apr 12 19:48:41 CDT 2006
This should do what you want, just modify the domain name and the drive
mappings, just add a new case for each additional group you want to add.
HTH
Gavin...
Set WshShell = CreateObject("WScript.Shell")
StrDomain = "DOMAIN NAME"
Set net = CreateObject("wscript.network")
Struser = net.username
DispUserInWhichGroup()
Function DispUserInWhichGroup()
On Error Resume Next
Dim Group
Dim User
Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")
For Each Group In User.Groups
Select Case group.name
'This is where you enter the group name
Case "Group 1"
Net.RemoveNetworkDrive "P"
Net.MapNetworkDrive "P:", \\SERVERNAME\SHARE
Case "Group 2"
Net.RemoveNetworkDrive "L:"
Net.MapNetworkDrive "L:", \\SERVERNAME\SHARE
Case Else
End Select
Next
End Function
WScript.Echo("Done")
"Anderson" <Anderson@discussions.microsoft.com> wrote in message
news:D5B00D40-A1FC-4195-BA74-8BDFD0DBF124@microsoft.com...
> Hi,
>
> I need help with a script.
>
> Let's say a user belongs to 2 groups, then I need to make a script which
> it
> will map the group's drive through a loop.
>
> For example:
> User = joe
> Belongs to helpdesk and admin
>
> Then
> The script should mount the user's drive and groups drive which is
> helpdesk
> and admin.
>
> Can I do that?
>
> Thanks,
> Anderson