Hi all
I am using this command to rescan all host HBAs
get-vmhost | Get-VMHostStorage -RescanAllHBA
just one question does this scan with the "Scan for New VMFS Volume" ticked ???
I dont want to scan for VMFS volume !!
Cheers
_M,
In the above script, the CapacityGB is VMDKFile's capacity.
I am thinking about your new script request. But I don't know how to match the VM's harddisks and the guest disks yet. I'm trying to understand the peetersonline.nl blogpost, but it is not easy. And that script doesn't work in my environment either.
Robert
Thanks Robert.
By the way how do I get the Cluster information for all the VMHosts in the VI environment? Could you help me with the code for that?
-M
The next script gives you the clustername for all hosts in your VMware environment:
Get-View -ViewType HostSystem | ` ForEach-Object { $Report = "" | Select-Object VMHost,Cluster $Report.VMHost = $_.Name $Report.Cluster = ($_.Parent | Get-VIObjectByViView).Name $Report }
Regards, Robert
Thanks MUCH Robert.
By the way I ran the code avaible from petersonline.nl with appropriate permission. It requires Datastore.Browse” privilege to perform operation on “SearchDatastoreSubFolders_Task”. See the last line on page 184 of the “VI SDK Programming Guide” document for further information
Hi Robert,
<code>$VMHosts = Get-VMHost $Datastores = $VMHosts | Get-Datastore $VMHostStorage = $VMHosts | ForEach-Object { $VMHost = $_.Name $_ | Get-VMHostStorage | ` Select-Object -expandProperty FileSystemVolumeInfo | ` ForEach-Object { $VMHostStorageName = $_.Name Add-Member -InputObject $_ -MemberType NoteProperty -Name FreeSpaceMB -Value ($Datastores | Where-Object {$_.Name -eq $VMHostStorageName}).FreeSpaceMB -PassThru | ` Add-Member -MemberType NoteProperty -Name HostName -Value $VMHost -PassThru } } $VMHostStorage | Format-Table -property HostName,Name,AccessMode,Type,Capacity,FreeSpaceMB,Path -AutoSize </code>
The above code prompts for inputs when run. I do not want that and want the script to run silently and get me the output. How do I do that?
Thanks
M