There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen blue screen blue screen of death boot computer connection crash css dell display driver drivers error firefox firefox 3 game hard drive internet internet explorer itunes laptop lcd linux malware monitor network networking outlook outlook 2003 outlook express partition password printer problem problems ram router security slow software sound sprtcmd.exe trojan usb virus vista windows windows xp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
Active Directory Logon Script


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
MDub2112's Avatar
Member with 43 posts.
 
Join Date: Apr 2005
22-Dec-2006, 10:22 AM #1
Active Directory Logon Script
I have a vbs script that I'm trying to run for users of a new Windows 2003 Server R2 Active Directory.

I keep getting a MS VBScript compilation error
Line 13 Char 33 Syntax error 800A03EA

I am by no means a programmer and am having one heck of a time figuring this out.
Can someone here give me a hand?? It is only mapping user home drives, a couple of network drives, then group drives.

Something I will say is that we are a very small company (50ppl) so I do not have any OUs all security groups are global domain groups (I know....shouldn't but...)

Code:
' Initialise Groups with Const
Const Accounting_GROUP = "cn=Accounting"
Const FIELD_GROUP = "cn=Field"
Const LAB_GROUP = "cn=Lab"
Const OPS_GROUP = "cn=Ops"
Const SALES_GROUP = "cn=Sales"
Const MGMT_GROUP = "cn=Managers"
Const USERS_GROUP = "cn=Users"
Const MAS90_GROUP = "cn=MAS90"
Const LIMS_GROUP = "cn=LIMS System"

Set wshNetwork = CreateObject("WScript.Network")
wshNetwork.MapNetworkDrive "h:",
"\\emt.local\dfs\userhome\" & wshNetwork.UserName

Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" &
ADSysInfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))

If InStr(strGroups, MAS90_GROUP) Then

    wshNetwork.MapNetworkDrive "m:",
    "\\emt.local\dfs\Accounting\mas90"

If InStr(strGroups, LIMS_GROUP) Then

    wshNetwork.MapNetworkDrive "o:",
    "\\emt.local\dfs\omega\"

If InStr(strGroups, ACCOUNTING_GROUP) Then

    wshNetwork.MapNetworkDrive "g:",
    "\\emt.local\dfs\groups\Accounting\"
    
ElseIf InStr(strGroups, FIELD_GROUP) Then

    wshNetwork.MapNetworkDrive "g:",
    "\\emt.local\dfs\groups\field\"

ElseIf InStr(strGroups, LAB_GROUP) Then

    wshNetwork.MapNetworkDrive "g:",
    "\\emt.local\dfs\groups\lab\"

ElseIf InStr(strGroups, OPS_GROUP) Then

    wshNetwork.MapNetworkDrive "g:",
    "\\emt.local\dfs\groups\ops\"

ElseIf InStr(strGroups, SALES_GROUP) Then

    wshNetwork.MapNetworkDrive "g:",
    "\\emt.local\dfs\groups\sales\"

ElseIf InStr(strGroups, MGMT_GROUP) Then

    wshNetwork.MapNetworkDrive "g:",
    "\\emt.local\dfs\groups\"


End If
MyName's Avatar
Senior Member with 320 posts.
 
Join Date: Oct 2001
Location: Ohio
Experience: Advanced
23-Dec-2006, 07:04 PM #2
You had a few problems with continuing code on a second line. I cleaned that up for you. Also, you were missing some End If's near the bottom. I see that you're using ElseIf for certain cases. Are you doing that for a specific purpose? Generally, you'd want to use just If-End If around all your group check statements to see if they're in the group. I left your ElseIf's in there, but you may need to look at that.

' Initialise Groups with Const
Const Accounting_GROUP = "cn=Accounting"
Const FIELD_GROUP = "cn=Field"
Const LAB_GROUP = "cn=Lab"
Const OPS_GROUP = "cn=Ops"
Const SALES_GROUP = "cn=Sales"
Const MGMT_GROUP = "cn=Managers"
Const USERS_GROUP = "cn=Users"
Const MAS90_GROUP = "cn=MAS90"
Const LIMS_GROUP = "cn=LIMS System"

Set wshNetwork = CreateObject("WScript.Network")
wshNetwork.MapNetworkDrive "h:" , "\\emt.local\dfs\userhome\" & wshNetwork.UserName

Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & _
ADSysInfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))

If InStr(strGroups, MAS90_GROUP) Then

wshNetwork.MapNetworkDrive "m:", "\\emt.local\dfs\Accounting\mas90"
End If

If InStr(strGroups, LIMS_GROUP) Then

wshNetwork.MapNetworkDrive "o:", "\\emt.local\dfs\omega\"

End If

If InStr(strGroups, ACCOUNTING_GROUP) Then

wshNetwork.MapNetworkDrive "g:", "\\emt.local\dfs\groups\Accounting\"

ElseIf InStr(strGroups, FIELD_GROUP) Then

wshNetwork.MapNetworkDrive "g:", "\\emt.local\dfs\groups\field\"

ElseIf InStr(strGroups, LAB_GROUP) Then

wshNetwork.MapNetworkDrive "g:", "\\emt.local\dfs\groups\lab\"

ElseIf InStr(strGroups, OPS_GROUP) Then

wshNetwork.MapNetworkDrive "g:", "\\emt.local\dfs\groups\ops\"

ElseIf InStr(strGroups, SALES_GROUP) Then

wshNetwork.MapNetworkDrive "g:", "\\emt.local\dfs\groups\sales\"

ElseIf InStr(strGroups, MGMT_GROUP) Then

wshNetwork.MapNetworkDrive "g:", "\\emt.local\dfs\groups\"


End If
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 07:08 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.