adminbd

Записи по mssql,oracle,windows и linux

Have a Question?

If you have any question you can ask below or enter what you are looking for!

Как посмотреть где лежать vhd, vhdx от вируалок hyper-v через powershell

Get-VM –ComputerName * | Get-VMHardDiskDrive | Select-Object -Property VMName, ComputerName, Path, Filesize, Size, Disktype, Snapshot | Sort-Object -Property VMName

 

$VMget=Get-VM -computername w01s007,w01s006,w01s008 | Get-VMHardDiskDrive | Select-Object -Property vmname, vmid, computername, controllertype, controllernumber,controllerlocation,path
 foreach ($VM in $VMget) {
    $VHDRemotePath=$VM.Path  -replace ":", "$"
    $VHDRemotePath="\\"+$VM.ComputerName+"\"+$VHDRemotePath
    $vhdsize=  gci $VHDRemotePath | select-object @{Name="SizeGB";Expression={"{0:N2}" -f ($_.length / 1GB)}}
    write-host = $VM.VMName " - " $vhdsize.SizeGB "GB - " $VM.Path
}
Get-VM –VMname * | Select-Object VMId | Get-VHD | ConvertTo-HTML –Property path,computername,vhdtype,
@{label=’Size(GB)’;expression={$_.filesize/1gb –as [int]}} > “C:\SimpleVHDReport.htm"

 

Get-VM –VMname * | Get-VMHardDiskDrive | ConvertTo-HTML –Property VMName, path,computername,vhdtype,@{label=’Size(GB)’;expression={$_.filesize/1gb –as [int]}} > “C:\SimpleVHDReport.htm"

Как посмотреть где лежать vhd, vhdx от вируалок hyper-v через powershell