Novice Assistance to Automate Renaming of App_Offline.htm

Adam Gilbert 1 Reputation point
2021-10-05T08:38:39.427+00:00

Hi Folks,

I have a IIS server hosting multiple websites that I need to take offline nightly.

I have commands that renames the files if I run PowerShell in the root web directory. e.g. D:\MyWebSites

I'd like to automate this to run nightly.

  1. rename App_Oflline-Template.htm to App_Offline.htm @ 22:30
  2. Rename App_Offline.HTM to pp_Oflline-Template.htm @ 23:30

137712-image.png

Cheers,
Adam

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,449 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Rich Matheisen 45,671 Reputation points
    2021-10-06T18:21:43.563+00:00

    You can find many answers to this question by using a search engine with "run powershell as scheduled job" or "run powershell as scheduled task".

    0 comments No comments

  2. Limitless Technology 39,506 Reputation points
    2021-10-06T18:35:39.867+00:00

    Hello @Adam Gilbert

    You can put your PowerShell command in .ps1 script and schedule it using Task scheduler with Local System account.

    -------------

    --If the reply is helpful, please Upvote and Accept as answer--

    0 comments No comments

  3. Anthony Axlen 1 Reputation point
    2021-10-07T10:51:42.397+00:00

    Hello,

    please take a look to both cmdlets:

    • New-JobTrigger
    • Register-ScheduledJob

    Use help to get examples and prepare the script basing on documentations.

    Thank you.

    0 comments No comments