Hi all,
I'm trying to write a logon script that checks if the user logging on has a home directory, and if not, create one. The problem I'm having is that as the script is running under the user context, they obviously don't have write permissions to AD. Is there any way this could work, perhaps by some sort of impersonation in the script? Alternatively if anyone has any better suggestions as to a better way to achieve this I'm more than open to suggestions!
Here is the code I have currently if it helps;
Set oADInfo = CreateObject("ADSystemInfo")
sDN = oADInfo.UserName
Set oUser = GetObject("LDAP://" & sDN)
sUserName = oUser.sAMAccountName
sHomeDir = oUser.homeDirectory
If sHomeDir = "" Then
sHomeDir = "\\fileserver\users\" & sUserName
oUser.Put "homeDirectory", sHomeDir
oUser.Put "homeDrive", "F:"
oUser.SetInfo
End IfMany thanks,
James