I'm creating user profile service application in sharepoint server 2013 . for creating new sync connection , I need to enter Forest name. But I don't have permissions to see AD . I just have Farm account.

I have tried the below powershell cmd but no luck.

$forest = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest()

So anyone have smart idea to know forest name?? Thanks.

2 Answers 2


Your Farm Account should have read access to AD for many farm purposes. So let's suppose it has it.

You can get forest name by executing below code in PowerShell (suspect you have not loaded assembly before calling GetCurrentForest):

[System.Reflection.Assembly]::LoadWithPartialName('System.DirectoryServices') | Out-Null

If you have AD Module installed on your server, you can also use it like this:




Hope it helps.


If you have the AD DS Tools installed you can run the cmdlet Get-ADDomainController



Get-ADDomainController | Select-Object Forest

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.