VMware Cloud Community
markdjones82
Expert
Expert
Jump to solution

Remove NFS datastore from hosts error

All, I am running this command but on each hosts i get 1 error first and then it works.  Any ideas why?

PowerCLI C:\Program Files\VMware\Infrastructure\vSphere PowerCLI> Get-VMHost hostname | remove-datastore -Datastore (get-datastore -name "Templates_I
SOs")

Perform operation?
Performing operation 'Remove datastore.' on Datastore 'Templates_ISOs'.
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help
(default is "Y"):y
Remove-Datastore : 1/10/2013 11:43:09 AM    Remove-Datastore        A specified
parameter was not correct.

At line:1 char:50
+ Get-VMHost hostname | remove-datastore <<<<  -Datastore (get-datas
tore -name "Templates_ISOs")
    + CategoryInfo          : NotSpecified: (:) [Remove-Datastore], InvalidArg
   ument
    + FullyQualifiedErrorId : Client20_VmHostServiceImpl_RemoveDatastoreOfViOb
   ject_InvalidArgument,VMware.VimAutomation.ViCore.Cmdlets.Commands.RemoveDa
  tastore


Perform operation?
Performing operation 'Remove datastore.' on Datastore 'Templates_ISOs'.
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help
(default is "Y"):y

http://www.twitter.com/markdjones82 | http://nutzandbolts.wordpress.com
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Do

Get-VMHost hostname

or

Get-Datastore-Name "Templates_ISOs"

perhaps return more than 1 object ?

Or are you running in "multiple" mode and have more than 1 connection ?

Do a

Get-PowerCLIConfiguration

and

$defaultviservers


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

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

Do

Get-VMHost hostname

or

Get-Datastore-Name "Templates_ISOs"

perhaps return more than 1 object ?

Or are you running in "multiple" mode and have more than 1 connection ?

Do a

Get-PowerCLIConfiguration

and

$defaultviservers


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

0 Kudos
markdjones82
Expert
Expert
Jump to solution

Ah, that appears to be it Luc.  I have Templates_ISOs twice because I remounted to another server temporarily while this other is orphaned.  That must be why.

Thanks!

http://www.twitter.com/markdjones82 | http://nutzandbolts.wordpress.com
0 Kudos
markdjones82
Expert
Expert
Jump to solution

Still having an odd issue that when i specify the datacenter location for the datastore it gives me this error, but still unmounts it. Why would it give this error when i sepcify the exact datastore? Oh I should mention that this datastore is currently "inactive" because it was removed from the storage array

get-datacenter "Data Center 1" | Get-VMHost | remove-datastore -Datastore (get-datastore -name Templates_ISOs" -Datacenter "Data Center 1") -confirm:$false

Remove-Datastore : 1/11/2013 9:16:53 AM    Remove-Datastore        A specified
parameter was not correct.

At line:1 char:75
+ get-datacenter "Data Center 1" | Get-VMHost | remove-datastore <<
<<  -Datastore (get-datastore -name "Templates_ISOs" -Datacenter "Data Center 1") -confirm:$false
    + CategoryInfo          : NotSpecified: (:) [Remove-Datastore], InvalidArg
   ument
    + FullyQualifiedErrorId : Client20_VmHostServiceImpl_RemoveDatastoreOfViOb
   ject_InvalidArgument,VMware.VimAutomation.ViCore.Cmdlets.Commands.RemoveDa
  tastore

http://www.twitter.com/markdjones82 | http://nutzandbolts.wordpress.com
0 Kudos
LucD
Leadership
Leadership
Jump to solution

That is most probably indeed due to its "inactive" status.

I suspect you will get a similar message when you try to remove such a datastore from the vSphere client.


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

0 Kudos