PowerCLI Code Capture

For those of us still relatively new to PowerCLI and working towards automating as many robotic tasks as possible, there is a handy tool in vCenter called Code Capture. This has been available since vCenter Server Appliance (VCSA) 6.7U2 in the developer centre so its not exactly new but a lot of people don’t realise

 568 total views,  1 views today

Create unique host profiles for each host in a cluster

The below command will create a host profile for each host found in $global:CLUChoice, The profile will be named “VMhostName-Profile” and will include the date the profile was taken in the description $global:DCChoice – Datacenter$global:CLUChoice – Cluster Get-Datacenter $global:DCChoice | Get-Cluster $global:CLUChoice | Get-VMHost | ForEach-Object -Process { New-VMHostProfile -Name “$($_.Name)-Profile” -Description “$($_.Name)) Profile. This

 285 total views,  3 views today

Quickly add additional disks to your VMs

You have the option of either using the variable $VM to specify multiple VMs that require the same disk configuration, or you can manually enter the VM name in its place #Specify VMs $vm = Get-VM “*VM Name*” #Add a thick provisioned, Eager Zeroed disk to 1 or more VMs: New-HardDisk -StorageFormat EagerZeroedThick -Controller “SCSI

 338 total views,  1 views today

List DRS Recommendations and apply them

Heres a function i put together that pulls a list of DRS recommendations for your chosen cluster then asks whether you want to apply them. It uses my usual variables from my menu system $Global:DCChoice – Datacenter Choice$global:CLUChoice – Cluster Choice #Apply DRS recomendations? function VP-ApplyDRSRecommendations { Get-Datacenter $global:DCChoice | Get-Cluster $global:CLUChoice | Get-DrsRecommendation Write-Host

 415 total views

Which host should i deploy to based off current CPU & Memory usage?

The function “VP-WhichHost” will check the average CPU & Memory utilization of a specified cluster and then display all hosts that are below the average. All results are taken from real time metrics. It is broken out into 3 sections of “Below Average Memory”, “Below Average CPU” & “Below both AVG CPU & Memory” to

 434 total views

Check host domain membership

Quick one line list all host in a cluster and display their domain membership status Get-Datacenter $global:DCChoice | Get-Cluster $global:CLUChoice | get-vmhost | Get-VMHostAuthentication | select -Property VMhost, @{N=”Domain”;E={$_.vmhost.Domain}},@{N=”DomainMembershipStatus”;E={$_.vmhost.DomainMembershipStatus}}  279 total views

 279 total views

Take a snapshot with standardized naming

As with everything in IT, having things standardized generally makes your life easier. Unfortunately in many environments, snapshots tend to get overlooked and their naming convention can end up a little adhoc which can lead to confusion around who and why they were taken. Ive put together the following script which takes a snapshot with

 421 total views,  1 views today