The aim is to find the size of the file file once the path and file name is found.
I was abel to find the path [Datastore] fileName. What is the best way to find
the size once the file name and path is known. Thank you for all the help...Cheers !!
You can use the PowerCLI datastore provider to retrieve the size of a file on a datastore. The following PowerCLI code will retrieve the size (in bytes) of the file FreeNAS.vmx in folder FreeNAS on datastore vsanDatastore:
$Datastore = Get-Datastore -Name vsanDatastore
New-PSDrive -Location $Datastore -Name ds -PSProvider VimDatastore -Root "\"
Set-Location ds:
Get-ChildItem -Path FreeNAS\FreeNAS.vmx | Select-Object -Property Name,Length
You can use the PowerCLI datastore provider to retrieve the size of a file on a datastore. The following PowerCLI code will retrieve the size (in bytes) of the file FreeNAS.vmx in folder FreeNAS on datastore vsanDatastore:
$Datastore = Get-Datastore -Name vsanDatastore
New-PSDrive -Location $Datastore -Name ds -PSProvider VimDatastore -Root "\"
Set-Location ds:
Get-ChildItem -Path FreeNAS\FreeNAS.vmx | Select-Object -Property Name,Length