puppet
IS-IT--Management
- Dec 13, 2001
- 140
Is there any way to search AD to find (and create a list of) users that have roaming profiles setup? I have very little scripting experience.
Thanks
Thanks
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
On Error Resume Next
Set objUser = GetObject _
("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com")
objUser.GetInfo
strProfilePath = objUser.Get("profilePath")
strScriptPath = objUser.Get("scriptPath")
strHomeDirectory = objUser.Get("homeDirectory")
strHomeDrive = objUser.Get("homeDrive")
WScript.echo "profilePath: " & strProfilePath
WScript.echo "scriptPath: " & strScriptPath
WScript.echo "homeDirectory: " & strHomeDirectory
WScript.echo "homeDrive: " & strHomeDrive
Set objDomain = getObject("LDAP://rootDse")
strDomainNC = objDomain.Get("defaultNamingContext")
ldPath = "<LDAP://" & strDomainNC & ">"
Set fso = CreateObject("Scripting.FileSystemObject")
set txtStream = fso.OpenTextFile("UserProfileList.csv", 2, True)
txtStream.WriteLine "Begin : " & date & " " & Time
Set objADOconnADSI = CreateObject("ADODB.Connection")
objADOconnADSI.Open "Provider=ADsDSOObject;"
Set objCommandADSI = CreateObject("ADODB.Command")
objCommandADSI.ActiveConnection = objADOconnADSI
objCommandADSI.Properties("Size Limit")= 10000
objCommandADSI.Properties("Page Size")= 10000
objCommandADSI.CommandText = ldPath & ";(objectClass=user);" & _
"sAMAccountName," & _
"name," & _
"profilePath;subtree"
Set objRSADSI = objCommandADSI.Execute
do while NOT objRSADSI.EOF
if len(objRSADSI.fields("profilePath")) > 0 then
txtStream.WriteLine objRSADSI.fields("name") & "," & _
objRSADSI.fields("sAMAccountName") & "," & _
objRSADSI.fields("profilePath")
end if
objRSADSI.MoveNext
loop
txtStream.WriteLine "End : " & date & " " & Time
wscript.echo "Done!"