PowerShell script to change Password for App pool and manage account in SharePoint Onprem server

Hari Rama Krishnan
 
Technology Specialist
May 27, 2018
 
Rate this article
 
Views
14272

 

 

In development machine if we install the SharePoint on premise(2010 or 2013 SharePoint server) with User or our Id , due to policy if we change our password for installation ID, then We will  face issue on access SharePoint site due to password , the work around solution for this is once the installation id password, changed then   the app pool and Manage account password also need to be changed, instead changing manually by going to IIS and SharePoint Central administration we can execute the below script on SharePoint server to change the password

App Pool Password change

 Add-PSSnapin "Microsoft.SharePoint.PowerShell"
 
 Import-Module WebAdministration
 $applicationPools = Get-ChildItem IIS:AppPools | where { $_.processModel.userName -eq "domainusername" }
  
 foreach($pool in $applicationPools)
 {
     $pool.processModel.userName = "domainusername"
     $pool.processModel.password = "password"
     $pool.processModel.identityType = 3
     $pool | Set-Item
 }
  
 Write-Host "Application pool passwords updated..." -ForegroundColor Magenta 
 Write-Host "" 
 Read-Host -Prompt "Press Enter to exit"
 

Managed Account Password change

 $m = Get-SPManagedAccount -Identity “domainusername”
  
 Set-SPManagedAccount -Identity $m  -ExistingPassword (ConvertTo-SecureString "Password" -AsPlainText -force) –confirm
 

 

Hope the handy script helps you to change managed and app pool account password and save few hours of effort.

 

Happy Coding,

Hariramakrishnan Vasuthevan

Author Info

Hari Rama Krishnan
 
Technology Specialist
 
Rate this article
 
Hariramakrishnan Vasuthevan is a SharePoint Consultant and he has very good experience in the field of Microsoft Technologies, specifically SharePoint 2010, 2013, 2016 and O365, ASP.NET, Angular JS. He involved ...read more
 

Leave a comment