Active Directory Powershell Errors

I am working on creating a PS script for simply adding new AD users. I am fairly new to PS. I cannot seem to get the following command to work.

New-ADUser -SamAccountName U1 -Name "User 1" -AccountPassword (ConvertTo-SecureString -AsPlainText "p@ssw0rd" -Force) -Enabled $true -Path 'OU=Test,DC=TEST,DC=ICG,DC=LOCAL'

I keep getting the following error:

New-ADUser : Server instance not found on the given port.
At line:1 char:11
+ New-ADUser <<<<  -SamAccountName nnn2 -Name "nnn2" -UserPrincipalName nnn2@jj
 -AccountPassword (ConvertTo-SecureString -AsPlainText "somePassword" -Force) -
Enabled $true -PasswordNeverExpires $true -Path 'CN=Users,DC=ICG,DC=LOCAL'
    + CategoryInfo          : InvalidArgument: (:) [New-ADUser], ArgumentExcep
   tion
    + FullyQualifiedErrorId : Server instance not found on the given port.,Mic
   rosoft.ActiveDirectory.Management.Commands.NewADUser
LVL 1
ICGAsked:
Who is Participating?
 
ICGConnect With a Mentor Author Commented:
AD needed to be reinstalled.
0
 
ICGAuthor Commented:
I just realized that as soon as the PS opens, it displays "Attempting to perform the InitializeDefaultDrives operation on the 'ActiveDirectory' provider failed."

This is on a DC and I am logged in as the Admin. I am also running PS as an admin.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.