$wa = get-spwebapplication <>

$searchad = $wa.peoplepickersettings.searchactivedirectorydomains

$newdomain = new-object Microsoft.SharePoint.Administration.sppeoplepickersearchactivedirectorydomain

$newdomain.domainname = <domain/forest DNS name>
blogs
$newdomain.Isforest = $true/$false

$newdomain.loginname = <loginname>

[System.Security.SecureString]$secureStringValue = Read-Host "Enter the service account password: " -AsSecureString;

$newdomain.setpassword($securestringvalue)

$searchad.add($newdomain)

$wa.update()