Home Forums Programming Powershell Can't get powershell script to run as Agent Job - runs from CMD RE: Can't get powershell script to run as Agent Job - runs from CMD

  • Does the credentials that the SQL Server Agent job run under have permission to access the UNC location? You can test this by adding the DIR part of line 3 as its own line before line 3 to see if it moves the error to line 4.

    Also, you could output the values by using a variable to hold the value of ($_.basename + (get-date -format '_MMddyyyy') + $_.extension) and logging it before using it as a parameter to the Rename-Item call.

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!