manual

37 www.microsoft.com/sharepoint
Figure 19: Show Help Content for Windows PowerShell Cmdlets
Scenario: Provisioning of Managed Accounts
Steve has just completed the installation of SharePoint Server 2010 and is preparing to
configure the farm. He has put in a request to the Active Directory administrators to
have all necessary service accounts provisioned. All of these accounts were created by
using the same password. Steve now needs to set up all of these accounts as managed
accounts (this will be covered in more detail later in this guide). This way, SharePoint
Server can change their initial passwords to something that only SharePoint Server
knows, and SharePoint Server can automatically change the password in the future as
required by domain policy. This will greatly reduce the password management load on
Steve, because after he configures the accounts as managed he is no longer in control
of their passwords. SharePoint Server 2010 will handle everything.
Steve begins by creating a text file that includes one account per line for all of the
accounts he needs to configure. He names the file Usernames.txt. Steve can then run the
following Windows PowerShell command.
$password = Read-Host "What is the password for all accounts?" -assecurestring ; Get-
Content usernames.txt | ForEach-Object {New-SPManagedAccount -password
$password -username litwareinc\$_; Set-SPManagedAccount -identity $_ -autogenerate
-confirm:$False}
To better understand what Steve is doing, look at the command in the pieces that make
up the whole.
$password = Read-Host "What is the password for all accounts?" -assecurestring ;
The Read-Host cmdlet causes the user to be prompted to enter a password. For Steve,
this is the password the Active Directory administrator originally configured for all of the
accounts. The password is then saved to the variable $password as a secure string. The