0

I have a basic powershell script that runs great in its local directories. I am very new to powershell so this may be a basic question. The csv file really will sit in the following directory \ADdata.acdsd.internal\F\Exports\Google\Student Accounts. How do I reference this directory in my code below. Do I need to replace the $list command with some other command.

     $list = Import-Csv studentaccounts.csv
     foreach ($entry in $list)
     {
     C:\gam-rcsdkids\gam.exe create user $($entry.newuser) firstname $($entry.firstname) lastname                              $($entry.lastname) password $($entry.password)
      }
1
  • PowerShell supports UNC paths so if its just the CSV then this should work: $list = Import-Csv "\\ADdata.acdsd.internal\F\Exports\Google\Student Accounts\studentaccounts.csv" assuming people have the proper permissions to this share / directory Commented Dec 11, 2014 at 19:18

1 Answer 1

1

PowerShell supports UNC paths without problems, so first of all try to invoke:

cd \\ADdata.acdsd.internal\F\Exports\Google\Student Accounts\

If above command works you should call below line to import CSV:

$list = Import-Csv \ADdata.acdsd.internal\F\Exports\Google\Student Accounts\

Now why I started with cd: because if there is a problem with accessing share you will see better in cd command (there won't be errors about csv file)

Sign up to request clarification or add additional context in comments.

1 Comment

I have tested this myself and it works perfectly as long as you have read access.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.