Learning the Disk capacities of the computers on the network via Powershell

Learning the Disk capacities of the computers on the network via Powershell

#powershell #Windows #Disksize


The Powershell Script below is used.


$servers = @("10.111.1.51", "10.111.1.53", "10.111.1.54")

Foreach ($server in $servers)

{

??$disks = Get-WmiObject Win32_LogicalDisk -ComputerName $server -Filter DriveType=3 |?

????Select-Object DeviceID,?

??????@{'Name'='Size'; 'Expression'={[math]::truncate($_.size / 1GB)}},?

??????@{'Name'='Freespace'; 'Expression'={[math]::truncate($_.freespace / 1GB)}}

$server

foreach ($disk in $disks)

??{

????$disk.DeviceID + $disk.FreeSpace.ToString("N0") + "GB / " + $disk.Size.ToString("N0") + "GB"

}

?}


要查看或添加评论,请登录

R?dvan Murteza的更多文章

  • Kubernetes

    Kubernetes

    Kubernetes ;is an open-source container orchestration system for automating software deployment, scaling, and…

  • RDP Authentication Error: CredSSP Encryption Oracle Remediation

    RDP Authentication Error: CredSSP Encryption Oracle Remediation

    Run the local GPO editor: gpedit.msc; Go to the GPO section Computer Configuration -> Administrative Templates ->…

社区洞察

其他会员也浏览了