On Error Resume Next
Set objSysInfo = CreateObject("ADSystemInfo")
Set objNetwork = CreateObject("Wscript.Network")
strUserPath = "LDAP://" & objSysInfo.UserName
Set objUser = GetObject(strUserPath)
For Each strGroup in objUser.MemberOf
strGroupPath = "LDAP://" & strGroup
Set objGroup = GetObject(strGroupPath)
strGroupName = objGroup.CN
Select Case strGroupName
Case "Corporate Engineering"
objNetwork.MapNetworkDrive "Z:",
\\servername\sharename1<file://servername/sharename1>
objNetwork.MapNetworkDrive "R:",
\\servername\sharename2<file://servername/sharename2>
Case "Human Resources"
objNetwork.MapNetworkDrive "H:",
\\servername\sharename3<file://servername/sharename3>
End Select
On Thu, Jan 28, 2010 at 7:14 AM, Kevan Dickinson <
[email protected]> wrote:
> Hi
>
>
>
> I am trying to map a drive during a users logon using a logon script that
> checks if the user is a member of a particular Windows Security Group.
>
> I am trying to use the “ifmember” command but am failing miserably.
>
>
>
> What we want the script to do is check if the user is a member of “Group1”
> and if they are map a Drive to \\server\Group1$ folder.
>
>
>
> These are the lines in the script that we are using
>
>
>
> ifmember "Domain\Group1"
>
> if not errorlevel 1 goto next
>
> net use P: \\server\Group1$
>
>
>
> Whats happening is that the”ifmember” bit seems to be ignored and the drive
> is being mapped for everyone.
>
>
>
> Can anyone suggest what I am doing wrong or how to achieve what I am trying
> to do. The Ifmember.exe is in the netlogon folder.
>
>
>
> Essentialy we have one folder that about 15 people need access to and we
> are trying to map it during logon for ease of use by these people.
>
>
>
> Regards
>
>
>
> *Kevan Dickinson*
>
> *Network Manager*
>
> *NSF-CMI*
>
> 23 Lodge Road
>
> Hanborough Business Park, Long Hanborough,
>
> Oxford, OX29 8SJ, UK
>
>
>
> T:+44 01993 885661
>
> E:[email protected] <e%[email protected]>
>
> W:www.nsf-cmi.com
>
>
>
>
>
>
> ********************************************************************************
>
> ***Disclaimer***
>
> The contents of this Email may be privileged and are confidential. If you
> are not the intended recipient, any disclosure, copying, distribution or any
> action taken or omitted to be taken in reliance on it, is prohibited and may
> be unlawful.
>
> Should you wish to use Email as a mode of communication, NSF-CMi Ltd and
> its subsidiaries are unable to guarantee the security of Email content
> outside of our own computer systems.
>
> This footnote also confirms that this Email message has been checked by
> MailMarshal for the presence of computer viruses. Whilst we run anti-virus
> software, you are solely responsible for ensuring that any Email or
> attachment you receive is virus free. We disclaim any liability for any
> damage you suffer as a consequence of receiving any virus.
>
> NSF-CMi Ltd
> Registered in England No: 1899857
> Registered Office : Hill House, 1 Little New Street, London, EX4A 3TR.
>
>
> **********************************************************************************
>
>
>
>
>
>
>
>
~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~