cwstad2
asked on
powershell where condition
Hi guys, i have the following code which worked until i tried to use the where condition. Im looking for only values less than 5 to be part of the output. i think im almost there. Any advice would be great
thanks
$Servers = Get-Content C:\Users\Downloads\exchang e.txt
foreach ( $Server1 in $Servers ) {
@"
$server1
"@
$disk = Get-WmiObject Win32_LogicalDisk -ComputerName $Server1 -Filter "DeviceID='C:'" |
Where-Object {$_.FreeSpace -lt "5"}
$disk.FreeSpace /1GB -as [int]
}
thanks
$Servers = Get-Content C:\Users\Downloads\exchang
foreach ( $Server1 in $Servers ) {
@"
$server1
"@
$disk = Get-WmiObject Win32_LogicalDisk -ComputerName $Server1 -Filter "DeviceID='C:'" |
Where-Object {$_.FreeSpace -lt "5"}
$disk.FreeSpace /1GB -as [int]
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Much better formatting thank you very much
ASKER