param( [Parameter(Mandatory=$true)][string] $ServiceAccountName ) #Install AD Module Add-WindowsFeature RSAT-AD-PowerShell | Out-Null #Install AD Service Account on a computer try { Install-ADServiceAccount -Identity $ServiceAccountName Test-ADServiceAccount $ServiceAccountName } catch { $ErrorMessage = $_.Exception.Message Write-Output "Failed to Install-ADServiceAccount with Error Message:`r`n $ErrorMessage `r`n`r`n You either did not run the script as Admin or did not give the Service Account the right to be installed on a specified computer." }