I have a logon script mapping user drives Windows Network. Some users are now logging into a terminal server these days and I'd like to map a different drive, based on computer name they are logging in to.
I am looking at which user AD group they are in (departmental group so I know which shares to map).
If IsAM开发者_StackOverflowemberOf(objNetwork.UserDomain, objNetwork.UserName, "Sales Dept. Users - Acton") Then MapIt "G:", "\\phillip\sales"
I need to now evaluate what the computer name is as well.
The basic logic is: If user is in Sales group from this computer bur-ts-01, then map this share \\bur-fil-01\sales; else, if user is in Sales group use \\phillip\sales.
It's a fairly comprehensive script mapping drives, printers, etc. Our VBScript person is long gone however and remote users are not able to access a local share to the TS server as a result.
Can anyone offer any suggestions or sample code that I could review?
You could add a check for the computer name to see if it includes "-ts-" and if so, then map accordingly. A lot of different ways to write it, but here's my take.
bDomainGroupMember = IsAMemberOf(objNetwork.UserDomain, objNetwork.UserName, "Sales Dept. Users - Acton")
If bDomainGroupMember AND Not instr(objNetwork.ComputerName, "-ts-") > 0 Then
MapIt "G:", "\\phillip\sales"
ElseIf bDomainGroupMember AND instr(objNetwork.ComputerName, "-ts-") > 0 Then
MapIt "G:", "\\bur-fil-01\sales"
End If
So basically, I pulled the function query out and assigned the value to bDomanGroupMember so you can use it in two checks without calling the function twice. Then, the If / ElseIf checks to see if the user is both a member of the sales domain group and whether or not the user logged in from a terminal server session, ie. a machine with "-ts-" in the name.
Hope that helps :)
精彩评论