Skip to content
This repository was archived by the owner on Dec 6, 2023. It is now read-only.

Create Update-ClusterConfig.ps1 #338

Merged
merged 1 commit into from
Apr 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions azure-migrate/SQL Migration/Update-ClusterConfig.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<#
.PERMISSIONS REQUIRED
Cluster administrator
.USE CASES
Run this scripts on any cluster node to update the cluster IPs to the new configuration from the config file path.
.Parameters
$configFilePath - path to the configuration file previously created from the cluster

.NOTES
AUTHOR: Microsoft Services
AUTHOR DATE: 2021-04-23
.CHANGE LOG
#>
param(
[Parameter(Mandatory=$true)]
[string]
$configFilePath)
$resourcelist=Import-Csv -Path $configFilePath

import-module Failoverclusters
$Networks=Get-ClusterNetwork
If ($Networks.Count -gt 1)
{
$ClusterNetworkName=($Networks | out-gridview -passthru).Name
}
else
{
$ClusterNetworkName = $Networks.Name
}
foreach ($resource in $resourcelist)
{
"Configuring $($resource.ResourceName) with $($resource.NewIP) IP : $($resource.ProbePort) on network $ClusterNetworkName."
Get-ClusterResource $resource.ResourceName | stop-ClusterResource
Get-ClusterResource $resource.ResourceName | Set-ClusterParameter -Multiple @{"Address"="$($resource.NewIP)";"ProbePort"=$resource.ProbePort;"SubnetMask"="255.255.255.255";"Network"="$ClusterNetworkName";"EnableDhcp"=0}
Get-ClusterResource $resource.ResourceName | stop-ClusterResource
Get-ClusterResource $resource.ResourceName | Set-ClusterParameter -Multiple @{"Address"="$($resource.NewIP)";"ProbePort"=$resource.ProbePort;"SubnetMask"="255.255.255.255";"Network"="$ClusterNetworkName";"EnableDhcp"=0}
Get-ClusterResource $resource.ResourceName | start-ClusterResource
}