Hi,
I have a SQL Agent job that has one step - a Powershell script. To simplify things, the script now has only one line:
Remove-Item \\server\Test\*
Script is being executed as a domain admin account (just to troubleshoot), and I get the following error:
Executed as user: DOMAIN\admin. A job step received an error at line 1 in a PowerShell script. The corresponding line is 'Remove-Item "\\server\Test\*"'. Correct the script and reschedule the job. The error information returned by PowerShell is: 'Cannot retrieve the dynamic parameters for the cmdlet. Invalid Path: '\\server\Test'. '. Process Exit Code -1. The step failed.
When I run Powershell using runas as DOMAIN\admin, the command works. What am I doing wrong? Looks like the problem is with accessing UNC shares, the scripts works fine when using local paths. Any suggestions greatly appreciated :)
Thanks!
Best regards