Changing the scope so you can view the entire domain in Powershell

Issue: The requested search root 'Domain/Microsoft Exchange SecurityGroups' is not within the scope of this operation
. Cannot perform searches outside the scope 'Domain Name'.
    + CategoryInfo          : NotSpecified: (0:Int32) [Get-RoleGroup], ADOperationException
    + FullyQualifiedErrorId : 1A950E45,Microsoft.Exchange.Management.RbacTasks.GetRoleGroup
 
Resolution: 
for exchange 2007 = $AdminSessionADSettings.ViewEntireForest = $true
For exchange 2010 = Set-AdServerSettings -ViewEntireForest $True