Global Site
Displaying present location in the site.
March 24th, 2026
Machine translation is used partially for this article. See the Japanese version for the original article.
Introduction
We built an HA cluster in a Hyper-V environment, considering how to prevent both-system activation.
In EXPRESSCLUSTER, it is possible to configure network partition resolution (hereinafter called "NP resolution") as a method to prevent both-system activation. However, even if NP resolution is configured, there is still a possibility of both-system activation occurring in the event of failures such as an OS stall or communication interruptions between servers constructing the HA cluster. In such cases, we provide a feature called the forced stop resource to prevent both-system activation.
In this article, we introduce the procedure for building an HA cluster on Hyper-V and configuring an NP resolution resource and a forced stop resource to prevent both-system activation.
Contents
1. Forced Stop Resource in a Hyper-V Environment
Forced stop resources are features that operate when EXPRESSCLUSTER detects a heartbeat timeout between the active server and the standby server. It can forcibly stop the active server from outside the server by using commands provided by the BMC or the virtualization platform.
There are several types of forced stop resources available depending on the environment where the HA cluster is built. However, in EXPRESSCLUSTER X 5.3, "Forced Stop Resource" for Hyper-V environments is not provided. Therefore, we create a forced stop script for Hyper-V and execute it from a custom-type forced stop resource.
For details about forced stop resources, please refer to the following article.
[Reference]
Introducing the Function of EXPRESSCLUSTER: Forced Stop Resource
→ 1. What is a Forced Stop Resource?
2. Procedure for Configuring a Forced Stop Resource
This section describes the procedure for configuring a custom forced stop resource in a Hyper-V environment. In this article, we have already built a mirror disk type HA cluster using a floating IP resource. The configuration diagram of the HA cluster to be constructed is as follows.
This time, I created a user named "Admin001" on the host OS and a user named "Admin002" on the guest OS. The Admin002 user is used to execute the script of the forced stop resource, and its account information must be registered in EXPRESSCLUSTER. Since the same user name and password must be used on each server (guest OS) that makes up the HA cluster, we use the same password for Admin002 on both servers.
■Hyper-V host
-
Host name: hyperv-server
-
IP address: 10.5.1.10
-
User name: Admin001
-
Password: Any
■Hyper-V guests
-
Client
- Display name on Hyper-V Manager: guest-client
- Host name: client
- IP address: 10.5.1.100
- User name / Password: Any
-
Active server
- Display name on Hyper-V Manager: guest-server1
- Host name: server1
- IP address: 10.5.1.120
- User name: Admin002
- Password: Any
-
Standby server
- Display name on Hyper-V Manager: guest-server2
- Host name: server2
- IP address: 10.5.1.121
- User name: Admin002
- Password: Same as the active server
■EXPRESSCLUSTER version
-
EXPRESSCLUSTER X 5.3 for Windows (Internal version: 13.31)
■Failover group (failover)
-
Floating IP resource (fip)
-
IP address: 10.5.1.200
-
Mirror disk resource (md)
-
Cluster partition: E:
-
Data partition: F:
■Monitor resources
-
Floating IP monitor resource (fipw1)
-
Mirror disk monitor resource (mdw1)
-
User mode monitor resource (userw)
After creating the Admin001 user, add it to the following groups:
■Member Of
-
Administrators
-
Hyper-V Administrators
-
Remote Management Users
Since Admin002 executes PowerShell scripts, configure the execution policy as follows.
- 1.On the Hyper-V guests (server1 and server2), start PowerShell with administrator privileges and run the following command:
> Get-ExecutionPolicy -List
- 2.If necessary, change the policy using the following command:
> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
2.1 Configuring Remote Operations for the Hyper-V Host
To execute Hyper-V commands (e.g., Stop-VM) on the Hyper-V host from a guest OS created on Hyper-V, you must remotely use the host’s management functionality. Therefore, configure the host (remote computer) to allow commands to be executed remotely.
- 1.On the Hyper-V host, start PowerShell as Administrator and run:
> Enable-PSRemoting
- 2.On server1 and server2, start PowerShell as Administrator and run the following commands to register the Hyper-V host as a trusted host:
> net start WinRM
> Set-Item WSMan:\localhost\Client\TrustedHosts -Value "<Hyper-V host IP address>"
- 3.Create credentials. Since different users/passwords are used on the Hyper-V host and the Hyper-V guests in this article, you need to pass valid credentials when connecting remotely. In this article, we store the credentials as HyperVCred.xml under C:\Users\Admin002\scripts\forcestop.s:
> (Get-Credential -Message "Enter credentials for Hyper-V") | Export-Clixml -Path "C:\Users\Admin002\scripts\forcestop.s\HyperVCred.xml"
- 4.After creating the credentials, run the following command to verify that Hyper‑V commands can be run on the Hyper-V host from the guest OS created on Hyper-V:
> $Credential = Import-Clixml -Path "C:\Users\Admin002\scripts\forcestop.s\HyperVCred.xml"
> Invoke-Command -ComputerName <Hyper-V host IP address> -Credential $Credential -ScriptBlock {Stop-VM <display name of the active server on Hyper-V Manager> -TurnOff -WhatIf}
If the command succeeds, a message is displayed. Note that when -WhatIf is specified, the VM is not actually stopped.
2.2 Registering an Account
To allow the forced stop script to be executed on the cluster servers, add the script execution user Admin002 to the EXPRESSCLUSTER account settings.
- 1.In Cluster WebUI, open [Cluster Properties] and click [Add] on the [Account] tab.
- 2.Enter Admin002 in [User Name] and the password for Admin002 in [Password], then click [OK].
2.3 Configuring Fencing
To prevent both-system activation, configure an NP resolution resource and a forced stop resource in the fencing settings.
In this article, we use a Ping NP resolution resource and specify the client (10.5.1.100) as the target. The target of a Ping NP resolution resource must be an always-on device other than the cluster servers that can respond to ping via the interconnect LAN registered in the cluster configuration. In actual environments, select an appropriate NP resolution type according to your system configuration.
2.3.1 Configuring NP Resolution
In Cluster WebUI, open [Cluster Properties], select the [Fencing] tab, click [Add], add a Ping NP resolution resource, and set [Target].
2.3.2 Configuring Forced Stop
Next, under [Forced Stop], select [Custom] in [Type], then click [Properties].
[Server List] tab
Select server1 and click [Add]. Configure server2 in the same way.
[Forced Stop] tab
- 1.On the "Forced Stop" tab, calculate and set the maximum waiting time when performing a forced stop as "Forced Stop Timeout". When using the sample script in this article, "Forced Stop Timeout" can be calculated as follows:
Forced Stop Timeout (seconds) > CHECK_LOOP_MAX × SLEEP_WAIT
CHECK_LOOP_MAX: Maximum number of attempts to check for stop
SLEEP_WAIT: Interval to check for stop (seconds)
For example, if CHECK_LOOP_MAX is 10 and SLEEP_WAIT is 3, the timeout must be 31 seconds or longer. In this article, we configure the timeout as 60 seconds with some margin.
The sample script "forcestop.ps1" can be downloaded from the link below. When using the sample, rename the file by replacing “_” with “.” in the file name.
- Note: The sample script is provided for reference only and is not guaranteed to function correctly.
In the variable SERVERS, specify the host name on the guest OS, the display name on Hyper-V Manager, and the IP address of the Hyper-V host. In CHECK_LOOP_MAX and SLEEP_WAIT, set the maximum number of attempts to check for stop attempts and the interval to check for stop.
- 2.Place the created PowerShell script under "C:\Users\Admin002\scripts\forcestop.s".
[Script] tab
- 1.Return to the Cluster WebUI, select "forcestop.bat" on the "Scripts" tab, and click [Edit].
- 2.Enter the following content and specify "C:\Users\Admin002\scripts\forcestop.s" as the location of "forcestop.ps1", then click [OK].
rem ***************************************
rem * forcestop.bat *
rem ***************************************
cd %~dp0
PowerShell "C:\Users\Admin002\scripts\forcestop.s\forcestop.ps1; exit $lastexitcode"
set ret=%ERRORLEVEL%
echo ret: %ret%
exit /b %ret%
- 3.Return to the original screen and select "Admin002" for [Exec User] at the bottom of the "Script" tab. Once you've completed the settings, click [OK] to complete the setup.
2.4 Configuring the Service Startup Delay Time
Specify the service startup delay time of EXPRESSCLUSTER. This prevents both-system activation as a result when the OS restart is performed on the opposite server while the forced stop resource is being executed. It also prevents Forced Stop from being executed during the cluster startup process. In the configuration of this article, specify the service startup delay time as follows:
Service Startup Delay Time >= the forced stop resource's "Forced Stop Timeout" + "Heartbeat Timeout" + "Heartbeat Interval"
The service startup delay time can be set in [Service Startup Delay Time] on the "Timeout" tab of [Cluster Properties].
Additionally, when doing NP resolution using the DISK method or when utilizing shared disks, it is necessary to consider the calculation of the Service Startup Delay Time from a different perspective. For more detailed information, please also refer to the
[2024 Edition] Introduction of the Service Startup Delay Time Setting Feature.
3. Checking the Operation
From the client, connect to the Cluster WebUI. On the status screen, confirm that the failover group (failover) is running on server1, and that [Server], [Group], and [Monitor] are running normally.
Next, create a network partition state and check the operation of the forced stop resource. To create a network partition state, block all communication between the cluster servers by using firewall settings.
As a result:
- (1)The heartbeat between the servers is interrupted. However, since ping communication to the client is still available, each server determines that “a problem occurred on the other server” and attempts to start the failover group.
- (2)On the standby server, the Forced Stop resource operates before starting the failover group.
- (3)After confirming that the active server has stopped, the standby server starts the failover group. Therefore, both-system activation can be prevented.
The alert log output after the standby server detects the active server's downtime is as follows. It can be confirmed that the forced stop resource is executed before the activation of the failover group.
2026/02/05 15:43:10.004 server2 nm 102 The server server1 has been stopped.
2026/02/05 15:43:16.284 server2 forcestop 5201 Forced stop of server server1 has been requested.(custom, none)
2026/02/05 15:43:16.293 server2 rc 1010 The group failover is starting.
2026/02/05 15:43:16.293 server2 rc 1060 Failing over the group failover.
2026/02/05 15:43:19.158 server2 mdadmn 3880 The mirror disk connect of the mirror disk md has been disconnected.
2026/02/05 15:43:21.293 server2 rm 1501 Monitor fipw1 has been started.
2026/02/05 15:43:24.173 server2 rc 1011 The group failover has been started.
2026/02/05 15:43:24.231 server2 rc 1061 The group failover has been failed over.
2026/02/05 15:43:42.347 server2 rm 1504 Monitor mdw1 is in the warning status. (102 : Mirror disk md is not being mirrored.)
After the failover is completed, checking the active server's status via the Hyper-V Manager shows "Off," confirming that the active server is indeed stopped.
Conclusion
In this article, we introduced the procedure for building an HA cluster on Hyper-V using the forced stop resource. By utilizing forced stop resources, you can more reliably prevent both-system activation in the event of a network partition occurring on Hyper-V. Please refer to this article to consider setting up a forced stop resource.
If you consider introducing the configuration described in this article, you can perform a validation with the
trial module of EXPRESSCLUSTER X. Please do not hesitate to contact us if you have any questions.

Larger view







Forced Stop script sample (Windows)




