Name
VMSetSharedFolderState
Description
$err = VMSetSharedFolderState($vmHandle,
$shareName,
$hostPathName,
$flags);
This function modifies the state of a shared folder mounted in the virtual
machine.
Parameters
- vmHandle
-
Identifies a virtual machine. Call VMOpen() to create a virtual machine handle.
- shareName
-
Specifies the name of the shared folder.
- hostPathName
-
Specifies the host path of the shared folder.
- flags
-
The new flag settings.
Return Value
$err. The error code returned by the operation. For returned values, see Topics > Error Codes.
Remarks
- This function modifies the state flags of an existing shared folder.
- If the shared folder specified by
$shareName
does not exist before calling this function,
this function will return VIX_E_NOT_FOUND.
- It is not necessary to call
VMLoginInGuest()
before calling this function.
- Shared folders are not supported for the following guest operating systems:
Windows ME, Windows 98, Windows 95, Windows 3.x, and DOS.
- In this release, this function requires the virtual machine to be powered on
with VMware Tools installed.
Side Effects
None.
Requirements
use VMware::Vix::Simple;
use VMware::Vix::API::Constants;
since VMware Workstation 6.0
Example
my $err;
my $numSharedFolders;
my $folderName;
my $folderHostPath;
my $folderFlags;
my $i;
($err, $numSharedFolders) = VMGetNumSharedFolders($vmHandle);
die "VMGetNumSharedFolders() failed, $err ", GetErrorText($err), "\n" if $err != VIX_OK;
for ($i = 0; $i < $numSharedFolders; $i++) {
($err, $folderFlags, $folderName, $folderHostPath) = VMGetSharedFolderState($vmHandle, $i);
die "VMGetSharedFolderState() failed, $err ", GetErrorText($err), "\n" if $err != VIX_OK;
#
# make all folders writable
#
($err) = VMSetSharedFolderState($vmHandle, $folderName, $folderHostPath,
VIX_SHAREDFOLDER_WRITE_ACCESS);
die "VMSetSharedFolderState() failed, $err ", GetErrorText($err), "\n" if $err != VIX_OK;
}