update
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
$VMHostNames = @"
|
||||
itdbisvm-gen05.nd.gov
|
||||
"@
|
||||
$VMHostNames = ConvertTo-Array -MultiLineString $VMHostNames
|
||||
|
||||
# set maintenance and disable alarms
|
||||
Get-VMHost -Name $VMHostNames | Set-VMHost -State "Maintenance" -RunAsync
|
||||
ForEach ($VMHostName in $VMHostNames) {
|
||||
$GetVMHost = Get-VMHost -Name $VMHostname
|
||||
$VIServer = $GetVMHost.Uid.Split('@')[1].Split(':')[0]
|
||||
$alarmMgr = Get-View AlarmManager -Server $VIServer
|
||||
$alarmEnabled = $GetVMHost.ExtensionData.AlarmActionsEnabled
|
||||
if ($alarmEnabled -eq $true) {
|
||||
$alarmMgr.EnableAlarmActions($GetVMHost.ExtensionData.MoRef, $false)
|
||||
}
|
||||
}
|
||||
|
||||
#Create Management Switch And Move Adapter
|
||||
ForEach ($VMHostName in $VMHostNames) {
|
||||
$vmnic0 = Get-VMHostNetworkAdapter -VMHost $VMHostName -Name "vmnic0"
|
||||
$vmk0 = Get-VMHost $VMHostName | Get-VMHostNetworkAdapter -Name vmk0
|
||||
New-VirtualSwitch -VMHost $VMHostName -Name "sSwitch-MGMT"
|
||||
Get-VirtualSwitch -VMHost $VMHostName -Name "sSwitch-MGMT" | New-VirtualPortGroup -Name "sPG-MGMT"
|
||||
$MGMTPG = Get-VirtualSwitch -VMHost $VMHostName -Name "sSwitch-MGMT" | Get-VirtualPortGroup -Name "sPG-MGMT"
|
||||
$MGMTSwitch = Get-VirtualSwitch -VMHost $VMHostName -Name "sSwitch-MGMT"
|
||||
Add-VirtualSwitchPhysicalNetworkAdapter -VMHostPhysicalNic $vmnic0 -VirtualSwitch $MGMTSwitch -Confirm:$false
|
||||
Add-VirtualSwitchPhysicalNetworkAdapter -VMHostPhysicalNic $vmnic0 -VirtualSwitch $MGMTSwitch -VirtualNicPortgroup $MGMTPG -VMHostVirtualNic $vmk0 -Confirm:$false
|
||||
}
|
||||
|
||||
# remove vmk1 and vmk2
|
||||
ForEach ($VMHostName in $VMHostNames) {
|
||||
Get-VMHost -Name $VMHostName | Get-VMHostNetworkAdapter -Name vmk1, vmk2 | Remove-VMHostNetworkAdapter -Confirm:$false
|
||||
}
|
||||
|
||||
# remove distributed switches
|
||||
$BackupVDSwitch = Get-VDSwitch -Name 'dvSwitch-SDC-Backup'
|
||||
$DataVDSwitch = Get-VDSwitch -Name 'dvSwitch-SDC-Data-Server'
|
||||
$vMotionVDSwitch = Get-VDSwitch -Name 'dvSwitch-SDC-VMotion'
|
||||
$MgmtVDSwitch = Get-VDSwitch -Name 'dvSwitch-SDC-MGMT'
|
||||
ForEach ($VMHostName in $VMHostNames) {
|
||||
Remove-VDSwitchVMHost -VDSwitch $BackupVDSwitch -VMHost $VMHostName -Confirm:$false
|
||||
Remove-VDSwitchVMHost -VDSwitch $DataVDSwitch -VMHost $VMHostName -Confirm:$false
|
||||
Remove-VDSwitchVMHost -VDSwitch $vMotionVDSwitch -VMHost $VMHostName -Confirm:$false
|
||||
Remove-VDSwitchVMHost -VDSwitch $MgmtVDSwitch -VMHost $VMHostName -Confirm:$false
|
||||
}
|
||||
# remove from inventory
|
||||
ForEach ($VMHostName in $VMHostNames) {
|
||||
Get-VMHost -Name $VMHostName | Remove-VMHost -Confirm:$false
|
||||
}
|
||||
|
||||
# scrub DNS
|
||||
# scrub Passwordstate
|
||||
# scrub Active Directory
|
||||
|
||||
# send storage team request to remove SAN
|
||||
# send cohesity team request to remove host mappings for backup vmkernels
|
||||
Reference in New Issue
Block a user