Advertisement
Guest User

Untitled

a guest
May 11th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. $vcenterUser = administrator@vsphere.local
  2. $Password = VMware1!
  3. $esxiUser = root
  4. $VC = "vc01.vclass.local"
  5. $esxi1 = "esxi01.vclass.local"
  6. $esxi2 = "esxi02.vclass.local"
  7. $vmfs = "VMFS01"
  8. $nfs = "NFS01"
  9. $Datacenter = "Training"
  10. $Cluster = "HA Cluster"
  11. $vds = "MainDSwitch"
  12. $vccred =
  13. $esxcred =
  14. $localpath = "C:\reports"
  15. $allvm = Get-VM
  16. $allesx = Get-VMHost
  17.  
  18. #Connects to vCenter Server
  19. Connect-VIServer -Server $VC -Username $vcenterUser -Password $Password
  20.  
  21. #Removes all VM's from inventory.
  22. $allvm | where {$_.PowerState -eq "PoweredOn"} | Stop-VM
  23. $allvm | Remove-VM -runasync
  24.  
  25. #Delete IP storage VMkernel adapter
  26. Get-VDSwitch | Get-VMHostNetworkAdapter | Remove-VMHostNetworkAdapter
  27.  
  28. #Removes all Physical adapters from VDSwitch
  29. $allesx | Get-VMHostNetworkAdapter -Physical -Name vmnic3 | Remove-VDSwitchPhysicalNetworkAdapter
  30.  
  31. #Remove VDSwitch from setup.
  32. Remove-VDSwitch -Name $vds
  33.  
  34. #Delete the VMFS datastores that are not local
  35. Get-Datastore | where {$_.Name -match "DC0*"} | Remove-Datastore
  36.  
  37. #Removes NFS datastore
  38. Get-Datastore | where {$_.type -eq "NFS"} | Remove-Datastore
  39.  
  40. #Removes all hosts from the vCenter
  41. $allesx | Remove-VMHost
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement