creating managed accounts with powershell

A Basic script that allows you to create the Managed Account with PowerShell.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$AllAccounts = @("Contoso\Svc_SPFarm","Contoso\Svc_SPSearch","Contoso\svc_SPSvcApp","Contoso\Svc_SPWebApp", "Contoso\Svc_SPUsrProf", "Contoso\Svc_SPSecStor")
foreach($anAccount in $AllAccounts)
    $account = New-Object System.Management.Automation.PSCredential $anAccount, (ConvertTo-SecureString “P’@’$’$word” –AsPlainText –Force)
    $managedAccount = New-SPManagedAccount $account
Get-SPManagedAccount | Select UserName

Leave a Reply

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

You are commenting using your 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 )

Connecting to %s