-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy path26_2.ps1
More file actions
27 lines (27 loc) · 865 Bytes
/
26_2.ps1
File metadata and controls
27 lines (27 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function Get-DiskInfo {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True,
ValueFromPipeline=$True)]
[string[]]$ComputerName
)
BEGIN {
Set-StrictMode -Version 2.0
}
PROCESS {
ForEach ($comp in $ComputerName) {
$params = @{'ComputerName' = $comp
'ClassName' = 'Win32_LogicalDisk'}
$disks = Get-CimInstance @params
ForEach ($disk in $disks) {
$props = @{'ComputerName' = $comp
'Size' = $disk.size
'Drive' = $disk.deviceid
'FreeSpace' = $disk.freespace
'DriveType' = $disk.drivetype}
New-Object -TypeName PSObject -Property $props
} #foreach disk
} #foreach computer
} #PROCESS
END {}
}