Hi Guys,
I'm hoping someone can help, i can't work out why this mini-script isn't working! Basically, i just want to remove a Datastore from all ESX Hosts in Virtualcenter and am trying to do this by;
$dsname = "ukdc228001:vmvol1 - Restore 01.09"
Script .....
Get-VC UKVIR09100
Get-VMHost | Remove-Datastore -Datastore (get-datastore -Name $dsname)
The first time i ran the script it deleted from the first host then failed. retrying it now brings up;
(default is "Y"):a
Remove-Datastore : 24/03/2009 17:20:32 Remove-Datastore 0FE195B3-76C4-475
4-9D41-94013BE2DCD0 A specified parameter was not correct.
At C:\Powershell\Add or Remove A Datastore\removedatastorefromallhosts.ps1:16 c
har:30
+ Get-VMHost | Remove-Datastore <<<< -Datastore (get-datastore -Name $dsname)
I'm assuming this is because the store no longer exists on the first host and so times out but not sure how to resolve this, maybe need some error (if exists) type checking but am a newbie!!!
Any help would be greatly appreciated as have several stores to remove from 60 hosts!!
Cheers,
Sean.