Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script to loop through AD users and find out one with roaming profile 1

Status
Not open for further replies.

windowsfan

IS-IT--Management
Jan 26, 2007
237
US
Need help to come up with a script which loops thorugh Active Directory and find the user account which are configured with roaming profile and delete the roaming profile path. I found the below script , how can I modify the script to loop through all users in OU and set path =blank?


Set objUser = GetObject _
("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com")
objUser.Put "profilePath", "\\sea-dc-01\Profiles\myerken"
objUser.SetInfo
 
You can use Windows Server 2003's built-in Directory Service Tools to accomplish this task.

The first script below will run through Active Directory and write the results of all users and their "Profile path" attribute set in Active Directory to a text file. You can run this script for documentation purposes to see who all has a profile path set to something besides a blank value.

dsquery user domainroot -limit 1000 -name * | dsget user -display -profile >AD_User_Profile_Path.txt

This next script will query through Active Directory and change every user account's "Profile path" attribute to a blank value.

dsquery user domainroot -limit 1000 | dsmod user -profile ""

The -limit switch is used because by default dsquery can only display 100 results. Increase the numerical value of the -limit switch if you have more user accounts in your Active Directory.

Joey
CCNA, MCSA 2003, MCP, A+, Network+, Wireless#
 
How can I filter users with profile not equal to blank.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top