Automate Reboot based on a condition

Welcome Forums General PowerShell Q&A Automate Reboot based on a condition

This topic contains 1 reply, has 2 voices, and was last updated by

1 year, 4 months ago.

  • Author
  • #81811

    Points: 12
    Rank: Member

    Howdy Pals.
    I am stuck on the below

    Automation Approach : The plan is to automate a server Reboot activities using simple PS script configuring on all the sites machines as per the site agreed timelines on monthly basis, only important criteria is Script need to check/verify/read the LAC/E acquisition status in LACE computer from Recover.log file under C ->Empower -> InstrumentServer before firing reboot action .

    If Log status is like 2 lines reboot need to proceed, else defer the reboot.
    Begin sweep
    End Sweep

    these 2 lines appear on the recover.log file and this file keeps on updating. So when we have to reboot as per the scheduled time, we need to check in the complete file these 2 lines. If these appear then reboot else prompt "Cannot be rebooted as work is being carried upon."

    Any help on this will be highly appreciated

    If log Status is 3 lines or different reboot action need to halt.

  • #81877

    Points: 706
    Helping Hand
    Rank: Major Contributor

    I have no idea wha this 'LAC/E acquisition status' is, and it may not really matters.

    If it write to a text log, you can read it with PowerShell (using the Get-Content cmdlet) and filter for the strings you detail here.

    As for automation...
    Create a scheduled task to check for the state you are defining.
    In your script after the check contents returns true, run the Restart-Computer cmdlet.

The topic ‘Automate Reboot based on a condition’ is closed to new replies.

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