General Learning vCenter

Renamed Cmdlets in PowerCLI 6


Screenshot 2015-04-01 05.45.34

One of the many enhancements found in PowerCLI 6 R1 is that several cmdlets were renamed. This was done in an effort to better align with Microsoft’s cmdlet naming standard and to be consistent across products. This will also help individuals learn the PowerShell and cmdlet names faster because of the consistency.

So, what changed?

There were three cmdlets that have been renamed:

  • Shutdown-VMGuest is now Stop-VMGuest
  • Apply-VMHostProfile is now Invoke-VMHostProfile
  • Apply-DrsRecommendation is now Invoke-DRSRecommendation

Do I have to change my scripts to work with the new cmdlets?

The short answer is no… To explain, we renamed the previous cmdlets, however, we also added their old cmdlet names onto the new cmdlets as aliases. This will allow all of your scripts that contain these cmdlets to continue to function properly without needing to change your scripts. However, if you do want to modify your scripts to align with the new cmdlets, all the better. Think of it as part of your virtual spring cleaning.

To do a quick search for any script that may contain one of these three cmdlets, you can run the following command in PowerShell:

Get-ChildItem -Include *.ps1 -Recurse | Select-String -Pattern Shutdown-VMGuest, Apply-VMHostProfile, Apply-DrsRecommendation


7 comments have been added so far

  1. Hello There,

    As Shutdown-VMGuest is now Stop-VMGuest, is there any way to shutdown a VM gracefully when we are connected to Virtual center using “Connect-VIServer $vcenter -wa 0” ? When we use Stop-VMGuest cmdlet it triggers unexpected shutdown of Machine.

    Thanks In Advance.

    1. Hi Manoj,

      Stop-VMGuest will initiate a graceful shutdown of the VM (in the task pane of vCenter you’ll see: “Initiate guest OS shutdown”.
      Stop-VM will forcefully power a VM off.

      I’ve tested this thoroughly on ‘PowerCLI 6.0 Release 3 build 3205540’ to migrate a bunch of virtual machines from a vSphere 5.1 environment to vSphere 6.



  2. Hello,
    My script was scheduled via task manager. Running fine until I used version 6 and I got (from my log):
    17:05:24 : error while shutting down guest xxxxxx
    17:05:24 : Exception Type: System.Management.Automation.CommandNotFoundException
    It looks like the alias Shutdown-VMGuest is found when running the script on the console and is not found while running the script via task manager.
    Thank you for your advice.

Leave a Reply

Your email address will not be published.