Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


mreigler
2011-07-08T14:49:10Z
I'm trying to run the following powershell code as a powershell task to find empty folders in a directory structure. It works fine when I run it from the powershell command window, but nothing seems to happen when running it from VC. I'm using the same credentials in both cases.

(Get-ChildItem \\Server\Fileshare\Backups -recurse | Where-Object {$_.PSIsContainer -eq $True}) |
Where-Object {$_.GetFiles().Count -eq 0} | Select-Object FullName


After looking on the forum, I tried: Write-Output "Hello World" as the powershell code instead and it worked fine so I don't think it's that VC can't run the powershell code, but I'm not getting any kind of error. The task comes back with no output. Is there anything I can check in VC to figure out what might be going wrong?


The ultimate goal will be to delete all the empty folders like:


(Get-ChildItem \\Server\Fileshare\Backups -recurse | Where-Object {$_.PSIsContainer -eq $True}) |
Where-Object {$_.GetFiles().Count -eq 0} | Remove-Item
Sponsor
Forum information
Support
2011-07-08T17:18:27Z
The problem is probably that you are trying to access a network share without any Credentials. Try adding and selecting a Credential that matches the remote server share.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top