Cree cuentas de servicio de SharePoint en AD usando PowerShell
Hoy en día hago muchas implementaciones de SharePoint. Utilizo scripts de PowerShell para crear rápidamente cuentas de servicio de SharePoint en lugar de crearlas manualmente en el directorio activo una por una. Ejecute el siguiente script de PowerShell desde el controlador de dominio (o desde la estación de trabajo instalada de Herramientas de administración remota del servidor) para crear cuentas de servicio de una sola vez.
Aquí está la lista de cuentas de servicio que uso en mis implementaciones de SharePoint 2013/SharePoint 2010:
- SP_Setup - Cuenta de configuración de SharePoint
- SP_Farm - Cuenta de granja de SharePoint
- SP_Pool : la cuenta se utiliza para ejecutar los grupos de aplicaciones web.
- SP_Services: la cuenta de servicios se utiliza para ejecutar las aplicaciones de servicio.
- SP_Crawl: la cuenta de acceso al contenido predeterminada para la aplicación del servicio de búsqueda
- SP_UserProfile: la cuenta de importación y sincronización del perfil de usuario
- SP_SuperUser: cuenta de caché para la cuenta de superusuario de la aplicación web
- SP_SuperReader: cuenta de caché para la cuenta de súper lector de aplicaciones web
- SQL_Admin: administrador de SQL en SQL Server. Se utiliza para instalar SQL Server.
- SQL_Services: cuenta de servicio para ejecutar servicios de SQL Server
PowerShell para crear cuentas de servicio de SharePoint en Active Directory
Utilice este script de PowerShell para automatizar la creación de cuentas de servicio en Active Directory. Aunque esto se puede hacer manualmente, usar PowerShell le ahorrará tiempo y garantizará que todas las cuentas se creen de forma coherente. Esta publicación de blog le mostrará cómo crear cuentas de servicio de SharePoint en AD mediante cmdlets de PowerShell, lo que le facilitará las implementaciones/configuraciones repetidas.
Aquí está el script de PowerShell para crear cuentas de servicio de SharePoint en Active Directory:
Import-Module ActiveDirectory -ErrorAction SilentlyContinue
#Set configurations
$AccountPassword = "Password1"
#Convert to Secure string
$Password = ConvertTo-SecureString -AsPlainText $AccountPassword -Force
$Domain = "YourDomain.com"
#Specify the OU
$AccountPath= "ou=SharePoint,DC=YourDomain,DC=com"
#Create SharePoint Accounts
$Account="SP_Setup"
New-ADUser -SamAccountName $Account -name $Account -UserPrincipalName $Account@$domain -Accountpassword $Password -Enabled $true -PasswordNeverExpires $true -path $AccountPath -OtherAttributes @{Description="Account Used to install SharePoint"}
$Account="SP_Farm"
New-ADUser -SamAccountName $Account -name $Account -UserPrincipalName $Account@$domain -Accountpassword $Password -Enabled $true -PasswordNeverExpires $true -path $AccountPath -OtherAttributes @{Description="SharePoint Farm Account."}
$Account="SP_Pool"
New-ADUser -SamAccountName $Account -name $Account -UserPrincipalName $Account@$domain -Accountpassword $Password -Enabled $true -PasswordNeverExpires $true -path $AccountPath -OtherAttributes @{Description="SharePoint Web Application Pools Account"}
$Account="SP_Services"
New-ADUser -SamAccountName $Account -name $Account -UserPrincipalName $Account@$domain -Accountpassword $Password -Enabled $true -PasswordNeverExpires $true -path $AccountPath -OtherAttributes @{Description="Account to run the Service Applications"}
$Account="SP_Crawl"
New-ADUser -SamAccountName $Account -name $Account -UserPrincipalName $Account@$domain -Accountpassword $Password -Enabled $true -PasswordNeverExpires $true -path $AccountPath -OtherAttributes @{Description="Content Access Account for the Search Service Application"}
$Account="SP_UserProfile"
New-ADUser -SamAccountName $Account -name $Account -UserPrincipalName $Account@$domain -Accountpassword $Password -Enabled $true -PasswordNeverExpires $true -path $AccountPath -OtherAttributes @{Description="User Profile Import and Synchronization Account"}
$Account="SP_SuperUser"
New-ADUser -SamAccountName $Account -name $Account -UserPrincipalName $Account@$domain -Accountpassword $Password -Enabled $true -PasswordNeverExpires $true -path $AccountPath -OtherAttributes @{Description="Web application super User account"}
$Account="SP_SuperReader"
New-ADUser -SamAccountName $Account -name $Account -UserPrincipalName $Account@$domain -Accountpassword $Password -Enabled $true -PasswordNeverExpires $true -path $AccountPath -OtherAttributes @{Description=" Web application super reader account"}
$Account="SQL_Admin"
New-ADUser -SamAccountName $Account -name $Account -UserPrincipalName $Account@$domain -Accountpassword $Password -Enabled $true -PasswordNeverExpires $true -path $AccountPath -OtherAttributes @{Description="SQL Server Admin Account"}
$Account="SQL_Services"
New-ADUser -SamAccountName $Account -name $Account -UserPrincipalName $Account@$domain -Accountpassword $Password -Enabled $true -PasswordNeverExpires $true -path $AccountPath -OtherAttributes @{Description="Account to run SQL Server services"}
Aquí estoy especificando cuentas directamente en el script de PowerShell. Sin embargo, también puede utilizar archivos CSV para importar una lista de cuentas de servicio y crearlas de forma masiva en el directorio activo.
Crear cuentas de servicio de SharePoint desde CSV
Aquí está mi archivo CSV con cuentas, contraseñas y descripciones completas:
Script de PowerShell para crear cuentas de AD desde CSV:
Import-Module ActiveDirectory -ErrorAction SilentlyContinue
#Set configurations
$Domain = "YourDomain.com"
#Specify the OU
$AccountPath= "ou=SharePoint,DC=YourDomain,DC=com"
# Import the CSV File
$ServiceAccounts = Import-Csv D:\SharePoint\ServiceAccounts.csv
Foreach ($ServiceAccount in $ServiceAccounts)
{
write-host "Creating Account:"$ServiceAccount.Account
write-host "Creating Account:"$ServiceAccount.password
#Convert to password to Secure string
$AccountPassword = ConvertTo-SecureString -AsPlainText $ServiceAccount.Password -Force
$UPN = "$($ServiceAccount.Account)@$($domain)"
#Create SharePoint Service Accounts from CSV
New-ADUser -SamAccountName $ServiceAccount.Account -name $ServiceAccount.Account -UserPrincipalName $UPN -Accountpassword $AccountPassword -Enabled $true -PasswordNeverExpires $true -path $AccountPath -OtherAttributes @{Description=$ServiceAccount.Description}
}

