Avatar of PeterHing
PeterHingFlag for United Kingdom of Great Britain and Northern Ireland

asked on 

VB Login Script (Member Of Groups)

Hi All,

I would be grateful if someone could look over the following code - I keep getting errors, the 1st one being on line 5.

I'm trying to create a login script to map drives based on AD membership of 2 groups, US and UK.

I'm getting my information from:
http://technet2.microsoft.com/windowsserver/en/library/8a268d3a-2aa0-4469-8cd2-8f28d6a630801033.mspx?mfr=true

But I don't need the home drive or printers mapped.

Many Thanks - Pete
Const UK     = "cn=UK"
Const US     = "cn=US "
 
Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" &
ADSysInfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))
 
If InStr(strGroups, UK) Then
 
    wshNetwork.MapNetworkDrive "s:",
    "\\Server\Shared\"
 
    wshNetwork.MapNetworkDrive "p:",
    "\\Server\US Folders Directory"
 
'    UK Scanning Drive
'    wshNetwork.MapNetworkDrive "x:",
'    "\\x\"
 
ElseIf InStr(strGroups, US) Then
 
    wshNetwork.MapNetworkDrive "p:",
    "\\Server\US Folders Directory"
 
    wshNetwork.MapNetworkDrive "s:",
    "\\Server\Shared\"
 
    wshNetwork.MapNetworkDrive "R:",
    "\\Server\folder"
 
End If

Open in new window

VB ScriptVisual Basic Classic

Avatar of undefined
Last Comment
PeterHing
ASKER CERTIFIED SOLUTION
Avatar of purplepomegranite
purplepomegranite
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of PeterHing
PeterHing
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Wow - that was nice and easy - Thanks!
Visual Basic Classic
Visual Basic Classic

Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.

165K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo