$keyword = 'Off'
$vms = Get-VM | Where-Object { $_.Name -like "*$keyword*" }
if (-not $vms) {
Write-Host "找不到 VM 名稱包含 '$keyword' 的虛擬機。" -ForegroundColor Yellow
return
}
$vmResults = @()
$grandTotalBytes = 0
foreach ($vm in $vms) {
$hdds = Get-VMHardDiskDrive -VMName $vm.Name -ErrorAction SilentlyContinue
if (-not $hdds) {
$vmResults += [pscustomobject]@{
VMName = $vm.Name
VhdCount = 0
TotalSizeGB = 0.0
Detail = "<無掛載虛擬硬碟>"
}
continue
}
無掛載虛擬硬碟>
2026-03-06
Get VM's Virtual Hard Disk Size with Keyword
2026-03-05
在 Windows 下讓 del 有個 alias name: rm
在 Windows 下讓 del 指令有個 alias name: rm
方法:
- 建立 C:\Windows\System32\rm.cmd
- 內容:
@echo off
del %*
結果: c:\> rm a.txt
等於: c:\> del a.txt
訂閱:
意見 (Atom)