Changing SharePoint 2010 Managed Account Passwords with PowerShell
Posted: April 28, 2010 Filed under: Administration, Powershell, SharePoint 2010 1 Comment »A SharePoint 2010 Managed Account, is essentially a Service Account whose credentials are managed by SharePoint, which can automatically change the password of the account based on a given policy / schedule. Check out the posting “Managed Accounts” in Bill Baer’s Blog for more detailed information.
While most of the configuration of managed accounts will likely take place in Central Administration, at some point you may need (or simply prefer) to change the password via PowerShell. Personally, I ran into the need, as my farm account password had been changed and the Central Administration site would not run.
I used the following PowerShell script to change the Managed Account password.
$ver = $host | select versionif ($ver.Version.Major -gt 1) {$Host.Runspace.ThreadOptions = ReuseThread"}Add-PsSnapin Microsoft.SharePoint.PowerShellSet-location $home
$inManagedAcct = Read-Host 'Service Account'
$managedAcct = Get-SPManagedAccount $inManagedAcct
$inPass = Read-Host 'Enter Password' -AsSecureString$inPassConfirm = Read-Host'Confirm Password' -AsSecureString
Set-SPManagedAccount -Identity $managedAcct -NewPassword $inPass -ConfirmPassword $inPassConfirm -SetNewPassword
Click here to download the PS1 file. You may need to remove the first few lines that load the SharePoint PowerShell snap-in, if you intend to run the script from the “SharePoint 2010 Management Shell” console.
What’s my SharePoint 2010 Content Database ID?
Posted: March 16, 2010 Filed under: Powershell, SharePoint 2010, Troubleshooting Leave a comment »There are several commands that may require you to pass in a SharePoint Content Database ID. PowerShell makes it easy, just use the Get-SPContentDatabase command.
Pass in the WebApplication Parameter to get a list of all of your Content Databases for that Web Application:
Need to know the Content Database of a specific site (web)? Just pass in the site parameter:
For a complete list of SharePoint 2010 Content Database Powershell cmdlets go to http://technet.microsoft.com/en-us/library/ee890116(office.14).aspx
