
Multiple groups drive letter mapping? (newbie question)
Quote:
> Let me see if I can explain this correctly. I have two global groups, each
> of which needs to map drives for certain apps. The current drive latters
are
> the same and the problem is when a user belongs to both groups, it will
only
> map one drive (obviously). Something like this:
> Group 1 needs to map to Drive P \\server1\share
> Group 2 needs to map to Drive P \\server2\share
> If a user is a member of both groups map:
> Drive X \\server1\share AND Y \\server2\share
> How can I accomplish this via vbs?
Simplest solution: if the apps can function when mapped as X and Y, why not
ALWAYS use X: for server1 and Y: for server 2?
Quote:
> My current script looks like this:
> IF grp.Name ="app1" then
> IF checkNetworkMapping("P:", "\\server\share") = false then
> WshNetwork.MapNetworkDrive "P:", "\\server\share"
> END IF
> End If
> IF grp.Name ="app2" then
> IF checkNetworkMapping("P:", "\\server\share") = false then
> WshNetwork.MapNetworkDrive "P:", "\\server\share"
> END IF
> End If
> Could I simply do this:
> IF grp.Name ="app1" & "app2" then
This is equivalent to:
IF grp.Name = "app1app2"
If you don't have a group with such a name, why test for it?
Quote:
> IF checkNetworkMapping("P:", "\\server\share") = false then
> WshNetwork.MapNetworkDrive "P:", "\\server\share"
> IF checkNetworkMapping("T:", "\\server\share") = false then
> WshNetwork.MapNetworkDrive "T:", "\\server\share"
> END IF
> End If
Is this your /entire/ script? where does object grp get defined, and what is
it defined as?
Forget VBScript for a moment, and consider the logic you want to implement.
Is it something like this:
if user is in both groups 1 and 2 then
map x to server1
map y to server2
elseif user is in group 1 then
map p to server1
elseif user is in group 2 then
map p to server2
end if
What you really need is a way to find out the membership of the current user
in the two groups. Where does grp.name come in to this?
You need an "IsInGroup" function. This could be done via ADSI, just
enumerate all the groups the user belongs to and check each one to see if it
is one of these. Or you could enumerate all members of the two groups to see
if any of the members is the current user. Trouble with this is if you are
using active directory, he could be a member indirectly by being a member of
some third group that is itself a member of one of these two.
Another way is to set the permission on the share or underlying folder (or a
flag file) such that a non-member of the group cannot see it. IsInGroup
become CanSeeShare:
sub CanSeeShare( uncpath )
set fso = createobject("scripting.filesystemobject")
CanSeeShare = fso.folderexists(uncpath)
set fso = nothing
end sub
Your script then becomes:
isingroup1 = canseeshare( \\server1\share )
isingroup2 = canseeshare( \\server2\share )
if isingroup1 and isingroup2 then
' see above
elseif isingroup1
' see above
elseif isingroup2
' see above
end if
/Al