How to setup a Powershell Environment to manage VMware

  1. Make sure .NET Framework 4.5 is installed (HERE)
  2. Make sure that Powershell 3.0 is installed (do not use 4.0 as it breaks add-ins) (HERE)
  3. Install vSphere PowerCLi (HERE)
  4. open PS and run:  Set-ExecutionPolicy -ExecutionPolicy unrestricted
  5. Close and reopen PS and create a new profile by running:  New-item –type file –force $profile
  6. Run the following:  Notepad $profile
  7. Paste the following into the file:
    1. Add-PSSnapin VMware.VimAutomation.Core
      Add-PSSnapin VMware.VimAutomation.Vds
      Add-PSSnapin VMware.VimAutomation.License
      Add-PSSnapin VMware.DeployAutomation
      Add-PSSnapin VMware.ImageBuilder
      Add-PSSnapin VMware.VimAutomation.Cloud
  8. Save the PS1 file on your desktop and open a session via the shortcut.


Continue Reading

A nice Slash and Burn script for vCD

WARNING!!! This will delete ALL VMs in your vCD!!!!!

Connect to your vCD with “Connect-CIServer ” and run the following:

Stop-CIVApp * -Confirm:$false
Remove-CIVApp * -Confirm:$false
sleep 5
Remove-OrgNetwork * -Confirm:$false

Then manually delete any gateway devices and then run the following to clean up all the orgs:

Set-OrgVdc -Enabled:$false
remove-OrgVdc -Confirm:$false
Set-Org -Enabled:$false 
remove-Org -Confirm:$false

Big thanks to my colleague Grant Voss for this awesome little cleanup script.

Continue Reading

Modifying an AutoDeploy rule in PowerCLi

After some hunting I found that modification of an AutoDeploy rule wasn’t as simple as Edit-DeployRule  🙂  My coworker Joe Keegan, the God of AutoDeploy walked me through the simple steps to modify existing rules rather that deleting and replacing.

NOTE:  You do NOT need to use “” or other characters around the <VALUE> EXCEPT for the Pattern Value.  Otherwise, the object is found when it checks the name against the GetType.

To replace the Pattern of an existing rule:
Get-DeployRule -name <RULENAME> | Copy-DeployRule -ReplacePattern “<NEW PATTERN>”

To replace the Image, Location, or Profile of an existing rule:
Get-DeployRule -name <RULENAME> | Copy-DeployRule -ReplaceItem <NEW PROFILE NAME>


Continue Reading