Skip to content

Instantly share code, notes, and snippets.

@codyde
Last active February 28, 2018 18:52
Show Gist options
  • Save codyde/fb9900fc49919c9a73573fea0a3986ca to your computer and use it in GitHub Desktop.
Save codyde/fb9900fc49919c9a73573fea0a3986ca to your computer and use it in GitHub Desktop.
Wifi SSID: 500CM-CONF
Password: botwtmpr
vCenter Server Name: vcsa01.corp.local
vCenter IP: 52.36.60.129
Username: Student[01-60]
Password: Password[01-60]
Lab 1:
Install-Module VMware.PowerCLI -Scope CurrentUser
Lab 1.1:
Get-ExecutionPolicy
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
Lab 2:
Get-PowerCLIConfiguration
Lab 3:
Get-Help Connect-VIServer
Lab 4:
Connect-VIServer -Server vcsa01.corp.local -Protocol https
Lab 5:
Get-Datacenter
Lab 6:
Get-Cluster
Lab 7:
Get-VMHost
Lab 8:
Get-Datastore
Lab 9:
Get-Datacenter | Select-Object *
Lab 10:
Get-Cluster | Select-Object *
Lab 11:
Get-VMHost | Select-Object *
Lab 12:
Get-Datastore | Select-Object *
Lab 13:
Get-Datacenter | Get-View
$dc = Get-Datacenter
$dc.ExtensionData
Lab 14:
Get-Cluster | Get-View
$cluster = Get-Cluster
$cluster.ExtensionData
Lab 15:
Get-VMHost | Get-Random | Get-View
$vmh = Get-VMHost | Get-Random
$vmh.ExtensionData
Lab 16:
Get-Datastore | Get-Random | Get-View
$ds = Get-Datastore | Get-Random
$ds.ExtensionData
Lab 17:
New-Datacenter -Name Student[0-50]
Lab 18:
Get-Folder
Get-Folder -Type Datacenter
$folder = Get-Folder -Type Datacenter
Lab 19:
New-Datacenter -Name StudentDC[1-50] -Location $folder
Lab 20:
Get-Help New-Cluster
Get-Help New-Cluster -Examples
New-Cluster -Name StudentCluster[1-51] -Location (Get-Datacenter -Name Student[1-50]) -HAEnabled $true -DrsEnabled $true
Lab 21:
Get-Cluster -Name StudentCluster[1-50] | Select-Object Name,DrsMode
Set-Cluster -Name StudentCluster[1-50] -DrsMode FullyAutomated
Lab 22:
Add-VMHost -Location StudentDC[1-50] -Name esx[1-50].corp.local -User root -Password "VMware1!"
Lab 23:
Move-VMHost -VMHost esx[1-50].corp.local -Destination StudentCluster[1-50]
Lab 24:
New-Datastore # VMFS Mount
Lab 25:
$vm = Get-VM -Location (Get-VMHost -Name esx[1-50].corp.local)
$vm
$vm | Select-Object *
$vm.ExtensionData
Lab 26:
New-ResourcePool -Name StudentRP[1-50] -Location (Get-Cluster -Name StudentCluster[1-50])
Lab 27:
Move-VM -VM $vm -Destination (Get-ResourcePool -Name StudentRP[1-50])
Lab 28:
Get-Folder -Type VM
New-Folder -Name ProdWorkloads[1-50] -Location (Get-Datacenter -Name StudentDC[1-50])
$prodFolder = Get-Folder -Name ProdWorkloads[1-50]
New-Folder -Name Web[1-50] -Location $prodFolder
$prodFolder | New-Folder -Name DB[1-50]
Lab 29:
$vm | Move-VM -Destination $prodFolder
Lab 30:
$myCluster = Get-Cluster -Name StudentCluster[1-50]
$myRP = Get-ResourcePool -Name StudentRP[1-50]
$myDS = Get-Datastore vsanDatastore
New-VM -Name Student[1-50] -ResourcePool $myRP -Datastore $myDS -DiskGB 20 -MemoryGB 4 -NumCpu 2 -GuestId windows9Server64Guest
Lab 31:
$cloneVM = New-VM -VM $vm -Name Clone[1-50] -ResourcePool $myRP -Datastore $myDS -Location $prodFolder
Lab 32:
Get-VM -Location $myCluster
Get-VM -Location $myCluster | Select-Object Name,ResourcePool,Folder
Lab 33:
Get-VM | Where-Object {$_.PowerState -eq 'PoweredOn'} | Select-Object Name,DrsAutomationLevel
Lab 34:
Get-VM | Get-HardDisk
Get-VM | Get-HardDisk | Set-HardDisk -CapacityGB 40
Lab 35:
$cloneVM | Remove-VM
Lab 36:
$cloneVM # Get pointer to the VMX
$vmx = $cloneVM.ExtensionData
New-VM -DiskPath $vmx
Lab 37:
Get-VM -Name Clone[1-50] | Remove-VM -DeletePermanently -Confirm:$false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment