Book Image

Learning PowerCLI for VMware VSphere

By : Robert van den Nieuwendijk
Book Image

Learning PowerCLI for VMware VSphere

By: Robert van den Nieuwendijk

Overview of this book

Table of Contents (17 chapters)
Learning PowerCLI
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 <SecureString>] [-GuestCredential <PSCredential>] [-GuestUser <String>] [-GuestPassword <SecureString>] [-ToolsWaitSecs <Int32>] [-ScriptType <ScriptType>] [-RunAsync] [-Server <VIServer...