VMware Cloud Community
peterr2
Contributor
Contributor

Problem when uploading a file to a datastore with special characters in the datastore name

Here's the issue:
When using VMware Power CLI or VMware API (HTTP upload), there appears to  be an issue when uploading a file to a vmware datastore  which has special  characters in the name, specifically the '+' sign.  This is the case for any  version/build of ESX 3.5 or later or vSphere 4.0 or later.
How to reproduce:
Run a powershell script (or a perl script) similar to the one below to upload a file:
$vCenterServer = <YourvCenterServer>
$Datastore = <YourDatastoreWithPlusSignInTheName>
$IsoFile = <YourIsoFile.iso>
Connect-VIserver -Server $vCenterServer
$ds = Get-Datastore -Name $Datastore
New-PSDrive -Name ds -PSProvider VimDatastore -Root '/' -Location $ds
Copy-DatastoreItem -Item "c:\$IsoFile" -Destination "ds:\$IsoFile"
Remove-PSDrive -Name ds
This is the error:
err.jpg
Note: the same script succeeds when I target a  datastore without the '+' sign in the name. Is there a VMware KB article covergin this issue?
Thanks,
P.
0 Kudos
3 Replies
LucD
Leadership
Leadership

The only explanation on the syntax of a VMFS volume label seems to be in the ESXi Configuration Guide in the section where the vmkfstool is discussed. Besides that the label can be 128 characters long and can not contain leading or trailing blanks, there aren't any other rules.

It looks as if you might have found a bug in the PowerCLI datastore provider.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

aevrov
VMware Employee
VMware Employee

Hi Peter,

There is a known bug about copying a file in the datastore root dir. As I see, you're doing the exactly this. Can you try copying in some subdir of the root, like:

Copy-DatastoreItem -Item "c:\$IsoFile" -Destination "ds:\subdir\$IsoFile"

Regards,

-Angel

0 Kudos
bulletprooffool
Champion
Champion

Peter - try escaping the + sign

i.e. use the backtick   ( ` )  (not ' ) before the plus sign - to identify it as a special character.

the backtick on a UK keyboard is top left, below the 'escape' key.

One day I will virtualise myself . . .
0 Kudos