VMware Cloud Community
MikeErter
Enthusiast
Enthusiast

PowerCLI Datastore Provider not working with New-PSDrive

Hey,

The VMware vSphere PowerCLI User's Guide says:

Create a New Custom Datastore Drive

You can use the vSphere PowerCLI Datastore Provider to create custom datastore drives.

Prerequisites

Verify that you are connected to a vCenter Server system.

Procedure

1. Get a datastore by its name and assign it to the $datastore variable.
$datastore = Get-Datastore Storage1

2. Create a new PowerShell drive ds: in $datastore.
New-PSDrive -Location $datastore -Name ds -PSProvider VimDatastore -Root '\'

Note  You can use the New-PSDrive cmdlet, which is an alias of New-DatastoreDrive. It creates a new
datastore drive using the Name and Datastore parameters.

For example: Get-Datastore Storage1 | New-DatastoreDrive -Name ds


Chapter 5 Sample Scripts for Managing vSphere with VMware vSphere PowerCLI

The New-PSDrive with the -Location parameter has just flat stopped working for us.  Does anyone know how to get this working?

Here's our PowerCLI version info:

PowerCLI Version
----------------
VMware vSphere PowerCLI 5.1 Release 1 build 793510
---------------
Snapin Versions
---------------
VMWare AutoDeploy PowerCLI Component 5.1 build 768137
VMWare ImageBuilder PowerCLI Component 5.1 build 768137
VMware License PowerCLI Component 5.1 build 669840
VMware vSphere PowerCLI Component 5.1 build 793489


Reply
0 Kudos
1 Reply
mattboren
Expert
Expert

Hello, MikeErter-

Hmm -- I cannot reproduce the failure.  What is the error message that you receive when you try to issue the New-PSDrive line?

And, does the additional example given in the Note work for you?

Get-Datastore Storage1 | New-DatastoreDrive -Name ds

Let us know.

Aside:  The "NOTE You can use the New-PSDrive cmdlet, which is an alias of New-DatastoreDrive" line in that doc is misleading/false -- New-PSdrive is not an alias of that function (it's not an alias, even -- it's a cmdlet).  That function, New-DatastoreDrive, uses the New-PSDrive cmdlet.

Reply
0 Kudos