Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Dan1el42/8448a90332ba4c68b6d4a68a59300dcc to your computer and use it in GitHub Desktop.
Save Dan1el42/8448a90332ba4c68b6d4a68a59300dcc to your computer and use it in GitHub Desktop.
Clear-Host
$file = Get-Content -Path 'X' # List of Computers
$fileName = 'X' + (Get-Date -Format dd.MM.yyyy) + '.HTML'
foreach ($node in $file) {
$selectObjectProperties = @(
'SystemName'
'DeviceID'
@{
Label = "Total Size"
Expression = { $_.Size / 1gb -as [int] }
}
@{
Label = "Free Size"
Expression = { $_.FreeSpace / 1gb -as [int] }
}
)
Get-WmiObject -Class Win32_LogicalDisk -ComputerName $node |
Select-Object -Property $selectObjectProperties | ConvertTo-HTML |
Out-File -FilePath $filename -Append -NoClobber
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment