tballin
asked on
Logon Script Help
Is there a way to create a single log-on script for all users in a domain, but that are at three different sites (And who have home folders that exist on three different servers)?
I tried using the %HomeShare% and %HomePath%, but so far no luck.
I tried using the %HomeShare% and %HomePath%, but so far no luck.
You could create a group for each site and use the if member:
@echo off
ifmember "site1"
if errorlevel 1 goto site1
ifmember "site2"
if errorlevel 1 goto site2
site3:
<enter commands>
goto all
site1:
<enter commands>
goto all
site2:
<enter commands>
goto all
all:
<enter commands>
@echo off
ifmember "site1"
if errorlevel 1 goto site1
ifmember "site2"
if errorlevel 1 goto site2
site3:
<enter commands>
goto all
site1:
<enter commands>
goto all
site2:
<enter commands>
goto all
all:
<enter commands>
or you can do it by OUs
Set objSysInfo = CreateObject("ADSystemInfo ")
Set objNetwork = CreateObject("Wscript.Netw ork")
Set mappedDrives = objNetwork.EnumNetworkDriv es
Set WshNetwork = WScript.CreateObject("WScr ipt.Networ k")
Set Printers = WshNetwork.EnumPrinterConn ections
strUserName = objNetwork.UserName
strUserPath = "LDAP://" & objSysInfo.UserName
Set objUser = GetObject(strUserPath)
For Each strGroup in objUser.MemberOf
strGroupPath = "LDAP://" & strGroup
Set objGroup = GetObject(strGroupPath)
strGroupName = objGroup.CN
On Error Resume Next
Select Case strGroupName
' The following are drives mapping OU
Case "OU1"
ObjNetwork.MapNetworkDrive "M:", "\\Server1\HOME\" & strUserName
Case "OU2"
ObjNetwork.MapNetworkDrive "M:", "\\Server2\HOME\" & strUserName
Set objSysInfo = CreateObject("ADSystemInfo
Set objNetwork = CreateObject("Wscript.Netw
Set mappedDrives = objNetwork.EnumNetworkDriv
Set WshNetwork = WScript.CreateObject("WScr
Set Printers = WshNetwork.EnumPrinterConn
strUserName = objNetwork.UserName
strUserPath = "LDAP://" & objSysInfo.UserName
Set objUser = GetObject(strUserPath)
For Each strGroup in objUser.MemberOf
strGroupPath = "LDAP://" & strGroup
Set objGroup = GetObject(strGroupPath)
strGroupName = objGroup.CN
On Error Resume Next
Select Case strGroupName
' The following are drives mapping OU
Case "OU1"
ObjNetwork.MapNetworkDrive
Case "OU2"
ObjNetwork.MapNetworkDrive
ASKER
In the above script, it looks like I would just change paths, OU names and then put this into a .vbs file?
Yes. and i missed
"Next"
on the last row
"Next"
on the last row
ASKER
Got a few errors at first, but I think I've correct them. However, when I run this script, nothing happens. No errors and no mapped drives.
Set objSysInfo = CreateObject("ADSystemInfo")
Set objNetwork = CreateObject("Wscript.Network")
Set mappedDrives = objNetwork.EnumNetworkDrives
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set Printers = WshNetwork.EnumPrinterConnections
strUserName = objNetwork.UserName
strUserPath = "LDAP://" & objSysInfo.UserName
Set objUser = GetObject(strUserPath)
For Each strGroup in objUser.MemberOf
strGroupPath = "LDAP://" & strGroup
Set objGroup = GetObject(strGroupPath)
strGroupName = objGroup.CN
On Error Resume Next
Select Case strGroupName
' The following are drives mapping OU
Case "IT"
ObjNetwork.MapNetworkDrive "T:", "\\Acme_1\tools\" & strUserName
Case "Sales"
ObjNetwork.MapNetworkDrive "M:", "\Acme\dfs\sales\" & strUserName
End Select
Next
put msgbox strGroupName on line 15
you will see popup of all the groups name that you are in.
see if the name comes up the same as your case ""
you will see popup of all the groups name that you are in.
see if the name comes up the same as your case ""
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Another alternative might be to use %LOGONSERVER% but this could be a server outside of their site in some cases.