Hi,
I have a PowerShell task that should remove old files. The task fails with error 77777. The log does not have enough details to understand why it failed.
The task is configured to use remote with auth mechanism default. It's using the credentials for the account that has admin rights (I don't use local login/load profile). The command is below. The task runs successfully if I don't have Remove-Item and I can see the files that should be removed. I am not sure what the issue is with the file removal since the account has admin rights. I can run the same command locally on the server. Can you tell me what can be causing the issue? How can I get the output? Also, can I have two identical credentials with the only difference that one loads profile and the other one does not. It seems like the name of the credential account is unique and I cannot have two credentials using the same user name.
The command:
Get-ChildItem 'C:\someFolder\' -Recurse -Include *.zip -File | Where-Object {$_.LastWriteTime -lt (Get-Date).AddDays(-$BackupAgeDays)} | Remove-Item -Force
Here's the log:
09:08:07: CreateTaskServiceChannel
09:08:08: CreateTaskServiceChannel->Complete
09:08:08: pts.CreateService(UniqueAddressId)
09:08:08: pts.CreateService(UniqueAddressId)->Complete
09:08:07: Server->Execute path: C:\Program Files (x86)\VisualCron\\PowerShell\TaskPowerShell.exe
09:08:07: Server->Executing Task process
09:08:08: Server->Sending Task information
09:08:08: Server->Task information sent
09:08:08: Server->Executing Task process exited with exit code: 0
09:08:08: Server->Waiting for completion and result
09:08:08: Server->Task result received, success: False
Thanks!