VMware Cloud Community
fborges555
Enthusiast
Enthusiast
Jump to solution

reclaim storage

HI

I am reclaiming storage at this point doing the following

ssh to the esxi

and run esxcli storage vmfs unmap -l DS

can I accomplish the same using PSC to connect to the esxi host and run that command and not SSH to it

I can connect to the esxi by  connect-viserver but I dont know how to run the esxcli storage vmfs unmap -l DS from within Powershell cli

Thanks for any help

0 Kudos
20 Replies
LucD
Leadership
Leadership
Jump to solution

You could loop over all the datastores.

Get-Datastore -PipelineVariable ds |
  ForEach-Object -Process {
    $esx = Get-VMHost -Datastore $ds | select -First 1
    $esxcli = Get-EsxCli -VMHost $esx -V2
    $argHash = @{
      volumelabel = $ds.Name
    }

    $esxcli.storage.vmfs.unmap.Invoke($argHash)
  }


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

0 Kudos