I guess this is easy but is eluding me, I have a working Powershell script that I wish to run as a Scheduled Task in Windows 10, however the script does not execute from the Task scheduler.
Script is hider.ps1
$fs = New-Object -ComObject scripting.filesystemobject
Get-ChildItem "D:\TV Shows\" -force | Where-Object {$_.psiscontainer} | ForEach-Object {
if($fs.getfolder($_.fullname).size -lt 20mb) {$_.attributes = "directory,hidden"}
else{$_.attributes = "directory"}
}
This hides empty folders in a directory
In Task scheduler I have put
Start a program Powershell
Arguments -ExecutionPolicy Bypass –File "F:\\Xaved Files\\Hider ps 1"
Have you set the "start in" directory???
Apparently, since windows server 2012, if a task doesn't have this field informed, the task doesn't run silently.
This worked in my case, and also to this guy
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.