Version 1

    Table of Contents

    • Author

    • Description

    • Category

    • Features

    • Requirements

    • Version Support

    • Sample Execution

    • Sample Output

    • Email Reports



    William Lam




    This script allows you to start, stop and restart some of the basic services that are exposed via the vSphere API: sshd,ntpd,vmware-webAccess,vmware-vpxa,etc against set of ESX(i) hosts either directly connected or via vCenter. You'll need to provide a list of hosts to perform a certain operation when connecting to vCenter or if you're connecting directly to an ESX(i) host, you will not need to provide an input file.



    • Miscellaneous



    • Supports vCenter and ESX and ESXi (licensed version only)

    • Supports running on both Windows and Linux



    • vCenter 2.5 or 4.0

    • ESX(i) 3.5 4.0

    • vSphere SDK for Perl/vCLI 4.0 Windows or Linux OR vMA 4.0


    Version Support

    • Supports ESX(i) hosts being managed by vCenter

    • Supports both ESX and ESXi (licensed version only)


    Sample Execution



    • Query

    • Start

    • Stop

    • Restart


    Here is sample hostfile input file:

    [vi-admin@scofield skunkworks]$ cat primp-hosts


    Sample Output


    Query availble services to operate on vCenter:

    [vi-admin@scofield skunkworks]$ ./ --server --hostfile primp-hosts --operation query
    Host: ( VMware ESXi 4.0.0 build-171294 )
    ntpd    NOT RUNNING
    vmware-vpxa     RUNNING
    Host: ( VMware ESXi 4.0.0 build-171294 )
    ntpd    NOT RUNNING
    vmware-vpxa     RUNNING


    Query availble services to operate on individual ESX(i) host:

    [vi-admin@scofield skunkworks]$ ./ --server --username root --operation query
    Enter password:
    Host: ( VMware ESX 4.0.0 build-208167 )
    ntpd    NOT RUNNING
    sshd    RUNNING
    vmware-vpxa     NOT RUNNING
    vmware-webAccess        NOT RUNNING


    Start a service on individual ESX host:


    Stop a service on set of ESX(i) hosts on vCenter:


    Restart a service on on individual ESX host:


    Note: When stopping or restarting vmware-vpxa, you may want to connect directly to the host to perform the operation else you will lose the connection to the host you're restarting the vCenter agent which will cause the script to exit early, this is an expected outcome as the vCenter agent can not be contacted if it's been stopped or in process of restarting.