Appendix

Microsoft Platform Guide

Audience
Public
Source Type
Documentation

CimSession

Many of the following examples will work if run directly on the Hyper-V or SQL Server. When more than one Server is involved, or if the automation is run from a remote management server, some of the PowerShell cmdlets will need to be properly modified to connect to the correct endpoint. One way to do that is to create a CIMSession and then connect to it to perform operations such as changing a disk or Cluster Resource state. See for details on creating a CIM Session. Many of the PowerShell cmdlets, such as Set-Disk, referenced below have a -CimSession switch to enable the connection to a remote session.

CSV Online & Offline

In the above image, a CSV is about to be brought offline in Failover Cluster Manager. An offline Cluster Disk Resource can be brought online with "Bring Online" after right-clicking the disk in Failover Cluster Manager.

Stop-ClusterResource -Name "Cluster Disk 5"

Start-ClusterResource -Name "Cluster Disk 5"

In the above code block, the same CSV is about to be brought offline or online in PowerShell.

VM Online & Offline

In the above image, the VM, Exch02 was just Shut Down, by right-clicking it, and selecting Shut Down in Failover Cluster Manager. It can be started, by right-clicking it, and selecting Start in Failover Cluster Manager.

Stop-ClusterResource -Name "Virtual Machine Exch02"

Start-ClusterResource -Name "Virtual Machine Exch02"

In the above code block, the VM Exch02 can be stopped or started in PowerShell. Ensure that the Failover Cluster Module for Windows PowerShell is installed.

Physical Disk Online & Offline

A physical disk that is not a cluster disk resource can be brought online or offline in Disk Management, or PowerShell. A Cluster Disk Resource or CSV does not require this step as the act of taking the cluster resource online or offline will also change the state of the disk.

In the above image, when the disk is right-clicked, it can be brought online, or offline in Disk Management.

Set-Disk -Number 6 -IsOffline $true

Set-Disk -Number 6 -IsOffline $false

In the above code block, disk number 6 is brought online or offline with PowerShell.

SQL Database Online & Offline

In the above image, using SQL Server Management Studio, the database 'dbprod' is above to be taken offline. An offline database can be brought online, by right clicking the database, selecting Tasks, and then selecting Bring Online.

Invoke-Sqlcmd -InputFile c:\ps\repmount.sql -QueryTimeout 3600 -ServerInstance 'ch2-barkz-03\qstance'

Invoke-Sqlcmd -InputFile c:\ps\repdismount.sql -QueryTimeout 3600 -ServerInstance 'ch2-barkz-03\qstance'

In the above code block, a database is brought online or taken offline using the SQL Server PowerShell Module.

Pod Demotion

Before demoting a Pod, it is important that all Virtual Machines, or other Cluster Roles, and SQL Databases, or other applications, are shut down and offline. Virtual Machines will not gracefully shut down and SQL Databases will be marked suspect if the underlying storage is ungracefully forced into read-only mode.

In the above image, a disk that is part of a demoted Pod is now Read Only. It is recommended to offline all disks contained in a Pod before demoting the Pod.

In the above image, the dbprod-dr database is marked (Suspect) because it was not offline before the Pod was demoted.

In the above image, Pod qpodprod is about to be demoted. Be sure that all disks and applications are offline.

Everpure PowerShell SDK 1.17 (PureStoragePowerShellSDK)

New-PfaCLICommand -EndPoint 10.21.201.57 -UserName pureuser -Password $57 -CommandText "purepod demote qpodprod --quiesce"

In the above code block, using v1.17 of the Everpure PowerShell SDK, the command to demote the Pod qpodprod is issued.

Everpure PowerShell SDK 2.2 (purestoragepowershellsdk2)

Update-Pfa2Pod -Array $pfa57 -Name qpodprod -RequestedPromotionState "demoted" -Quiesce $true

In the above code block, using v2.2 of the Everpure PowerShell SDK, the command to demote the Pod qpodprod is issued.

Pod Promotion

In the above image, Pod qpoddr is about to be promoted.

Everpure PowerShell SDK 1.17 (PureStoragePowerShellSDK)

New-PfaCLICommand -EndPoint 10.21.201.130 -UserName pureuser -Password $130 -CommandText "purepod promote qpoddr"

In the above code block, using v1.17 of the Everpure PowerShell SDK, the command to promote the Pod qpoddr is issued.

Everpure PowerShell SDK 2.2 (purestoragepowershellsdk2)

Update-Pfa2Pod -Array $pfa130 -Name qpodprod -RequestedPromotionState "promoted"

In the above code block, using v2.2 of the Everpure PowerShell SDK, the command to promote the Pod qpoddr is issued.