$strComputer="."; function DisplayHostname { $hostname = gc env:computername [System.Console]::WriteLine("Analyzing: " + $hostname ); } function DisplayBios { [System.Console]::WriteLine("BIOS Info"); $colItems = Get-WmiObject Win32_BIOS -Namespace "root\CIMV2" -computername $strComputer foreach($objItem in $colItems) { Write-Host "BIOS: " $objItem.Description Write-Host "Version: " $objItem.SMBIOSBIOSVersion"."` $objItem.SMBIOSMajorVersion"."$objItem.SMBIOSMinorVersion Write-Host "Serial Number: " $objItem.SerialNumber } [System.Console]::WriteLine(); } function DisplayHostHWInfo { $computer=get-wmiobject -class win32_computersystem [System.Console]::WriteLine("Host Info"); [System.Console]::WriteLine("Description=" +$computer.Description); [System.Console]::WriteLine("NumberOfProcessors="+ $computer.NumberOfProcessors); [System.Console]::WriteLine("NumberOfLogicalProcessors="+ $computer.NumberOfLogicalProcessors); [System.Console]::WriteLine("Model=" +$computer.Model); [System.Console]::WriteLine("Manufacturer=" +$computer.Manufacturer); [System.Console]::WriteLine("TotalPhysicalMemory=" + $computer.TotalPhysicalMemory); [System.Console]::WriteLine(); } function DisplayCPUInfo { $cpuinfo=get-wmiobject -class Win32_Processor [System.Console]::WriteLine("CPU Info"); foreach($objItem in $cpuinfo) { Write-Host "Processor: " $objItem.DeviceID $objItem.Name } Write-Host "" } function DisplayMyriStatus { $networkstatus = Get-WmiObject Win32_NetworkAdapter Write-Host "Myri-10G Status" foreach($objItem in $networkstatus) { if ($objItem.Description -match "Myri") { write-host "Description : " $objItem.Description Write-Host "MAC Address: " $objItem.MACAddress Write-Host "ErrorCode: " $objItem.ConfigManagerErrorCode } } } function DisplayNetworkAdapters { [System.Console]::WriteLine("Network Info"); $networkItems = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName $strComputer | where{$_.IPEnabled -eq "True"} foreach($objItem in $networkItems) { Write-host "Description : " $objItem.Description Write-Host "DHCP Enabled: " $objItem.DHCPEnabled Write-Host "IP Address: " $objItem.IPAddress Write-Host "Subnet Mask: " $objItem.IPSubnet Write-Host "Gateway: " $objItem.DefaultIPGateway Write-Host "MAC Address: " $objItem.MACAddress Write-Host "MTU: " $objItem.MTU Write-Host "TcpWindowSize: " $objItem.TcpWindowSize Write-Host "" } } function DisplayOSInfo { $OS=[environment]::osversion.Version.ToString(); $os2=get-wmiobject -class win32_operatingsystem $PName=(Get-Item "HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion").GetValue("ProductName"); $Edition=(Get-Item "HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion").GetValue("EditionID"); [System.Console]::WriteLine("OS Info"); [System.Console]::WriteLine($PName); [System.Console]::WriteLine($Edition); [System.Console]::WriteLine($OS); [System.Console]::WriteLine("Service Pack " + $os2.servicepackmajorversion); [System.Console]::WriteLine("Windows runs "+ $os2.OSArchitecture); [System.Console]::WriteLine("WindowsDirectory=" + $os2.WindowsDirectory); [System.Console]::WriteLine("PAEEnabled= " + $os2.PAEEnabled); [System.Console]::WriteLine(); } function DisplayEventLog { $SysEvent = get-EventLog -logname system -newest 2000 $SysError = $SysEvent |where {$_.entryType -match "Error"} $SysError | sort eventid | ` Format-Table EventID, Source, TimeWritten, Message -auto } function DisplayMX_Info{ if (Test-Path -Path .\mx_info.exe) { Write-Host "Running mx_info.exe" -Fore DarkGreen iex .\mx_info.exe } else { Write-Host " mx_info.exe file not found" -Fore Magenta } } function DisplayMyri_Info{ if (Test-Path -Path .\myri_info.exe) { Write-Host "Running myri_info.exe" -Fore DarkGreen iex .\myri_info.exe } else { Write-Host " myri_info.exe file not found" -Fore Magenta } } function DisplayMyri_Counters { if (Test-Path -Path .\myri_counters.exe) { Write-Host "Running myri_counters.exe" -Fore DarkGreen iex .\myri_counters.exe } else { Write-Host " myri_counters.exe file not found" -Fore Magenta } } function DisplayMyri10GE_Counters { if (Test-Path -Path .\lspci.exe) { Write-Host "Running myri10ge_counters.exe" -Fore DarkGreen iex .\myri10ge_counters.exe } else { Write-Host " myri10ge_counters.exe file not found" -Fore Magenta } } function DisplayMyri_LSPCI { if (Test-Path -Path .\lspci.exe) { Write-Host "Running lspci.exe" -Fore DarkGreen iex .\lspci.exe } else { Write-Host " lspci.exe file not found" -Fore Magenta } } function DisableFirewall { Write-Host "Trying to disable Firewall by calling " "'netsh firewall set opmode disable'" -Fore Yellow netsh firewall set opmode disable Write-Host "FireWall was Disabled on request" -Fore Red } function DisplayFirewallStatus { $firewallEnabled =(Get-Item "HKLM:System\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile").GetValue("EnableFirewall") netsh firewall show opmode Write-Host "FireWall Enabled DomainProfile " $firewallEnabled } function DisplayInterfaces { Write-Host "Analyzing all interfaces" netsh interface ipv4 show interfaces } function DisplayKernelDumpStatus { $CrashControl="HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl" $CrashProp=Get-ItemProperty $CrashControl $CrashNo=$CrashProp.CrashDumpEnabled Switch($CrashNo) { 0 { "Memory is NOT configured" } 1 { "Complete memory dump is configured" } 2 { "Kernel memory dump is configured"} 3 { "Small memory dump (64KB)"} } Write-host Dump file location $CrashProp.DumpFile $AutoNo=$CrashProp.AutoReboot If ($AutoNo -eq 0) { write-host Auto Reboot is not enabled } else {write-host AutoReboot is enabled} $CrashNo=$CrashProp.Overwrite If ($CrashNo -eq 0) { write-host Overwrite Memory dump option is not enabled } else { write-host Overwrite Memory dump is enabled } } DisplayHostname Write-Host "" if ($args.length -eq 0) { Write-Host "Performing Generic Host Analysis" -Fore Green DisplayBios DisplayHostHWInfo DisplayCPUInfo DisplayOSInfo DisplayNetworkAdapters Write-Host "" Write-Host "Performing Generic Analysis for Myri-10G" -Fore Green DisplayMyriStatus DisplayMyri_Info DisplayMyri10GE_Counters DisplayMyri_LSPCI DisplayMX_Info } if ($args.length -gt 0) { foreach ($arg in $args) { if ($arg -match "DisplayMTU") { DisplayInterfaces } if ($arg -match "kerneldump") { DisplayKernelDumpStatus } if ($arg -match "DisplayFirewall") { DisplayFirewallStatus } if ($arg -match "DisableFirewall") { DisableFirewall } if ($arg -match ".exe") { Write-Host "Calling diagnostic tool " $arg if (Test-Path -Path .\$arg) { Write-Host "Running " $arg -Fore DarkGreen iex .\$arg } else { Write-Host " " $arg "file not found" -Fore Magenta } } if ($arg -match "myri10ge") { Write-Host "Performing Analysis for Myri-10GE" DisplayBios DisplayHostHWInfo DisplayCPUInfo DisplayOSInfo DisplayNetworkAdapters DisplayMyriStatus DisplayMyri10GE_Counters } if ($arg -match "dbl") { Write-Host "Performing Analysis for DBL" DisplayBios DisplayHostHWInfo DisplayCPUInfo DisplayOSInfo DisplayNetworkAdapters DisplayMyriStatus DisplayMyri_Info } if ($arg -match "raw") { Write-Host "Performing Analysis for Raw Mode" DisplayBios DisplayHostHWInfo DisplayCPUInfo DisplayOSInfo DisplayNetworkAdapters DisplayMyriStatus DisplayMyri_Info DisplayMyri_LSPCI } if ($arg -match "EventLog") { Write-Host "Showing Event Errors" DisplayEventLog } } }