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
Post a Comment