John French
John French

Reputation: 47

Calling file from remote directory using powershell

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)
      }

Upvotes: 0

Views: 2022

Answers (1)

Piotr Stapp
Piotr Stapp

Reputation: 19828

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)

Upvotes: 1

Related Questions