Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Power shell script error "Set-ADServerSettings -ViewEntireForest $True"

Narhem
Tera Contributor

Hi

I'm doing a Active directory sync via MID server and I have power shell script written it is working for users to certain group below is the script 

import-module "$executingScriptDirectory\ADSpoke\ActiveDirectoryMain"

if (test-path env:\SNC_groupname) {
$groupname = $env:SNC_groupname;
$username = $env:SNC_username;
};

$groupname = $groupname -replace "%27","'";
$username = $username -replace "%27","'";

SNCLog-ParameterInfo @("Running AddUserToADGroup", $groupname, $username)

addADUserAccountToGroup -domainController $computer -username $username -groupname $groupname -useCred $useCred -credential $cred

 

But I wasn't to enable for all the users so added this line of code 'Set-ADServerSettings -ViewEntireForest $True'

 

This throwing error at cmdlet 

 

here is the error:

 

The term 'Set-ADServerSettings' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
HRESULT: [-2146233087]

0 REPLIES 0