Setup. A SharePoint farm in a domain. You want to add a managed account from another domain, with one-way trust between domains.
Example: DomainB TRUST DomainA. SharePoint instance is in DomainB and you want to add a managed account from DomainA.
User AdminA has local admin and farm admin privileges on farm and is used to create ManagedA managed account.
Problem:
1.
Add-SPShellAdmin -UserName DomainA\AdminA
2. Add the user to the Local Administrators group
3. Run Powershell (Normal not SPS) from a user of other domain
4. Elevate privileges
start-process powershell –verb runAs
5.
$cred = Get-Credential # Enter ManagedA account details
Add-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue
6.
New-SPManagedAccount -Credential $cred