Wednesday, September 25, 2013

How to Run Script on Linux Guest in VMware

If you want to run a script from PowerShell on a GuestOS, such as Red Hat or Windows 2008 you can use the inoke-vmscript command.   Here's  a basic script that sends disk space email.
Run Script on VMGuest OS from PowerShell
  • $pw = read-host "Enter Passwd" -asSecureString 
  • $script = 'df -h | mail -s "disk space report from Invoke-VMScript" todd@mydomain.com' 
  •  invoke-vmscript -ScriptText $script -VM someVM -GuestUser todd -GuestPassword $pw -ScriptType bash
Reference:  http://www.vmware.com/support/developer/PowerCLI/PowerCLI51/html/Invoke-VMScript.html

No comments:

Post a Comment