#invoca modulo de AD
import-module activedirectory
#lista del AD los equipos "Windows Server"
$Servidores = Get-ADComputer -Filter {OperatingSystem -Like "Windows Server *"} -Property OperatingSystem
foreach ($ElServidor in $Servidores) {
if (test-connection -computername $ElServidor.name -erroraction SilentlyContinue) {
$b += Get-WmiObject -class Win32_LogicalDisk -ComputerName $ElServidor.name | Select-Object -Property @{n='Hostname';e={$ElServidor.name}},@{n='SisOp';e={$ElServidor.OperatingSystem}},@{n='Drive';e={$_.DeviceID}},@{n='Size(GB)';e={$_.Size / 1GB -as [int]}},@{n='FreeSpace(GB)';e={$_.FreeSpace / 1GB -as [int]}}
} else {
}
}
$b | Export-CSV -path ListadoEspacioServers.csv -NoTypeInformation
import-module activedirectory
#lista del AD los equipos "Windows Server"
$Servidores = Get-ADComputer -Filter {OperatingSystem -Like "Windows Server *"} -Property OperatingSystem
foreach ($ElServidor in $Servidores) {
if (test-connection -computername $ElServidor.name -erroraction SilentlyContinue) {
$b += Get-WmiObject -class Win32_LogicalDisk -ComputerName $ElServidor.name | Select-Object -Property @{n='Hostname';e={$ElServidor.name}},@{n='SisOp';e={$ElServidor.OperatingSystem}},@{n='Drive';e={$_.DeviceID}},@{n='Size(GB)';e={$_.Size / 1GB -as [int]}},@{n='FreeSpace(GB)';e={$_.FreeSpace / 1GB -as [int]}}
} else {
}
}
$b | Export-CSV -path ListadoEspacioServers.csv -NoTypeInformation