PowerShell Path Parameter Invoke-Command (UnauthorizedAccessException) -


when running simple script receiving error message:

+ categoryinfo : openerror: (:) [import-csv], unauthorizedaccessexception

+ fullyqualifiederrorid : fileopenfailure,microsoft.powershell.commands.importcsvcommand


param( [string]$path, [string]$credential   )  invoke-command –cn dc –credential $credential -argumentlist $path –scriptblock ` {import-csv -path $args[0] | select-object –property ` @{name='identity';expression={$_.username}},@{name='fax';expression={$_.'fax number'}} ` | foreach{set-aduser -identity $_.identity -fax $_.fax -confirm:$false}} 

any idea why may happening? have correct permissions the path using.

i found issue , because not including csv file in path. pointing c:\files\csv instead of c:\files\csv\fax-users.csv.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -