Removing datastores
To remove a datastore, you can use the Remove-Datastore
cmdlet. The syntax of this cmdlet is:
Remove-Datastore [-Datastore] <Datastore[]> [-VMHost] <VMHost>
[-Server <VIServer[]>] [-RunAsync] [-WhatIf] [-Confirm]
[<CommonParameters>]
The required parameters of the Remove-Datastore
cmdlet are -Datastore
and -VMHost
.
In the following example, we will remove the Cluster01_Vmfs01
datastore we created in the section,
Creating VMFS datastores
:
PowerCLI C:\> Remove-Datastore -Datastore Cluster01_Vmfs01
-VMHost 192.168.0.133 -Confirm:$false
The preceding command does not return any output.
If you try to remove a datastore, it is possible that you get an error message similar to:
Remove-Datastore : 1/31/2017 2:05:48 PM Remove-Datastore
The resource 'Cluster01_Vmfs01' is in use.
Before you can remove a datastore, there are some requirements that must be fulfilled:
There must be no virtual machines residing on the...