Managed Object - GuestFileManager(vim.vm.guest.FileManager)

Property of
GuestOperationsManager
See also
FileTransferInformation, GuestAuthentication, GuestFileAttributes, GuestListFileInfo, VirtualMachine
Since
vSphere API 5.0


Managed Object Description

FileManager is the managed object that provides APIs to manipulate the guest operating system files.

Properties

Name Type Description
None

Methods

Methods defined in this Managed Object
ChangeFileAttributesInGuest, CreateTemporaryDirectoryInGuest, CreateTemporaryFileInGuest, DeleteDirectoryInGuest, DeleteFileInGuest, InitiateFileTransferFromGuest, InitiateFileTransferToGuest, ListFilesInGuest, MakeDirectoryInGuest, MoveDirectoryInGuest, MoveFileInGuest

ChangeFileAttributesInGuest(changeFileAttributes)

Changes the file attributes of a specified file inside the guest.

Required Privileges
None

Parameters

NameTypeDescription
_thisManagedObjectReference A reference to the GuestFileManager used to make the method call.
vm PManagedObjectReference
to a VirtualMachine

Virtual Machine to perform the operation on.
authGuestAuthentication

The guest authentication data. See GuestAuthentication.
guestFilePathxsd:string

The complete path to the file to be copied in the guest. If the file points to an symbolic link, then the attributes of the target file are changed.
fileAttributesGuestFileAttributes

Specifies the different file attributes of the guest file to be changed. See GuestFileAttributes. If any property is not specified, then the specific attribute of the file will be unchanged.
P Required privilege: VirtualMachine.GuestOperations.Modify

Return Value

Type Description
None

Faults

Type Description
FileFaultThrown if there is a file error in the guest operating system.
GuestComponentsOutOfDateThrown if the guest agent is too old to support the operation.
GuestOperationsFaultThrown if there is an error processing a guest operation.
GuestOperationsUnavailableThrown if the VM agent for guest operations is not running.
GuestPermissionDeniedThrown if the operation fails because the guest authentication will not allow the operation.
InvalidGuestLoginThrown if the the guest authentication information was not accepted.
InvalidPowerStateThrown if the VM is not powered on.
InvalidStateThrown if the operation cannot be performed because of the virtual machine's current state.
OperationDisabledByGuestThrown if the operation is not enabled due to guest agent configuration.
OperationNotSupportedByGuestThrown if the operation is not supported by the guest OS.
RuntimeFaultThrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.
TaskInProgressThrown if the virtual machine is busy.

Events

Type
None

Show WSDL type definition



CreateTemporaryDirectoryInGuest(createTemporaryDirectory)

Creates a temporary directory.

Creates a new unique temporary directory for the user to use as needed. The user is responsible for removing it when it is no longer needed.

Required Privileges
None

Parameters

NameTypeDescription
_thisManagedObjectReference A reference to the GuestFileManager used to make the method call.
vm PManagedObjectReference
to a VirtualMachine

Virtual Machine to perform the operation on.
authGuestAuthentication

The guest authentication data. See GuestAuthentication.
prefixxsd:string

The prefix to be given to the new temporary directory.
suffixxsd:string

The suffix to be given to the new temporary directory.
directoryPath*xsd:string

The complete path to the directory in which to create the new directory. If unset or an empty string, a guest-specific location will be used.
*Need not be set P Required privilege: VirtualMachine.GuestOperations.Modify

Return Value

Type Description
xsd:stringThe absolute path of the temporary directory that is created.

Faults

Type Description
FileFaultThrown if there is a file error in the guest operating system.
GuestComponentsOutOfDateThrown if the guest agent is too old to support the operation.
GuestOperationsFaultThrown if there is an error processing a guest operation.
GuestOperationsUnavailableThrown if the VM agent for guest operations is not running.
GuestPermissionDeniedThrown if the operation fails because the guest authentication will not allow the operation.
InvalidGuestLoginThrown if the the guest authentication information was not accepted.
InvalidPowerStateThrown if the VM is not powered on.
InvalidStateThrown if the operation cannot be performed because of the virtual machine's current state.
OperationDisabledByGuestThrown if the operation is not enabled due to guest agent configuration.
OperationNotSupportedByGuestThrown if the operation is not supported by the guest OS.
RuntimeFaultThrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.
TaskInProgressThrown if the virtual machine is busy.

Events

Type
None

Show WSDL type definition



CreateTemporaryFileInGuest(createTemporaryFile)

Creates a temporary file.

Creates a new unique temporary file for the user to use as needed. The user is responsible for removing it when it is no longer needed.

Required Privileges
None

Parameters

NameTypeDescription
_thisManagedObjectReference A reference to the GuestFileManager used to make the method call.
vm PManagedObjectReference
to a VirtualMachine

Virtual Machine to perform the operation on.
authGuestAuthentication

The guest authentication data. See GuestAuthentication.
prefixxsd:string

The prefix to be given to the new temporary file.
suffixxsd:string

The suffix to be given to the new temporary file.
directoryPath*xsd:string

The complete path to the directory in which to create the file. If unset, or an empty string, a guest-specific location will be used.
*Need not be set P Required privilege: VirtualMachine.GuestOperations.Modify

Return Value

Type Description
xsd:stringThe absolute path of the temporary file that is created.

Faults

Type Description
FileFaultThrown if there is a file error in the guest operating system.
GuestComponentsOutOfDateThrown if the guest agent is too old to support the operation.
GuestOperationsFaultThrown if there is an error processing a guest operation.
GuestOperationsUnavailableThrown if the VM agent for guest operations is not running.
GuestPermissionDeniedThrown if the operation fails because the guest authentication will not allow the operation.
InvalidGuestLoginThrown if the the guest authentication information was not accepted.
InvalidPowerStateThrown if the VM is not powered on.
InvalidStateThrown if the operation cannot be performed because of the virtual machine's current state.
OperationDisabledByGuestThrown if the operation is not enabled due to guest agent configuration.
OperationNotSupportedByGuestThrown if the operation is not supported by the guest OS.
RuntimeFaultThrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.
TaskInProgressThrown if the virtual machine is busy.

Events

Type
None

Show WSDL type definition



DeleteDirectoryInGuest(deleteDirectory)

Deletes a directory in the guest OS.

Required Privileges
None

Parameters

NameTypeDescription
_thisManagedObjectReference A reference to the GuestFileManager used to make the method call.
vm PManagedObjectReference
to a VirtualMachine

Virtual Machine to perform the operation on.
authGuestAuthentication

The guest authentication data. See GuestAuthentication.
directoryPathxsd:string

The complete path to the directory to be deleted.
recursivexsd:boolean

If true, all subdirectories are also deleted. If false, the directory must be empty for the operation to succeed.
P Required privilege: VirtualMachine.GuestOperations.Modify

Return Value

Type Description
None

Faults

Type Description
FileFaultThrown if there is a file error in the guest operating system.
GuestComponentsOutOfDateThrown if the guest agent is too old to support the operation.
GuestOperationsFaultThrown if there is an error processing a guest operation.
GuestOperationsUnavailableThrown if the VM agent for guest operations is not running.
GuestPermissionDeniedThrown if the operation fails because the guest authentication will not allow the operation.
InvalidGuestLoginThrown if the the guest authentication information was not accepted.
InvalidPowerStateThrown if the VM is not powered on.
InvalidStateThrown if the operation cannot be performed because of the virtual machine's current state.
NotADirectoryThrown if the specified object is not a directory.
OperationDisabledByGuestThrown if the operation is not enabled due to guest agent configuration.
OperationNotSupportedByGuestThrown if the operation is not supported by the guest OS.
RuntimeFaultThrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.
TaskInProgressThrown if the virtual machine is busy.

Events

Type
None

Show WSDL type definition



DeleteFileInGuest(deleteFile)

Deletes a file in the guest OS

Required Privileges
None

Parameters

NameTypeDescription
_thisManagedObjectReference A reference to the GuestFileManager used to make the method call.
vm PManagedObjectReference
to a VirtualMachine

Virtual Machine to perform the operation on.
authGuestAuthentication

The guest authentication data. See GuestAuthentication.
filePathxsd:string

The complete path to the file or symbolic link to be deleted.
P Required privilege: VirtualMachine.GuestOperations.Modify

Return Value

Type Description
None

Faults

Type Description
FileFaultThrown if there is a file error in the guest operating system.
GuestComponentsOutOfDateThrown if the guest agent is too old to support the operation.
GuestOperationsFaultThrown if there is an error processing a guest operation.
GuestOperationsUnavailableThrown if the VM agent for guest operations is not running.
GuestPermissionDeniedThrown if the operation fails because the guest authentication will not allow the operation.
InvalidGuestLoginThrown if the the guest authentication information was not accepted.
InvalidPowerStateThrown if the VM is not powered on.
InvalidStateThrown if the operation cannot be performed because of the virtual machine's current state.
NotAFileThrown if the specified object is not a file.
OperationDisabledByGuestThrown if the operation is not enabled due to guest agent configuration.
OperationNotSupportedByGuestThrown if the operation is not supported by the guest OS.
RuntimeFaultThrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.
TaskInProgressThrown if the virtual machine is busy.

Events

Type
None

Show WSDL type definition



InitiateFileTransferFromGuest(initiateFileTransferFromGuest)

Initiates an operation to transfer a file from the guest.

Obtains a reference to FileTransferInformation object for the file transfer operation. The information object contains a URL to the file inside the guest to be transferred to the client.
See FileTransferInformation for information on how to use the information object. If the power state of the Virtual Machine is changed when the file transfer is in progress, or the Virtual Machine is migrated, then the transfer operation is aborted.

In order to ensure a secure connection to the host when transferring a file using HTTPS, the X.509 certificate for the host must be used to authenticate the remote end of the connection. The certificate of the host that the virtual machine is running on can be retrieved using the following fields: vm (VirtualMachine) -> runtime (VirtualMachineRuntimeInfo) -> host (HostSystem) -> config (HostConfigInfo) -> certificate.

Required Privileges
None

Parameters

NameTypeDescription
_thisManagedObjectReference A reference to the GuestFileManager used to make the method call.
vm PManagedObjectReference
to a VirtualMachine

Virtual Machine to perform the operation on.
authGuestAuthentication

The guest authentication data.
guestFilePathxsd:string

The complete path to the file inside the guest that has to be transferred to the client. It cannot be a path to a directory or a symbolic link.
P Required privilege: VirtualMachine.GuestOperations.Query

Return Value

Type Description
FileTransferInformationA reference to FileTransferInformation.

Faults

Type Description
FileFaultThrown if there is a file error in the guest operating system.
GuestComponentsOutOfDateThrown if the guest agent is too old to support the operation.
GuestOperationsFaultThrown if there is an error processing a guest operation.
GuestOperationsUnavailableThrown if the VM agent for guest operations is not running.
GuestPermissionDeniedThrown if the operation fails because the guest authentication will not allow the operation.
InvalidGuestLoginThrown if the the guest authentication information was not accepted.
InvalidPowerStateThrown if the VM is not powered on.
InvalidStateThrown if the operation cannot be performed because of the virtual machine's current state.
OperationDisabledByGuestThrown if the operation is not enabled due to guest agent configuration.
OperationNotSupportedByGuestThrown if the operation is not supported by the guest OS.
RuntimeFaultThrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.
TaskInProgressThrown if the virtual machine is busy.

Events

Type
None

Show WSDL type definition



InitiateFileTransferToGuest(initiateFileTransferToGuest)

Initiates an operation to transfer a file to the guest.

Obtains a URL to the file inside the guest to be transferred from the client. The user should send a HTTP PUT request specifying the file content in the body of the request. Multiple PUT request cannot be sent to the URL simultaneously. URL will be invalidated after a successful PUT request is sent. If the power state of the Virtual Machine is changed when the file transfer is in progress, or the Virtual Machine is migrated, then the transfer operation is aborted.

In order to ensure a secure connection to the host when transferring a file using HTTPS, the X.509 certificate for the host must be used to authenticate the remote end of the connection. The certificate of the host that the virtual machine is running on can be retrieved using the following fields: vm (VirtualMachine) -> runtime (VirtualMachineRuntimeInfo) -> host (HostSystem) -> config (HostConfigInfo) -> certificate.

Required Privileges
None

Parameters

NameTypeDescription
_thisManagedObjectReference A reference to the GuestFileManager used to make the method call.
vm PManagedObjectReference
to a VirtualMachine

Virtual Machine to perform the operation on.
authGuestAuthentication

The guest authentication data. See GuestAuthentication.
guestFilePathxsd:string

The complete destination path in the guest to transfer the file from the client. It cannot be a path to a directory or a symbolic link.
fileAttributesGuestFileAttributes

File attributes of the file that has to be created in the guest. See GuestFileAttributes. If any file attribute is not specified, then the default value of that property will be set for the file.
fileSizexsd:long

Size of the file to transfer to the guest in bytes.
overwritexsd:boolean

If set, the destination file is clobbered.
P Required privilege: VirtualMachine.GuestOperations.Modify

Return Value

Type Description
xsd:stringA URL to which the user has to send a PUT request. The host part of the URL is returned as '*' if the hostname to be used is the name of the server to which the call was made. For example, if the call is made to esx-svr-1.domain1.com, and the file can be uploaded to http://esx-svr-1.domain1.com/guestFile?id=1&token=1234, the URL returned may be http://*/guestFile?id=1&token=1234. The client replaces the asterisk with the server name on which it invoked the call.

The URL is valid only for 10 minutes from the time it is generated. Also, the URL becomes invalid whenever the virtual machine is powered off, suspended or unregistered.

Faults

Type Description
FileFaultThrown if there is a file error in the guest operating system.
GuestComponentsOutOfDateThrown if the guest agent is too old to support the operation.
GuestOperationsFaultThrown if there is an error processing a guest operation.
GuestOperationsUnavailableThrown if the VM agent for guest operations is not running.
GuestPermissionDeniedThrown if the operation fails because the guest authentication will not allow the operation.
InvalidGuestLoginThrown if the the guest authentication information was not accepted.
InvalidPowerStateThrown if the VM is not powered on.
InvalidStateThrown if the operation cannot be performed because of the virtual machine's current state.
OperationDisabledByGuestThrown if the operation is not enabled due to guest agent configuration.
OperationNotSupportedByGuestThrown if the operation is not supported by the guest OS.
RuntimeFaultThrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.
TaskInProgressThrown if the virtual machine is busy.

Events

Type
None

Show WSDL type definition



ListFilesInGuest(listFiles)

Returns information about files or directories in the guest.

The results could be extermely large, so to minimize the size of the return value for cases where a UI only needs to show the first N results, the answer is batched. Files are returned in OS-specific (inode) order. If the directory is modified between queries, missing or duplicate results can occur.

Required Privileges
None

Parameters

NameTypeDescription
_thisManagedObjectReference A reference to the GuestFileManager used to make the method call.
vm PManagedObjectReference
to a VirtualMachine

Virtual Machine to perform the operation on.
authGuestAuthentication

The guest authentication data. See GuestAuthentication.
filePathxsd:string

The complete path to the directory or file to query.
index*xsd:int

Which result to start the list with. The default is 0.
maxResults*xsd:int

The maximum number of results to return. The default is 50.
matchPattern*xsd:string

A filter for the return values. Match patterns are specified using perl-compatible regular expressions. If matchPattern is unset, then the pattern '.*' is used.
*Need not be set P Required privilege: VirtualMachine.GuestOperations.Query

Return Value

Type Description
GuestListFileInfoA GuestListFileInfo object containing information for all the matching files in the filePath and the number of files left to be returned.

Faults

Type Description
FileFault
GuestComponentsOutOfDateThrown if the guest agent is too old to support the operation.
GuestOperationsFaultThrown if there is an error processing a guest operation.
GuestOperationsUnavailableThrown if the VM agent for guest operations is not running.
GuestPermissionDeniedThrown if the operation fails because the guest authentication will not allow the operation.
InvalidArgumentThrown if the matchPattern is an invalid regular expression.
InvalidGuestLoginThrown if the the guest authentication information was not accepted.
InvalidPowerStateThrown if the VM is not powered on.
InvalidStateThrown if the operation cannot be performed because of the virtual machine's current state.
OperationDisabledByGuestThrown if the operation is not enabled due to guest agent configuration.
OperationNotSupportedByGuestThrown if the operation is not supported by the guest OS.
RuntimeFaultThrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.
TaskInProgressThrown if the virtual machine is busy.

Events

Type
None

Show WSDL type definition



MakeDirectoryInGuest(makeDirectory)

Creates a directory in the guest OS

Required Privileges
None

Parameters

NameTypeDescription
_thisManagedObjectReference A reference to the GuestFileManager used to make the method call.
vm PManagedObjectReference
to a VirtualMachine

Virtual Machine to perform the operation on.
authGuestAuthentication

The guest authentication data. See GuestAuthentication.
directoryPathxsd:string

The complete path to the directory to be created.
createParentDirectoriesxsd:boolean

Whether any parent directories are to be created.
P Required privilege: VirtualMachine.GuestOperations.Modify

Return Value

Type Description
None

Faults

Type Description
FileAlreadyExistsThrown if the specified object already exists.
FileFaultThrown if there is a file error in the guest operating system.
GuestComponentsOutOfDateThrown if the guest agent is too old to support the operation.
GuestOperationsFaultThrown if there is an error processing a guest operation.
GuestOperationsUnavailableThrown if the VM agent for guest operations is not running.
GuestPermissionDeniedThrown if the directory cannot be created because the guest authentication will not allow the operation.
InvalidGuestLoginThrown if the the guest authentication information was not accepted.
InvalidPowerStateThrown if the VM is not powered on.
InvalidStateThrown if the operation cannot be performed because of the virtual machine's current state.
OperationDisabledByGuestThrown if the operation is not enabled due to guest agent configuration.
OperationNotSupportedByGuestThrown if the operation is not supported by the guest OS.
RuntimeFaultThrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.
TaskInProgressThrown if the virtual machine is busy.

Events

Type
None

Show WSDL type definition



MoveDirectoryInGuest(moveDirectory)

Moves or renames a directory in the guest.

Required Privileges
None

Parameters

NameTypeDescription
_thisManagedObjectReference A reference to the GuestFileManager used to make the method call.
vm PManagedObjectReference
to a VirtualMachine

Virtual Machine to perform the operation on.
authGuestAuthentication

The guest authentication data. See GuestAuthentication.
srcDirectoryPathxsd:string

The complete path to the directory to be moved.
dstDirectoryPathxsd:string

The complete path to the where the directory is moved or its new name. It cannot be a path to an existing directory or an existing file.
P Required privilege: VirtualMachine.GuestOperations.Modify

Return Value

Type Description
None

Faults

Type Description
FileFaultThrown if there is a file error in the guest operating system.
GuestComponentsOutOfDateThrown if the guest agent is too old to support the operation.
GuestOperationsFaultThrown if there is an error processing a guest operation.
GuestOperationsUnavailableThrown if the VM agent for guest operations is not running.
GuestPermissionDeniedThrown if the operation fails because the guest authentication will not allow the operation.
InvalidGuestLoginThrown if the the guest authentication information was not accepted.
InvalidPowerStateThrown if the VM is not powered on.
InvalidStateThrown if the operation cannot be performed because of the virtual machine's current state.
OperationDisabledByGuestThrown if the operation is not enabled due to guest agent configuration.
OperationNotSupportedByGuestThrown if the operation is not supported by the guest OS.
RuntimeFaultThrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.
TaskInProgressThrown if the virtual machine is busy.

Events

Type
None

Show WSDL type definition



MoveFileInGuest(moveFile)

Renames a file in the guest.

Required Privileges
None

Parameters

NameTypeDescription
_thisManagedObjectReference A reference to the GuestFileManager used to make the method call.
vm PManagedObjectReference
to a VirtualMachine

Virtual Machine to perform the operation on.
authGuestAuthentication

The guest authentication data. See GuestAuthentication.
srcFilePathxsd:string

The complete path to the original file or symbolic link to be moved.
dstFilePathxsd:string

The complete path to the where the file is renamed. It cannot be a path to an existing diectory.
overwritexsd:boolean

If set, the destination file is clobbered.
P Required privilege: VirtualMachine.GuestOperations.Modify

Return Value

Type Description
None

Faults

Type Description
FileFaultThrown if there is a file error in the guest operating system.
GuestComponentsOutOfDateThrown if the guest agent is too old to support the operation.
GuestOperationsFaultThrown if there is an error processing a guest operation.
GuestOperationsUnavailableThrown if the VM agent for guest operations is not running.
GuestPermissionDeniedThrown if the operation fails because the guest authentication will not allow the operation.
InvalidGuestLoginThrown if the the guest authentication information was not accepted.
InvalidPowerStateThrown if the VM is not powered on.
InvalidStateThrown if the operation cannot be performed because of the virtual machine's current state.
OperationDisabledByGuestThrown if the operation is not enabled due to guest agent configuration.
OperationNotSupportedByGuestThrown if the operation is not supported by the guest OS.
RuntimeFaultThrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.
TaskInProgressThrown if the virtual machine is busy.

Events

Type
None

Show WSDL type definition