![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Creating logon scripts - the script will map different sets of drivesdepending on the security grp the user is in. I'm trying to create a logon scripts that will map my users network drives based on a certain security group that they are in: I'm in the testing stage so far and below is what I have (I'm testing against our IT security group right now). When I put this in place its not mapping the drives listed -- could anyone say why and possibly give me the change I need to do so that those three drives will map. Here is my vbscript -- thanks for the help in advance: Ryan ---------------- Const IT_GROUP = "cn=IT$ DEPARTMENT (R & W)" Set wshNetwork = CreateObject("WScript.Network") Set ADSysInfo = CreateObject("ADSystemInfo") Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName) strGroups = LCase(Join(CurrentUser.MemberOf)) If InStr(strGroups, IT_Group) Then wshNetwork.RemoveNetworkDrive "I:" wshNetwork.RemoveNetworkDrive "Z:" wshNetwork.RemoveNetworkDrive "K:" wshNetwork.MapNetworkDrive "I:", "\\netwincp\it$\" wshNetwork.MapNetworkDrive "Z:", "\\netwincp\accounting\" wshNetwork.MapNetworkDrive "K:", "\\netwincp\kdrive\" End If |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Creating logon scripts - the script will map different sets of drives depending on the security grp the user is in. "RBoyle" <ryan.j.boyle.cpg@xxxxxx> wrote in message news:e619bc0e-0fd5-4c06-a72f-9ae8f05334ae@xxxxxx Quote: > I'm trying to create a logon scripts that will map my users network > drives based on a certain security group that they are in: > > I'm in the testing stage so far and below is what I have (I'm testing > against our IT security group right now). When I put this in place > its not mapping the drives listed -- could anyone say why and possibly > give me the change I need to do so that those three drives will map. > > Here is my vbscript -- thanks for the help in advance: > > Ryan > > ---------------- > > Const IT_GROUP = "cn=IT$ DEPARTMENT (R & W)" > > Set wshNetwork = CreateObject("WScript.Network") > Set ADSysInfo = CreateObject("ADSystemInfo") > Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName) > > > strGroups = LCase(Join(CurrentUser.MemberOf)) wscript.echo strGroups Quote: > If InStr(strGroups, IT_Group) Then upper/lower case mismatches: If InStr(1, strGroups, IT_Group, 1) Then Quote: > wshNetwork.RemoveNetworkDrive "I:" > wshNetwork.RemoveNetworkDrive "Z:" > wshNetwork.RemoveNetworkDrive "K:" > > wshNetwork.MapNetworkDrive "I:", "\\netwincp\it$\" > wshNetwork.MapNetworkDrive "Z:", "\\netwincp\accounting\" > wshNetwork.MapNetworkDrive "K:", "\\netwincp\kdrive\" > > End If |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Creating logon scripts - the script will map different sets of drives depending on the security grp the user is in. "Al Dunbar" <alandrub@xxxxxx> wrote in message news:OftIlkqHKHA.4004@xxxxxx Quote: > > "RBoyle" <ryan.j.boyle.cpg@xxxxxx> wrote in message > news:e619bc0e-0fd5-4c06-a72f-9ae8f05334ae@xxxxxx Quote: >> I'm trying to create a logon scripts that will map my users network >> drives based on a certain security group that they are in: >> >> I'm in the testing stage so far and below is what I have (I'm testing >> against our IT security group right now). When I put this in place >> its not mapping the drives listed -- could anyone say why and possibly >> give me the change I need to do so that those three drives will map. >> >> Here is my vbscript -- thanks for the help in advance: >> >> Ryan >> >> ---------------- >> >> Const IT_GROUP = "cn=IT$ DEPARTMENT (R & W)" >> >> Set wshNetwork = CreateObject("WScript.Network") >> Set ADSysInfo = CreateObject("ADSystemInfo") >> Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName) >> >> >> strGroups = LCase(Join(CurrentUser.MemberOf)) > I'd suggest displaying this value to see what it is: > > wscript.echo strGroups > Quote: >> If InStr(strGroups, IT_Group) Then > I'd suggest changing the above statement to the one just below to avoid > upper/lower case mismatches: > > If InStr(1, strGroups, IT_Group, 1) Then > Quote: >> wshNetwork.RemoveNetworkDrive "I:" >> wshNetwork.RemoveNetworkDrive "Z:" >> wshNetwork.RemoveNetworkDrive "K:" >> >> wshNetwork.MapNetworkDrive "I:", "\\netwincp\it$\" >> wshNetwork.MapNetworkDrive "Z:", "\\netwincp\accounting\" >> wshNetwork.MapNetworkDrive "K:", "\\netwincp\kdrive\" >> >> End If > /Al > makes all of the group Distinguished Names lower case. However, your constant defines IT_Group as mixed case. The value assigned to IT_Group should be all lower case. I think Al's optional third parameter passed to the InStr function makes the comparison case insensitive. If that's the case, then you can use mixed case. -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Creating logon scripts - the script will map different sets of drives depending on the security grp the user is in. "Al Dunbar" <alandrub@xxxxxx> wrote: Quote: > > "RBoyle" <ryan.j.boyle.cpg@xxxxxx> wrote in message > news:e619bc0e-0fd5-4c06-a72f-9ae8f05334ae@xxxxxx Quote: >> I'm trying to create a logon scripts that will map my users network >> drives based on a certain security group that they are in: >> >> I'm in the testing stage so far and below is what I have (I'm testing >> against our IT security group right now). When I put this in place >> its not mapping the drives listed -- could anyone say why and possibly >> give me the change I need to do so that those three drives will map. >> >> Here is my vbscript -- thanks for the help in advance: >> >> Ryan >> >> ---------------- >> >> Const IT_GROUP = "cn=IT$ DEPARTMENT (R & W)" >> >> Set wshNetwork = CreateObject("WScript.Network") >> Set ADSysInfo = CreateObject("ADSystemInfo") >> Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName) >> >> >> strGroups = LCase(Join(CurrentUser.MemberOf)) strGroups = DELIMITOR & LCase(Join(..., DELIMITOR)) & DELIMITOR Quote: > I'd suggest displaying this value to see what it is: > > wscript.echo strGroups > Quote: >> If InStr(strGroups, IT_Group) Then > I'd suggest changing the above statement to the one just below to avoid > upper/lower case mismatches: Quote: > If InStr(1, strGroups, IT_Group, 1) Then Stefan |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Creating logon scripts - the script will map different sets of drives depending on the security grp the user is in. "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in message news:eummuPrHKHA.4432@xxxxxx Quote: > > "Al Dunbar" <alandrub@xxxxxx> wrote in message > news:OftIlkqHKHA.4004@xxxxxx Quote: >> >> "RBoyle" <ryan.j.boyle.cpg@xxxxxx> wrote in message >> news:e619bc0e-0fd5-4c06-a72f-9ae8f05334ae@xxxxxx Quote: >>> I'm trying to create a logon scripts that will map my users network >>> drives based on a certain security group that they are in: >>> >>> I'm in the testing stage so far and below is what I have (I'm testing >>> against our IT security group right now). When I put this in place >>> its not mapping the drives listed -- could anyone say why and possibly >>> give me the change I need to do so that those three drives will map. >>> >>> Here is my vbscript -- thanks for the help in advance: >>> >>> Ryan >>> >>> ---------------- >>> >>> Const IT_GROUP = "cn=IT$ DEPARTMENT (R & W)" >>> >>> Set wshNetwork = CreateObject("WScript.Network") >>> Set ADSysInfo = CreateObject("ADSystemInfo") >>> Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName) >>> >>> >>> strGroups = LCase(Join(CurrentUser.MemberOf)) >> I'd suggest displaying this value to see what it is: >> >> wscript.echo strGroups >> Quote: >>> If InStr(strGroups, IT_Group) Then >> I'd suggest changing the above statement to the one just below to avoid >> upper/lower case mismatches: >> >> If InStr(1, strGroups, IT_Group, 1) Then >> Quote: >>> wshNetwork.RemoveNetworkDrive "I:" >>> wshNetwork.RemoveNetworkDrive "Z:" >>> wshNetwork.RemoveNetworkDrive "K:" >>> >>> wshNetwork.MapNetworkDrive "I:", "\\netwincp\it$\" >>> wshNetwork.MapNetworkDrive "Z:", "\\netwincp\accounting\" >>> wshNetwork.MapNetworkDrive "K:", "\\netwincp\kdrive\" >>> >>> End If >> /Al >> > Also, when you use the Join function, you also use the LCase function, > which makes all of the group Distinguished Names lower case. However, your > constant defines IT_Group as mixed case. The value assigned to IT_Group > should be all lower case. Quote: > I think Al's optional third parameter passed to the InStr function > makes the comparison case insensitive. too, as case issues are something I tend to avoid in other ways... But one of the odd quirks here is that, while it follows what is normally the second parameter, it requires an additional zeroth parameter, making that final parameter the fourth one rather than the third. The first parameter indicates the starting point in the string being searched. Quote: > If that's the case, Quote: > then you can use mixed case. /Al Quote: |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Creating logon scripts - the script will map different sets of drives depending on the security grp the user is in. "Stefan Kanthak" <postmaster@[127.0.0.1]> wrote in message news:unTfU70HKHA.4608@xxxxxx Quote: > "Al Dunbar" <alandrub@xxxxxx> wrote: Quote: >> >> "RBoyle" <ryan.j.boyle.cpg@xxxxxx> wrote in message >> news:e619bc0e-0fd5-4c06-a72f-9ae8f05334ae@xxxxxx Quote: >>> I'm trying to create a logon scripts that will map my users network >>> drives based on a certain security group that they are in: >>> >>> I'm in the testing stage so far and below is what I have (I'm testing >>> against our IT security group right now). When I put this in place >>> its not mapping the drives listed -- could anyone say why and possibly >>> give me the change I need to do so that those three drives will map. >>> >>> Here is my vbscript -- thanks for the help in advance: >>> >>> Ryan >>> >>> ---------------- >>> >>> Const IT_GROUP = "cn=IT$ DEPARTMENT (R & W)" >>> >>> Set wshNetwork = CreateObject("WScript.Network") >>> Set ADSysInfo = CreateObject("ADSystemInfo") >>> Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName) >>> >>> >>> strGroups = LCase(Join(CurrentUser.MemberOf)) > Const DELIMITOR = "|" > strGroups = DELIMITOR & LCase(Join(..., DELIMITOR)) & DELIMITOR > Quote: >> I'd suggest displaying this value to see what it is: >> >> wscript.echo strGroups >> Quote: >>> If InStr(strGroups, IT_Group) Then >> I'd suggest changing the above statement to the one just below to avoid >> upper/lower case mismatches: > And what about substring mismatches? > Quote: >> If InStr(1, strGroups, IT_Group, 1) Then > If InStr(1, strGroups, DELIMITOR & LCase(IT_Group) & DELIMITOR, 1) Then an inkling of some of the things the OP could do to find out why his scripts are not coming up with the results he expects. Giving a complete answer that addresses all of the problems in my view tends to leave the OP our of the process of examining his own understanding of the situation. /Al |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Attempting to write my logon scripts - I want to do an IF / ElseIfstatement and match to what security group the user is in | VB Script | |||
| Logon Script Causing Laptops To Hang - Problems in script? | VB Script | |||
| Need help with a logon script for the domain user | VB Script | |||
| creating Environment variable during logon script | VB Script | |||
| Creating Powershell Scripts | PowerShell | |||