Angels Technology

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Friday, June 29, 2012

Shutdown all vms on a vsphere instance

Posted on 11:38 PM by Unknown

    This post http://communities.vmware.com/message/2068218#2068218 got me thinking about various DR situations.
    Essentially, what the op was saying was that even though he has a generator, it doenst work. Another variable that can throw wrenches in someones day.

    Not going into reasons why someone doesn’t have other DR plans, sometimes a graceful shutdown is much more efficient then a looming hard shutdown.

    Using the script from herseyc I'm going to run it on my infrastructure as a demo.

    # Get All the ESX Hosts
    $ESXSRV = Get-VMHost
    # For each of the powered on VMs with running VM Tools
    Foreach ($VM in ($ESXSRV | Get-VM | Where {$_.PowerState -eq "poweredOn" -and $_.Guest.State -eq "Running"})){
        # Shutdown Guest
        write-host "Shutting down $VM"
        $VM | Shutdown-VMGuest -Confirm:$false
    }

    Pasted from <http://communities.vmware.com/message/2068218#2068218>

    You will need powercli already installed.



    Here is my powered on vms list

    Lets see what happens when we run the script







    As we can see the script initiated a shutdown on all the running guests on the  vsphere instance.
    Looking at the task bar of the client for vsphere you can see guests going down.


     Even my vcenter went down, as planned



    What is this? We have a server still running! I am connete  to the host here.




    Looking at the summary, you can see vmware tools is not installed.
    So a shutdown command wouldn’t be well received.
    If the vmware tools is not installed or has an issue and isn't running then the server will still be running and you wouldn’t know it if your vcenter is virtualized.


    Possible solution can be a script that runs on the vcenter server that stops the vmware tools service! Run this first and then run the shutdown command so your vcenter is the last to go.
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in command line, powercli, vm, vmware, vsphere | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Copy and paste clipboard items to and from your vsphere virtual machines and your pc
    Wanted to copy and paste text between your pc and a vm? Now you can. Power off your VM. Go to the vm properties->Options->Advanced-...
  • Interesting look at Win cpu usage vs Vmware CPU usage
    I came across this scenario: The windows task manager shows the cpu of the vm pegged at 100%. The vmware performance monitor says that ...
  • E1000 vs e1000e in vmware : notes
    Performance difference " The performance should be about the same, the reason for the change is that Intel is not longer supporting the...
  • Convert your physical RDM (rdmp) to a virtual RDM (rdmv)
    So you have a raw disk mapping on your virtual machine in esxi   and you wanted to convert it from a rdmp to a rdmv. Using the VMware cli...
  • Vmware DRS anti affinity rules wont let you enter maintenance mode for a esxi host
    You have a DRS rule that specifies that 2 vms need to be kept apart: In this case: 250-FT and 250sql3 For larger clusters with multiple...
  • Check esxi host's disk latency / storage performance using DAVG in esxtop
    Do youyour virutal machine's seem slow? Is it your vm or is it your disk storage or san? This is how we can check. What is davg This...
  • vCenter and Hosts Disconnected -- Reason: Cannot verify the SSL thumbprint
    Just saw this over on the forums, but if your hosts are getting this error: Cannot syncronize the host <hostname.fqdn>, Reason: Cannot...
  • Vmware esxi : Intel Pro/1000 ET quad port adapter and ISCSI
    I've seen issues pop up with intel quad ports here and there on the forums so I thought it would be good to note down what worked here...
  • Creating a ovf or ova file of a virtual machine from the vsphere client
    So you want to export a vm and transport it. The reason you would want to convert it to a ova is because the data is packed in a nice for...
  • Setting your esxi host to restart automatically after crash or purple screen aka psod
    The default and recommended setting is to leave the purple screen of death up to help you notice that het host has died and also leave t...

Categories

  • 5.1
  • backup
  • cloud
  • cluster
  • command line
  • console
  • converter
  • cpu
  • datacenter
  • datastore
  • datastore. rdm
  • DCUI
  • dell
  • disaster recovery
  • display
  • DR
  • e1000
  • e1000e
  • ec2
  • esx
  • esxi
  • esxtop
  • extent
  • Good for enterprise
  • HA
  • hcl
  • host
  • HP
  • ibm
  • iometer
  • iscsi
  • iso
  • linked mode
  • logs
  • MAC
  • memory
  • NFS
  • NIC
  • NTP
  • ova
  • ovf
  • p2v
  • pcie
  • performance
  • phone
  • powercli
  • powershell
  • PSOD
  • raid
  • RDM
  • resource pool
  • rvtools
  • scsi
  • sddc
  • snapshots
  • SQL
  • SRM
  • ssh
  • storage
  • svmotion
  • syslog collector
  • v2v
  • vapp
  • vcenter
  • vcloud
  • vcp
  • veeam
  • VI console
  • vm
  • vmdk
  • VMFS
  • vmkfstools
  • vmotion
  • VMUG
  • vmware
  • vmware tools
  • vmware.esxi
  • vmxnet3
  • vsphere
  • vum
  • web client
  • windows

Blog Archive

  • ►  2013 (28)
    • ►  October (2)
    • ►  September (1)
    • ►  August (1)
    • ►  July (1)
    • ►  June (14)
    • ►  May (1)
    • ►  April (1)
    • ►  March (5)
    • ►  February (1)
    • ►  January (1)
  • ▼  2012 (138)
    • ►  December (2)
    • ►  November (13)
    • ►  October (26)
    • ►  September (19)
    • ►  August (35)
    • ►  July (34)
    • ▼  June (9)
      • Shutdown all vms on a vsphere instance
      • Power off Virtual machines via command line: Part2...
      • Vmware reference card.
      • Power off Virtual machines via command line
      • Veeam one now has a free edition! Also try Veeam b...
      • ESXi host: viewing logs
      • snapshots, which order to delete
      • Troubleshooting: Vmotion: error migrating
      • Datastore: marked inactive but still accessible
Powered by Blogger.

About Me

Unknown
View my complete profile