Find Linux VMs in VMware vsphere, PowerCLI, count

connect-viserver

(Get-VMguest * | Where-Object {$_.OSFullName -like “*Linux*” }).Count

get-vm |¬†where{$_.Guest.OSFullName -match ‘linux’} | select name

Advertisements

Find largest files and directories with PowerShell

gci . -r | sort Length -desc | select fullname -f 10

or
Get-ChildItem -Path 'C:\SomeFolder' -Recurse -Force -File | Select-Object -Property FullName,@{Name='SizeGB';Expression={$_.Length / 1GB}},@{Name='SizeMB';Expression={$_.Length / 1MB}},@{Name='SizeKB';Expression={$_.Length / 1KB}} | Sort-Object { $_.SizeKB } -Descending | Out-GridView