How To Change Service Account Using Powershell Using Domain Account
Are y'all looking to change your service accounts in SharePoint? Perhaps you've recently changed your domain name and need to update all of your service account references. In this guide, we'll evidence yous how to change your service accounts in SharePoint chop-chop and hands. I will also share how to use PowerShell to alter your service accounts.
If yous have created a new managed account or want to change the mapping of managed Business relationship with SharePoint 2016 Services, Go to:
- Central Assistants >> Security
- Nether the Full general Security section, click Configure Service accounts.
- Selection the Appropriate Service and Service Account from the Dropdown.
- Click "OK" to save your changes
Read more: Configuring Managed Accounts in SharePoint 2016
Why? Because non all accounts can be changed via SharePoint Cardinal Administration UI. Hither are my scripts to change various service accounts in SharePoint using PowerShell. Please note, there are Four types of Service accounts nosotros have to take care of:
- SharePoint Service Instances like Distribution cache, Claims to window token service, etc
- SharePoint Farm Service
- Service Application's AppPool Business relationship
- Web Awarding'southward AppPool Account
Add together-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Custom Function to change Service business relationship of given service Office Fix-ServiceIdentity($svc, $UserName) { #Get the electric current service account $ProcessIdentity = $svc.Service.ProcessIdentity if ($ProcessIdentity.Username -ne $UserName) { $ProcessIdentity.Username = $UserName $ProcessIdentity.Update() Write-Host "Service Account Set up!" } } #Become the Service $Service = Become-SPServiceInstance | Where {$_.TypeName -eq "Claims To Windows Token Service"} #Phone call the part to Set "Local System" Identity to given service Prepare-ServiceIdentity $Service "NT AUTHORITY\SYSTEM"
The above script changes the specified service'southward service account.
Nosotros however rely on the STSADM tool to update SharePoint 2013's Farm Account. Employ this command line to update SharePoint Farm's service account credentials:
stsadm -o updatefarmcredentials -userlogin "DOMAIN\username" -countersign "Password here"
Change Service Application Pool's Service Account:
To change the application pool's service accounts, employ this PowerShell script:
Add together-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Custom Role to change Service account of given service Office Set-ServiceAppPoolIdentity($SvcAppPool, $UserName) { if ($SvcAppPool.ProcessAccountName -ne $UserName) { Gear up-SPServiceApplicationPool $SvcAppPool -Account $UserName Write-Host "Awarding Pool Service Account Updated!" } } #Become the Service $SvcAppPool = Get-SPServiceApplicationPool | Where {$_.Name -eq "Service Application App Pool"} #Call the office to Set "Local Organisation" Identity to given service Set-ServiceAppPoolIdentity $SvcAppPool "Crescent\SP2016Admin"
Change Web Awarding App Puddle Accounts:
Add together-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Custom Function to change Service business relationship of Web App Pool Function Prepare-WebAppPoolIdentity($WebAppPool, $UserName) { if ($WebAppPool.ManagedAccount.UserName -ne $UserName) { #Get the Managed Business relationship $ManagedAccount= Get-SPManagedAccount $UserName #Prepare the Managed Account $WebAppPool.ManagedAccount = $ManagedAccount $WebAppPool.Update() Write-Host "Spider web Application App Pool Account Updated!" } } #Get Spider web App's App Pool $WebAppPool = (Get-SPWebApplication "https://intranet.crescent.com").ApplicationPool #Call the office to Prepare the Managed Account to Web App Pool Set-WebAppPoolIdentity $WebAppPool "Crescent\SPAdmin"
Source: https://www.sharepointdiary.com/2015/10/change-service-account-in-sharepoint-using-powershell.html
Posted by: mccoybultempap.blogspot.com
0 Response to "How To Change Service Account Using Powershell Using Domain Account"
Post a Comment