troubleshooting Question

How to set values to AD User Properties with Powershell

Avatar of namerg
namergFlag for United States of America asked on
Active DirectoryScripting LanguagesPowershell
43 Comments5 Solutions3896 ViewsLast Modified:
Hello,

I am trying to change the following AD User properties



$AD_User_Change = Read-Host '1 = LASTNAME. 2 = FIRST NAME. 3 = DEPARTMENT. 4 = TITLE. 5 = TELEPHONE NUMBER. 6 = EMPLOYEE ID. 7 = EMPLOYEE NUMBER'

If 1 is chosen then

$NewLastName = Read-Host "Are you sure, you want to replace the following lastname ""$($AD_USER.sn)"" by ""$($InputLastName)"" (Y/N)"

if (($NewLastName -eq "y"))
   {
    Set-ADUser -sn "$($InputLastName)" ---> I AM STUCK HERE
Write-Host "New LastName SET"
Start-Sleep -Seconds 30
                    }
              }
Thanks for your help,
G
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 5 Answers and 43 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 5 Answers and 43 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros