Quick SharePoint Service Accounts

When creating SharePoint test environments, one of the prerequisites is to have the necessary SharePoint service accounts. The powershell script below will enable you to create the AD accounts and ready for use when configuring the SharePoint farm. These accounts relate to SharePoint farm configuration, web application pool accounts, service application accounts, search service and content access accounts, user profile synchronisation accounts and object cache accounts. By all means you can modify the values to suit your requirements.

# Get the logged-on user's domain in DN form
$mydom = (get-addomain).distinguishedname

# Specify the OU we want to create the users in
$ouName = "SP Service Accounts"

# Build the full DN of the target OU
$oudn = "OU=$ouname,$mydom"

# Check if the target OU exists. If not, create it.
$OU = get-adorganizationalunit -Filter { name -eq $ouname }
if($OU -eq $null)
{New-ADOrganizationalUnit -Name $OUName -Path $mydom}
else
{write-host "The OU" $ou "already exists."}

# Create users
New-ADUser –Name "SP_Farm" –SamAccountName "SP_Farm" –DisplayName "SP_Farm" `
-Path $oudn –Enabled $true –ChangePasswordAtLogon $false `
-AccountPassword (ConvertTo-SecureString "pass@w0rd" -AsPlainText -force) -PassThru
New-ADUser –Name "SP_ServiceApp" –SamAccountName "SP_ServiceApp" –DisplayName "SP_ServiceApp" `
-Path $oudn –Enabled $true –ChangePasswordAtLogon $false `
-AccountPassword (ConvertTo-SecureString "pass@w0rd" -AsPlainText -force) -PassThru
New-ADUser –Name "SP_Portal" –SamAccountName "SP_Portal" –DisplayName "SP_Portal" `
-Path $oudn –Enabled $true –ChangePasswordAtLogon $false `
-AccountPassword (ConvertTo-SecureString "pass@w0rd" -AsPlainText -force) -PassThru
New-ADUser –Name "SP_MySites" –SamAccountName "SP_MySites" –DisplayName "SP_MySites" `
-Path $oudn –Enabled $true –ChangePasswordAtLogon $false `
-AccountPassword (ConvertTo-SecureString "pass@w0rd" -AsPlainText -force) -PassThru
New-ADUser –Name "SP_Search" –SamAccountName "SP_Search" –DisplayName "SP_Search" `
-Path $oudn –Enabled $true –ChangePasswordAtLogon $false `
-AccountPassword (ConvertTo-SecureString "pass@w0rd" -AsPlainText -force) -PassThru
New-ADUser –Name "SP_SearchAccess" –SamAccountName "SP_SearchAccess" –DisplayName "SP_SearchAccess" `
-Path $oudn –Enabled $true –ChangePasswordAtLogon $false `
-AccountPassword (ConvertTo-SecureString "pass@w0rd" -AsPlainText -force) -PassThru
New-ADUser –Name "SP_UPSync" –SamAccountName "SP_UPSync" –DisplayName "SP_UPSync" `
-Path $oudn –Enabled $true –ChangePasswordAtLogon $false `
-AccountPassword (ConvertTo-SecureString "pass@w0rd" -AsPlainText -force) -PassThru
New-ADUser –Name "SP_SuperUser" –SamAccountName "SP_SuperUser" –DisplayName "SP_SuperUser" `
-Path $oudn –Enabled $true –ChangePasswordAtLogon $false `
-AccountPassword (ConvertTo-SecureString "pass@w0rd" -AsPlainText -force) -PassThru
New-ADUser –Name "SP_SuperReader" –SamAccountName "SP_SuperReader" –DisplayName "SP_SuperReader" `
-Path $oudn –Enabled $true –ChangePasswordAtLogon $false `
-AccountPassword (ConvertTo-SecureString "pass@w0rd" -AsPlainText -force) -PassThru

#End

Advertisements

Chirag is an Independent Consultant at Patel Consulting, Chartered IT Professional, TOGAF9 Certified Architect and Microsoft Certified Solution Expert (Productivity, Data Platform) based in London, UK with more than 15 years of industry experience. He works with a wide variety of clients in many sectors, designing and implementing business collaboration, data and information management solutions and services based on SharePoint and Office 365 technologies to create business value for both themselves and their customers, including UK Microsoft Gold Partners with deployment, upgrade and migration services delivery. Chirag is an active SharePoint community participant, frequent speaker at local and international events including SharePoint Saturdays and Collab365. He is also one of the co-organisers of the SharePoint User Group UK (London) region. In 2011, for his valuable contributions to Microsoft TechNet forums he received a Microsoft Community Contributor Award. In his little spare time he enjoys cycling, cricket and every year participating in Charity bike rides and Duathlons. You can find him online at www.techchirag.com and follow Chirag on Twitter at @techChirag.

Tagged with: , ,
Posted in SharePoint, Tools
3 comments on “Quick SharePoint Service Accounts
  1. […] article was originally posted here, on the Chirag Patel blog. .gplus #___plusone_0, .gplus #___plusone_1,.gplus #___plusone_2, […]

  2. […] The SharePoint service accounts were created via Active Directory Powershell with the script from Chirag Patel blog site. DB01 – This virtual machine was joined to the chiragtest.com domain. SQL Server was already […]

  3. […] The SharePoint service accounts were created via Active Directory Powershell with the script. DB01 – This virtual machine was joined to the chiragtest.com domain. SQL Server was already […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

SharePoint Community

Categories
%d bloggers like this: