Quantcast
Channel: VMware Communities : Document List - vSphere PowerCLI
Viewing all articles
Browse latest Browse all 379

Delete folder in datastore

$
0
0

Hi all,

 

I've been trying forever to use the "$fileMgr.DeleteDatastoreFile_Task" command in PowerCLI.

I create clones for backup, and after cloning I remove them from the inventory.

 

So now I want to create a script to delete the folders of these clones all together.

 

For what I've found the syntax should be:

$fileMgr.DeleteDatastoreFile_Task('[<datastore name>] <folder name>', '<datacenter name>')

 

In my situation:

Folder          : XP_Workstation-backup

Datastore     : NAS01a

Datacenter   : DC_NNSPT

 

So I figured it should look like this:

$fileMgr.DeleteDatastoreFile_Task('[NAS01a] XP_Workstation-backup', 'DC_NNSPT')

 

This doesn't work, I get the following response:

You cannot call a method on a null-valued expression.
At line:1 char:34
+ $fileMgr.DeleteDatastoreFile_Task <<<< ('[NAS01a] XP_Workstation-backup', 'DC_NNSPT')
+ CategoryInfo          : InvalidOperation: (DeleteDatastoreFile_Task:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

 

What am I missing here?

 

Thanks!


Viewing all articles
Browse latest Browse all 379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>