Posted On September 4, 2019

PowerShell: List All IPs Used by Cluster

kimconnect 2 comments
blog.KimConnect.com >> Codes >> PowerShell: List All IPs Used by Cluster

Snippet:

# Obtain IPs of resources in cluster
function getResourceIPs {
$resourceIPs=Get-Cluster | Get-ClusterResource | ?{$_.ResourceType -like "IP Address"}
foreach ($resource in $resourceIPs) {
$resource | select OwnerGroup,
@{Name="Address"; Expression={$_ | Get-ClusterParameter -Name Address | select -ExpandProperty Value}},
@{Name="SubnetMask"; Expression={$_ | Get-ClusterParameter -Name SubnetMask | select -ExpandProperty Value}}
}
}

Sample output:

OwnerGroup      Address       SubnetMask
---------- ------- ----------
Cluster Group 192.168.500.112 255.255.255.0
COCOSHOME40-41-n 192.168.500.10 255.255.255.0
COCOECAPPS01-n 192.168.500.11 255.255.255.0
COCOECDIST01-n 192.168.500.12 255.255.255.0
COCOECELRNFS01-n 192.168.500.13 255.255.255.0
COCOECIMAGES01-n 192.168.500.14 255.255.255.0
COCOECLMSFS01-n 192.168.500.16 255.255.255.0
COCOECSHARE01-n 192.168.500.17 255.255.255.0
COCOECZANGLEBK-n 192.168.500.18 255.255.255.0
COCOFSHOME01-n 192.168.500.19 255.255.255.0
COCOFSSHARE01-n 192.168.500.20 255.255.255.0
COCOSHOME01-n 192.168.500.3 255.255.255.0
COCOSHOME30-31-n 192.168.500.5 255.255.255.0
COCOSHOME32-33-n 192.168.500.6 255.255.255.0
COCOSHOME34-35-n 192.168.500.7 255.255.255.0
COCOSHOME36-37-n 192.168.500.8 255.255.255.0
COCOSHOME38-39-n 192.168.500.9 255.255.255.0

2 thoughts on “PowerShell: List All IPs Used by Cluster”

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

PowerShell: Get SQL Server Backup Statuses

$computername='sql01' function getSqlBackupInfo ($sqlInstanceName=$env:computername, $dbName){ [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") $location=if($sqlInstanceName.Contains("`\")){ "SQLSERVER:\SQL\$sqlInstanceName\Databases" }else{ "SQLSERVER:\SQL\$sqlInstanceName\DEFAULT\Databases" } function getPacificTime($time){ if($time){ [System.TimeZoneInfo]::ConvertTimeBySystemTimeZoneId($time,'Pacific…

PowerShell: Update Accounts Basing on CSV File

# adAccountsCsvUpdate.ps1 $originalCsvFile='C:\Users.csv' $newCsvFile='C:\Users-finalized.csv' $newEmailSuffix='@kimconnect.net' $newOu='CN=Users,DC=kimconnect,DC=com' function adAccountsCsvUpdate{ param( $originalCsvFile, $newCsvFile, $newEmailSuffix, $newOu ) function…

Python: RegEx Module

It's been opinionated that a string operation is made complete only with RegEx. Hence, Python…