Updating active directory
Additionally, doing this step ensures compatibility with Windows Power Shell 2.0, if you are still using that version.Note Be very careful using the Windows 8 RSAT tools and the Active Directory module from Windows Server 2012 in a mixed environment because the updated Active Directory module adds many additional cmdlets, which, obviously, would not work on a computer with an older version of the module.When in doubt, use the #Requires –version 3.0 to ensure compatibility.After I import the Active Directory module, I create a variable to store the old company name (the one I will change in Friday’s blog post).Refer to the documentation references below the script for more information about the specific cmdlets and how to use the Active Directory module for Power Shell. $Finance Users = Get-ADUser -Filter * -Search Base "OU=Finance, OU=User Accounts, DC=FABRIKAM, DC=COM" # Iterate the users and update the department and title attributes in AD.foreach($Finance User in $Finance Users) The example uses the Instance parameter of Set-ADUser to update each user in the OU.
For example, when a user logs into a computer that is part of a Windows domain, Active Directory checks the submitted password and determines whether the user is a system administrator or normal user.
Summary: Microsoft Scripting Guy, Ed Wilson, shows how to use Windows Power Shell to modify existing user accounts in Active Directory. The other day, I recorded a Tech Net Radio podcast with Blain Barton and Matt Hester named, “The 10 non-scary things about Windows Power Shell 3.0.” It should be released today, and it will be available through my Learn Windows Power Shell page at the Script Center.
All of the Tech Net Radio podcasts are linked at the bottom of the page.
PS C:] One thing to keep in mind is that the parameter names do not line up with the ADSI attribute names that appear in ADSI Edit.
This can be a bit confusing when trying to update an older script that used ADSI.
I debated about doing this, but, in the end, because I am using the company name in three different places, I decided it would save some time and not add too much complexity to the script.