How to fence a Host using a Power Shell Script in Red Hat Virtualization 2.2 ?

Solution Verified - Updated -


  • Red Hat Enterprise Virtualization 2.2
  • Windows Powershell


  • How to fence hosts using Power Shell Scripts?


  • To fence a host the host status must be first updated to Maintenance Mode.

  • To update a hosts status to maintenance,use the Suspend-Host PS command and set the status to Maintenance.

  • But note that use the shell's tab completion to ensure we get the correct value.

  • Check the Id of host, please execute the following command first:

PS C:\> Select-Host
  • Suspend the host using:
PS C:\> Suspend-Host -HostId <Id-of-host>
  • After the Host in in Maintenance Mode execute the below command to fence it.
 Fence-Host -HostId  $HOST_N.HostId -Action Stop

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.