locked
Restart Script for two node cluster running Server 2008R2 and PowerShell 2.0 RRS feed

  • Question

  • Hi Scripters,

    I have been tasked with the scripted restarts of a two node cluster, which is proving to be more complicated that I first thought it would be. As far as the procedure goes, here is the script so far (function names say what they do - from PSSessions on a third server):

    1: Test-ConnectivityForBothNodes

    2: Set-SCOMMaintMode

    3: Get-ClusterResourceGroupLists

    4: Get-ClusterHealthCheck

    5: FailOverToAltNode-CurrentNodeGroups

    6: Get-ClusterHealthCheck

    7: Test-GroupListIsEmptyForCurrentNode

    8: Pause-ClusterOnCurrentNode

    9: Restart-CurrentNode

    And so on... the problem I'm having is with step 9 - I'm having the 'cluster restart script' run the 'server restart script' (invoke-command -computername $CurrentNode -filepath etc..) which works fine however the only method I can think of to tell the server has restarted is to create a runonce scheduled task (on start up) that writes a file to c:\temp notifying the cluster restart script that it has restarted... is there a less dodgy way to do this? Running a while loop waiting for a file to be written with an upper limit (via a $count) of 30 minutes just feels like the stupid way of doing it. Any ideas?

    Friday, May 23, 2014 5:29 AM

Answers

  • I've decided to use a while loop that loops until the server no longer replies to pings (or count exceded), then another while loop that continues until the eventlog service starts.

    

    • Marked as answer by Bill_Stewart Wednesday, May 28, 2014 2:13 PM
    Wednesday, May 28, 2014 4:28 AM

All replies

  • Start by upgrading to PowerShell V3. 

    Use Restart-Computer with wait.

    Use a workflow.


    ¯\_(ツ)_/¯

    Friday, May 23, 2014 9:15 AM
  • Hi jrv, thank you for your response.

    Unfortunately due to a situation beyond my control, upgrading anything in our environment beyond PowerShell v2 (other than workstations) is not likely to happen for quite some time.

    Monday, May 26, 2014 5:35 AM
  • I've decided to use a while loop that loops until the server no longer replies to pings (or count exceded), then another while loop that continues until the eventlog service starts.

    

    • Marked as answer by Bill_Stewart Wednesday, May 28, 2014 2:13 PM
    Wednesday, May 28, 2014 4:28 AM