Run a command every X days

Welcome Forums General PowerShell Q&A Run a command every X days

This topic contains 4 replies, has 3 voices, and was last updated by

4 years, 11 months ago.

  • Author
  • #14444

    Points: 0
    Rank: Member

    Hi All-

    How would I run "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8" every 30 days? I guess we have an issue with scheduled tasks in our environment so I would need to include the date range in the script itself. Any ideas?


  • #14447

    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    You have an "issue" with scheduled tasks, or a "problem" with them?

    I mean, I'd just do this as a scheduled task. PowerShell doesn't have any way of waking up and running a script on its own, it would just use a scheduled task for that.

  • #14449

    Points: 28
    Rank: Member

    Yea the Windows "AT" scheduler used to have a run every X days but Starting with Server 2012 the at command is no longer there. The syntax was pretty tough but they had a GUI in the Windows 2000 Resource Kit.

    Showing my age there. =)

    However if you're running Windows 8 or Server 2012 you are out of luck Microsoft finally did away with it. Don's right schedtasks is your best way but I don't know of a way to make it do it every 5 days regardless of date or day of the month. But if your 2008 or older you're in business.


  • #14451

    Points: 0
    Rank: Member

    Thank all. I guess my issue is that I need to delete the temp internet files on a schedule. I cant seem to do this with any other command than "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8". I run

    $dir = "C:\Users\....\AppData\Local\Microsoft\Windows\Temporary Internet Files"

    Get-ChildItem $dir -Recurse -Force

    But I only see to see the content.ie5 folder but not the files. With that said I cant leverage .lastwrite time in order to delete the file if its 30 days old.

    Any ideas as to why the command above does not show me the files and only the content.ie5 folder?

  • #14452

    Points: 28
    Rank: Member << Download Windows 2000 Resource Kit WinAT is way down towards the end of the list keep scrolling. -VERN

The topic ‘Run a command every X days’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort