Active Directory (AD) using a login script Visual Basic Script (vbs)

Asked By 0 points N/A Posted on -
qa-featured

How I can change the directory path to all my users in Active Directory (AD) using a login script Visual Basic Script (vbs) and how I could identify if the user accounts have a local administrative log in?

SHARE
Answered By 0 points N/A #107312

Active Directory (AD) using a login script Visual Basic Script (vbs)

qa-featured

 

Hi David,
 
You can set the directory path in Active Directory using 2 steps. One is in GPO and another using a VB script. If you are not using Windows server 2008, GPO setting may not be an option for you. You can try to run the script below to set the directory path using VB:
 
On Error Resume Next
 
Set objUser = GetObject("LDAP://cn=Ken Myer, ou=Finance, dc=fabrikam, dc=com")
 
If IsEmpty(objUser.homeDirectory) or IsNull(objUser.homeDirectory) Then
 
strUser = objUser.sAMAccountName
 
strHomeDirectory = "\atl-dc-01users" & strUser
 
objUser.homeDirectory = strHomeDirectory
 
objUser.homeDrive = "Z:"
 
objUser.SetInfo
 
End If
 
Another code you can use is this:
 
Setfso =CreateObject("Scripting.FileSystemObject") 
Setf1 =fso.GetFolder(".")' Returns the current directory Setf2 =fso.GetFolder(".backup")' Returns the "backup" directory under the current directory
 
Aristono

Login/Register to Answer

Related Questions