I am no powercli expert, but the following is my “skeleton” when setting up an interactive powercli script.
Note- I am using Notepad++ with the VM2012 dark theme when editing the .ps1 file.
I am no powercli expert, but the following is my “skeleton” when setting up an interactive powercli script.
Note- I am using Notepad++ with the VM2012 dark theme when editing the .ps1 file.
Add-PSsnapin VMware.VimAutomation.Core -ErrorAction SilentlyContinue
If you want to prompt the end user to type in the vcenter name and path to a list of cluster names use when they run the script. I prefer the option for the list of clusters when testing in a lab vsr running a script that changes all cluster in the VC.
$vCenter = Read-Host “Enter the vCenter Name”
$listofclusters = Read-Host “Enter the path to the lists of clusters ex. c:scriptshosts.txt”
$clusName = Get-Content -path $listofclusters
Connect-VIServer $vCenter
Disconnect-VIServer $vCenter -Confirm:$false
Thanks http://www.thelowercasew.com/powercli-script-to-change-the-drs-slider for the DRS change code.