Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $vcenterUser = administrator@vsphere.local
- $Password = VMware1!
- $esxiUser = root
- $VC = "vc01.vclass.local"
- $esxi1 = "esxi01.vclass.local"
- $esxi2 = "esxi02.vclass.local"
- $vmfs = "VMFS01"
- $nfs = "NFS01"
- $Datacenter = "Training"
- $Cluster = "HA Cluster"
- $vds = "MainDSwitch"
- $vccred =
- $esxcred =
- $localpath = "C:\reports"
- $allvm = Get-VM
- $allesx = Get-VMHost
- #Connects to vCenter Server
- Connect-VIServer -Server $VC -Username $vcenterUser -Password $Password
- #Removes all VM's from inventory.
- $allvm | where {$_.PowerState -eq "PoweredOn"} | Stop-VM
- $allvm | Remove-VM -runasync
- #Delete IP storage VMkernel adapter
- Get-VDSwitch | Get-VMHostNetworkAdapter | Remove-VMHostNetworkAdapter
- #Removes all Physical adapters from VDSwitch
- $allesx | Get-VMHostNetworkAdapter -Physical -Name vmnic3 | Remove-VDSwitchPhysicalNetworkAdapter
- #Remove VDSwitch from setup.
- Remove-VDSwitch -Name $vds
- #Delete the VMFS datastores that are not local
- Get-Datastore | where {$_.Name -match "DC0*"} | Remove-Datastore
- #Removes NFS datastore
- Get-Datastore | where {$_.type -eq "NFS"} | Remove-Datastore
- #Removes all hosts from the vCenter
- $allesx | Remove-VMHost
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement