none
Powershell Create AD Users from CSV RRS feed

  • Question

  • I am trying to figure out what exactly is preventing the following script:

    https://gal.vin/2017/09/13/powershell-create-ad-users-from-csv/

    From giving the desired results. It seems to be asking me a question as stated below:

    "Supply values for the following parameters:"

    "UsersList:"

    Has anyone see this before. What is it that I need to understand or clarify in the way I am running this script?

    Friday, February 23, 2018 3:07 PM

Answers

  • Your code uses the -OU and -Upn parameters. Likewise, you should use the -Csv parameter to specify the CSV file.

    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    • Marked as answer by tbqwerty Friday, February 23, 2018 6:44 PM
    Friday, February 23, 2018 4:25 PM
    Moderator

All replies

  • You need to supply the path and name of the CSV file used by the script. It is a mandatory parameter. Check the script for the string $UsersList.

    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    Friday, February 23, 2018 3:29 PM
    Moderator
  • Ok, I can see the following section:

    Param(
        [parameter(Mandatory=$True)]
        [alias("Csv")]
        $UsersList,
        [parameter(Mandatory=$True)]
        [alias("Ou")]
        $OrganisationalUnit,
        [parameter(Mandatory=$True)]
        [alias("Upn")

    Does this mean that I need to put the path somewhere in the command or do I need to modify the script?

    This is my current command:

    TEST01.ps1 -Csv c:\ADCreateUsers\users.csv -Ou 'ou=TEST,ou=ContosoUsers,dc=contoso,dc=com' -HomeLetter H: -HomePath \\hdrives\Users -Upn contoso.com -L C:\ADCreateUsers\logs

    As you can see I cut out a few things like emailing the log, and adding to a group (for now).

    Friday, February 23, 2018 3:43 PM
  • You need to learn PowerShell.  Parameters are also common requirements for all programs in Windows.  In Windows we call programs and scripts and pass parameters.  Parameters are always passed on the command line by name or position.

    Search for help on basic Windows command use. 

    Also be aware that technical forums are not for teaching basic Windows or command usage.  You need to learn this before attempting to use command line programs and scripts.

    Call you script with parameters

    <path>\scriptname.ps1 -?

    This will show you the available parameters and names.

    Learn to use help:

    help help  -full

    help about_scripts

    Learn PowerShell  


    \_(ツ)_/

    Friday, February 23, 2018 4:23 PM
  • Your code uses the -OU and -Upn parameters. Likewise, you should use the -Csv parameter to specify the CSV file.

    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    • Marked as answer by tbqwerty Friday, February 23, 2018 6:44 PM
    Friday, February 23, 2018 4:25 PM
    Moderator
  • The link you posted has very clear instructions and an explanation of exactly hw to use the script.  You need to read it all carefully.


    \_(ツ)_/

    Friday, February 23, 2018 4:29 PM
  • Thank you all for the pointers, it helps.

    "You need to learn this before attempting to use command line programs and scripts."

    What better way to learn than to do...

    That is an interesting thought. Is it possible to learn command line without being allowed to touch a terminal?

    Ok, so I sent a snarky comeback, but seriously, you did help me and I appreciate it... :)

    Friday, February 23, 2018 5:27 PM
  • Reading the true technical description is always the best place to start.  Why do you think brain surgeons learn neuro science from books in a classroom first.  Any other method is slow and leads to fundamental errors in the required knowledge.  In science and technology it is the technical understanding that must proceed the doing so the doing is fully informative and bad concepts are not implanted.  The Internet is the worst place to learn when you do not have a fundamental technical background in what you are trying to learn.

    Guessing in  technology is more of a crapshoot then dice or roulette.


    \_(ツ)_/

    Friday, February 23, 2018 5:36 PM
  • Richard, thank you for your straightforward response. I have found your answers to be very helpful and exactly what I needed to know.
    Friday, February 23, 2018 6:44 PM
  • You are welcome.

    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    Friday, February 23, 2018 7:25 PM
    Moderator