Powershell to delete the Windows Failover Cluster IP

I have some knowledge in the Powershell as SQL DBA, but not in depth. We moved to the SQL to different subnets and we need to add the new subnet , assign new IP and delete the old IP address. I got some code from the internet for adding new IP resource , and I am looking for the code to delete the IP address. Could you please help me in deleting the cluster IP address, which is in offline state. 

Here is my code to add the new IP address:

$conn_server = $env:computername
$varClusterNetworkInterface= Get-ClusterNetworkInterface | Where-Object { $_.Node -eq "$conn_server" } ## to get the network name of the current host
$newClusterIPAddress = '<<New_IP_Address>>' ## this is the input for new IP address, this is the input from my script
## adding new cluster resource along with IP Address
$varClusterResource = "Cluster IP Address Cloud " + $newClusterIPAddress ## to name the resource
$varClusterParam = Get-ClusterNetwork -name $varClusterNetworkInterface.network.name

Add-ClusterResource -Name $varClusterResource -Group 'Cluster Group' -ResourceType 'IP Address'
Get-ClusterResource -Name $varClusterResource | Set-ClusterParameter -Multiple @{ Address = $newClusterIPAddress;
Network = $varClusterParam.Name;
SubnetMask = $varClusterParam.AddressMask; }

$varClusterAlias=(Get-ClusterResource | Get-ClusterParameter | Where-Object {$_.Name -eq "Name"})[0].ClusterObject.Name
$clusterGroup = (Get-ClusterResource $varClusterAlias).OwnerGroup |select -ExpandProperty "Name"
$varDepdency = (Get-ClusterResourceDependency -Resource $varClusterAlias).DependencyExpression
$varDepdencyToSet="${varDepdency} or [${varClusterResource}]"

Set-ClusterResourceDependency -Resource $varClusterAlias -Dependency $varDepdencyToSet;

Can someone help me to deleting the highlighted IP address.. I am able to manage which IP needs to be deleted. Do we need to remove from cluster resource dependency?? 

Parents Reply Children
No Data