remote PowerShell script gets 77777 error when removing files - VisualCron - Forum

Community forum

borisMN
2019-01-18T15:23:01Z
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!
Support
2019-01-18T15:35:51Z
It seems like you sent the standard output. What is interesting is the standard error output which contains the actual error.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
borisMN
2019-01-18T15:56:51Z
This is what standard error has:
ExecuteProcess("C:\Program Files (x86)\VisualCron\\PowerShell\TaskPowerShell.exe" 53482)->Error opening Runspace: UseCurrentThread(Specified method is not supported.)
borisMN
2019-01-18T19:05:45Z
My issue got resolved. "Remove-Item -Force" fails when run via remote PS but "Remove-Item" works. Not sure why. Can somebody explain?
Scroll to Top