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.

powershell script to create AD user

Sri56
Tera Contributor

Hi Guys,

I have used the following powershell command to create AD user:

New-ADUser -Name "XXX" -GivenName xxx -Surname xxx -SamAccountName XXXXXXX -UserPrincipalName xxxx@example.com -path "OU=XYZ, DC=example, DC=com"

But when running this script i am getting followinf error message:

"errorMessages": "The term 'New-ADUser' is not recognized as the name of a cmdlet, function, script file, or operable program.

So can someone please suggest on this.

Thanks,

Sri

5 REPLIES 5

Sri56
Tera Contributor

++when i am trying to create manually its working fine in AD.