Run a command every X days

This topic contains 4 replies, has 3 voices, and was last updated by  Vern Anderson 3 years, 8 months ago.

  • Author
    Posts
  • #14444

    erik fortin
    Participant

    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?

    Thanks,

  • #14447

    Don Jones
    Keymaster

    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

    Vern Anderson
    Participant

    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.

    http://technet.microsoft.com/en-us/library/bb490866.aspx

    http://support.microsoft.com/kb/313289

    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.

    -VERN

  • #14451

    erik fortin
    Participant

    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

    Vern Anderson
    Participant

    http://www.petri.co.il/download_free_reskit_tools.htm << Download Windows 2000 Resource Kit WinAT is way down towards the end of the list keep scrolling. -VERN

You must be logged in to reply to this topic.