Manage Datastores Through Datastore Drives
You can use the PowerCLI Datastore Provider to browse datastores from datastore drives.
Prerequisites
Verify that you are connected to a vCenter Server system.
Procedure
- Navigate to a folder on the ds: drive.
cd VirtualMachines\XPVirtualMachine
- View the files of the folder by running the ls command.
ls
ls is the UNIX style alias of the Get-ChildItem cmdlet. - Rename a file by running the Rename-Item cmdlet or its alias ren.
For example, to change the name of the vmware-3.log file to vmware-3old.log, run:
ren vmware-3.log vmware-3old.log
All file operations apply only on files in the current folder. - Delete a file by running the Remove-Item cmdlet or its alias del.
For example, to remove the vmware-3old.log file from the XPVirtualMachine folder, run:
del ds:\VirtualMachines\XPVirtualMachine\vmware-2.log
- Copy a file by running the Copy-Item cmdlet or its alias copy.
copy ds:\VirtualMachines\XPVirtualMachine\vmware-3old.log ds:\VirtualMachines\vmware-3.log
- Copy a file to another datastore by running the Copy-Item cmdlet or its alias copy.
copy ds:\Datacenter01\Datastore01\XPVirtualMachine\vmware-1.log ds:\Datacenter01\Datastore02\XPVirtualMachine02\vmware.log
- Create a new folder by running the New-Item cmdlet or its alias mkdir.
mkdir -Path ds:\VirtualMachines -Name Folder01 -Type Folder
- Download a file from the datastore drive to the local machine by running the Copy-DatastoreItem cmdlet.
Copy-DatastoreItem ds:\VirtualMachines\XPVirtualMachine\vmware-3.log C:\Temp\vmware-3.log
- Upload a file from the local machine by running the Copy-DatastoreItem cmdlet.
Copy-DatastoreItem C:\Temp\vmware-3.log ds:\VirtualMachines\XPVirtualMachine\vmware-3new.log