5.5.14 Folder deletion through the vCenter server
Function
In the VMware vSphere environment, deletes the unnecessary folder that is placed in the guest OS of the virtual server through the vCenter server.
The folder is deleted by using the following vSphere PowerCLI commandlet on the execution target server:
Invoke-VMScript -ScriptText "format-specific-to-each-guest-OS-of-the-virtual-server"
-VM VirtualMachine object#1
-GuestUser "user-name-for-logging-in-to-the-guest-OS-(VMware.guestOSUserName-property)"
-GuestPassword "password-for-logging-in-to-the-guest-OS-(VMware.guestOSUserPassword-property)"
-Confirm:$false#2
#1: Object obtained from the virtual server name (VMware.vmName property) value
#2: This prevents the commandlet from becoming interactive.
For each guest OS of the virtual server, specify the ScriptText option in the following format and then execute it:
- Windows
"cmd.exe /c RMDIR /S /Q 'path-to-the-folder-to-be-deleted-on-the-guest-OS-(VMware.deleteFolderOnGuest-property)' "
- UNIX
"/bin/rm -f -r 'path-to-the-folder-to-be-deleted-on-the-guest-OS-(VMware.deleteFolderOnGuest-property)' "
The following servers are the prerequisites for this plug-in:
- vCenter server
Server where VMware vCenter Server is installed.
- ESX server
Server where VMware vSphere ESXi is installed.
- vCenter control server (execution target server)
Server where VMware vSphere PowerCLI is installed. Plug-ins are transferred to this server and executed by JP1/AO.
- Virtual server
Virtual server that is managed by the vCenter server and VMware vSphere ESXi.
For details about the Invoke-VMScript commandlet, see Cmdlet Reference in the vSphere PowerCLI Documentation.
For details about the RMDIR command, see the RMDIR command specifications.
For details about the rm command, see the rm command specifications.
Use situation
This plug-in is used to delete through the vCenter server the unnecessary folder storing both script and the files necessary to execute the script in an environment where the JP1/AO server cannot communicate with the virtual server managed by the vCenter server.
Use this plug-in together with folder transmission through the vCenter server (vsphereSendFolderToGuest plug-in) and script execution through the vCenter server (vsphereInvokeScript plug-in).
Prerequisites
For the most recent information about the prerequisite products on the execution-target server, supported OSs for the prerequisite products on the execution-target server, and prerequisite products on the execution-target system, see the Release Notes.
In addition, the following OS and products use abbreviations. For the abbreviations of OS and products, see the "Preface".
Prerequisite products for the execution-target server:
- VMware PowerCLI
Prerequisite products for the execution-target system:
(1) Prerequisite products for the vCenter server
- VMware vCenter Server
(2) VMware vSphere ESXi instance that manages the virtual server
(3) Prerequisite OSs for the virtual server
In a configuration that is supported by the prerequisite products for VMware vSphere ESXi and the vCenter control server that manage the prerequisite products for the vCenter server and the virtual server, the following OSs are supported:
- Windows Server
- Red Hat Enterprise Linux Server
Supported OSs for the prerequisite products for the execution-target server:
- Windows Server
Conditions for using the prerequisite products for the execution-target system:
(1) VMware vSphere ESXi must be managed on VMware vCenter Server.
(2) Conditions related to the settings on VMware vCenter Server
- Virtual servers must have a unique name.
- The VMware-related name shown below is case-sensitive in VMware. However, it is not case-sensitive in a vSphere PowerCLI instance that is executed from this plug-in.
- Virtual server name
(3) Conditions related to the virtual server
- The virtual server must be running.
- If the virtual server OS is Windows, Windows PowerShell 2.0 or later must be installed.
- VMwareTools must be installed on the virtual server.
Cautions
(1) Do not specify a string containing a double quotation mark (") or a single quotation mark (') in a property of this plug-in.
(2) Do not specify a string containing a grave accent mark (`) or a dollar sign ($) in the path to the folder to be deleted in the guest OS (VMware.deleteFolderOnGuest property).
(3) This plug-in can only handle a standard folder as the folder. In other words, the plug-in cannot handle a drive as the folder.
(4) For other cautions, see the cautions about the Invoke-VMScript commandlet in Cmdlet Reference in the vSphere PowerCLI Documentation, and the cautions about the RMDIR command and rm command for each OS.
Execution privilege
(1) Users who access VMware vCenter Server must have the following permission:
System administrator role
Version
02.50.00
Plug-in tags
Modify VM,VMware vSphere
Plug-in name displayed in the task log
vsphereDeleteFolderOnGuest
Return code
0: Normal
12: Error (Mistake by user) Invalid property
23: Error (Invalid environment) The environment requirements are not met.
27: Error (Check the error details by using the task log.) Unidentified error
41: Error (An error has been detected in the component.) Property not entered (An error has been detected in the component script.)
Property list
The following table lists the properties:
Property key |
Property name |
Description |
Default value |
I/O type |
Required |
---|---|---|---|---|---|
plugin.destinationHost |
Host name of the execution target server |
Specify the host name or IP address of the server on which this plugin will be executed. IPv6 addresses are not supported. |
-- |
Input |
R |
VMware.vCenterServerName |
Host name of the vCenter server |
Specify the host name or IP address of the destination vCenter server. IPv6 addresses are not supported. |
-- |
Input |
R |
VMware.userName |
User name for connecting to the VMware vCenter Server |
Specify the user name for connecting to the VMware vCenter Server. |
-- |
Input |
R |
VMware.password |
Password for connecting to the VMware vCenter Server |
Specify the password for connecting to the VMware vCenter Server. |
-- |
Input |
R |
VMware.portNumber |
Port number for connecting to the VMware vCenter server |
Specify the number of the port for connecting to VMware vCenter Server (for the VMware vCenter Server Web service). |
443 |
Input |
O |
VMware.protocol |
Protocol for connecting to the VMware vCenter server |
Specify either HTTP or HTTPS as the protocol for connecting to VMware vCenter Server. |
https |
Input |
R |
VMware.vmName |
Virtual server name |
Specify the name of the virtual server. (This is the virtual server name in VMware vCenter Server. Do not specify a host name.) |
-- |
Input |
R |
VMware.guestOSUserName |
User name for logging in to the guest OS |
Specify the user name for logging in to the guest OS. |
-- |
Input |
R |
VMware.guestOSUserPassword |
Password for logging in to the guest OS |
Specify the password for logging in to the guest OS. |
-- |
Input |
R |
VMware.deleteFolderOnGuest |
Path to the folder to be deleted on the guest OS |
Specify the full path of the folder to be deleted on the guest OS. |
-- |
Input |
R |
common.returnValue |
Return value for the plugin |
The return value of this plugin stored. |
-- |
Output |
O |