Running commands on the guest OS

To run a command on the guest operating system of a virtual machine, you can use the Invoke-VMScript cmdlet. To use this cmdlet, the virtual machines must be powered on and must have the VMware Tools installed. You also need network connectivity to the ESXi server hosting the virtual machine on port 902. This cmdlet only supports the following guest operating systems:

  • Windows XP 32-bit SP3
  • Windows Server 2003 32-bit SP2
  • Windows Server 2003 64-bit SP2
  • Windows 7 64-bit
  • Windows Server 2008 R2 64-bit
  • Red Hat Enterprise 5 operating systems

The Invoke-VMScript cmdlet has the following syntax:

Invoke-VMScript [-ScriptText] <String> [-VM] <VirtualMachine[]> [-HostCredential <PSCredential>] [-HostUser <String>] [-HostPassword ...

Get Learning PowerCLI now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.