Start VM from VBS script – Securecrt

This is a work in progress but I have been using SecureCRT to automate many things that I do in the LAB. The following details starting VM servers from SecureCRT vbs scripts.

  • Create a VBS like below. SecureCRT will do this if you turn on the Record Macro.
  • Adjust the server ID and replicate script for all the servers.
  • Add a button for each and link to the VBS script to SecureCRT button Bar.

SecureCRT-AddButton

Securecrt-ESXi-start

To find the VM server ssh to ESXi. You will have to enable SSH in the Security configuration of ESXi.

Command to run from ESXi shell to get the VM server id:

  • vim-cmd vmsvc/getallvms
  • find vmid located in the left column {nn}

Following is the start script.

#$language = “VBScript”

#$interface = “1.0”

crt.Screen.Synchronous = True

Sub Main

crt.Screen.Send “vim-cmd vmsvc/power.on {nn}” & chr(13)

End Sub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: