This error repeats itself for the number of times that there is a user in the .csv file. This is from using Powershell to make changes to Domain Users OU in AD lab.
Where am I giving it an argument of “.”? At character 1?
The code seems to be okay. Try to add a tab to New-ADUser and the code that follows.
Ricardo
it looks like you are missing these 3 lines at beginning
# Import the AD Module
Import-Module ActiveDirectory
# Get the path to our target CSV file
Thank you ricardo.p and ambroseg. I added a tab to New-ADUser and the code that follows.
Yes, I did overlook “Import-Module ActiveDirectory”. It’s added now.
I know the importance of comment lines, but I didn’t bother putting them in. I just want this lab to work then move on.
Now I’m not getting any errors but the script or the .csv file is causing PowerShell to prompt me to supply values but the values are already given via the .csv file. It’s the “NewUsers.csv” that has already been prewritten for the AD Powershell lab. As shown in the screenshot, I noticed that the “-Name” parameter on the next line after “New-ADUser `” is a different color than the parameter names below that.
I can tell you wat happened after the ` mark in the new-aduser line you hit the space bar instead of enter to move on to next line. I know this might sound counter-productive for the lab but you can copy the script to a notepad from the lesson and then paste it to the lab using the lightning menu for the lab and selecting the copy text from clipboard in the options from that drop down. It will open a popup window you just paste the text there and it will transfer it to the lab computer.
Thanks again ambroseg. I deleted the space after the “`” on the line with the New-ADUser. After doing so I received the same error as shown in the first message of this post. I then took your advice, I copy and pasted from the lesson into the lab, saved the script then ran it. All of the “-Name”, “-GivenName”, all of those parameters were then blue again. I had to clean up the script by making sure that no spaces were after the end of every line except for the comment lines. I then saved that script then ran it within the lab. I then received a different error message stating that the server is unwilling to process the request. I entered no content below line 25. If you want, feel free to do what I did so you can duplicate what is happening. See below.
ok now I know where it went wrong for you. the csv file on the lab server is written for a different domain than you are working on. So you have to change the line for all the users in the csv to the right domain. you can get the info for the right domain by making a user on the server turn on advance features for active directory then go into that user and look at attribute tab and find distinguished name and select everything after the username.
I went into csv and pasted it into one spot then used find and replace to set the others. Then saved it and ran it just fine.
That’s correct @ambroseg thanks for contributing to the community.
Try it out @jwernicke351, and let us know if you still have issues.
Ricardo
Yes, that worked. Issue resolved! Thank you.