Get-NwSpeed_Get-SANinfo.ps1 (zpäť na zoznam)
Zisťovanie informácií o duplex nastaveniach a rýchlostiach sieťových kariet plus infromácie o diskoch a počte ciest na SAN úložisko.
$systemInfoNDM = Get-WmiObject Win32_ComputerSystem #info for hostname, domain, model name
$model = $systemInfoNDM.Model #VM - VMware Virtual Platform; Hyper-V - Virtual Machine
$hostname = hostname
function getInfo {
param($index)
$baseRegKey = "HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\00"
$speed = ((Get-WmiObject win32_networkadapter | Where-Object {$_.deviceID -eq $index}).speed)/1000000
$id = $index.toString()
if ($id.length -eq 1) {
$deviceID = "0" + $id
}
else {
$deviceID = $id
}
$regKey = $baseRegKey + $deviceID + "\"
$duplexSettings = Get-ItemProperty $regKey | Select-Object -Property *speedduplex
if ($duplexSettings -match "0") {
$duplex = "auto"
}
if ($duplexSettings -match "1") {
$duplex = "10m/h"
}
if ($duplexSettings -match "2") {
$duplex = "10m/f"
}
if ($duplexSettings -match "3") {
$duplex = "100m/h"
}
if ($duplexSettings -match "4") {
$duplex = "100m/f"
}
if ($duplexSettings -match "5") {
$duplex = "1g/h"
}
if ($duplexSettings -match "6") {
$duplex = "1g/f"
}
if ($duplexSettings -match "7") {
$duplex = "10g/f"
}
write-host $hostname";"$duplex";"$speed" Mb"
}
if ($model -match "VMware") {
$indexes = (Get-WmiObject -Class Win32_NetworkAdapterConfiguration | Where-Object {($_.description -match "Intel|vmxnet3")}).Index
if ($indexes -is [system.array]) {
for ($i = 0; $i -lt $indexes.length;$i++) {
getInfo $indexes[$i]
}
}
else {
getInfo $indexes
}
}
else {
$devicesInTeam = Get-WmiObject -class "HP_EthernetTeamMember" -namespace "root\HPQ" #list of devices in team
$deviceIDs = @()
foreach ($device in $devicesInTeam) {
$deviceMember = $device.member.split("`"")
$deviceIDs += $deviceMember[1]
}
foreach ($deviceID in $deviceIDs) {
$deviceInfo = Get-WmiObject -class "HP_EthernetPort " -namespace "root\HPQ" | Where-Object {$_.DeviceID -match $deviceID}
$fullDuplex = $deviceInfo.FullDuplex
$speed = ($deviceInfo.Speed)/1000000
write-host $hostname";"$fullDuplex";"$speed" Mb"
}
write-host "`r"
$mpclaim = Invoke-expression -command "mpclaim -s -d" | Where-Object {$_ -match "Microsoft DSM"}
$numOfDisks = $mpclaim.length
for ($i = 0; $i -lt $mpclaim.length;$i++) {
$paths = Invoke-Expression -command "mpclaim -s -d $i"
$diskID = $paths[2].split(":")
$pathInfo1 = $paths[16].split(" ")
$pathInfo2 = $paths[22].split(" ")
write-host $hostname ";" $diskID[0] ";" $pathInfo1[4] ";" $pathInfo1[5]
write-host $hostname ";" $diskID[0] ";" $pathInfo2[4] ";" $pathInfo2[5]
}
}