Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Powershell scheduled task

$
0
0

Guys

I guess this is easy but is eluding me, I have a working scrip 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"

 

Any help gratefully accepted

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles