#NoTrayIcon
#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=Computer-Info2.0\prog.ico
#AutoIt3Wrapper_outfile=Computer-Info_v1.8.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Language=1031
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/striponly
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#Region ;**** Directive erstellt von AutoIt3Wrapper_GUI ****
#EndRegion ;**** Directive erstellt von AutoIt3Wrapper_GUI ****

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <String.au3>
#include <Date.au3>
#include <Inet.au3>
#include <Misc.au3>

Opt('GUIOnEventMode', 1)
Global $Title = ' Computer-Info v1.8'
Global $s_MailTo = 'you@yourprovider.de' ; E-Mail-Adresse, an die der Bericht geschickt wird. (anpassen!)
Global $s_MailSubject = 'Computer-Info von ' & @UserName ; Das wird als Betreff verwendet. (evtl. anpassen!)
Global $ret
$ret = DllCall('kernel32.dll', 'int', 'GetLocaleInfo', 'dword', '0x' & @OSLang, 'dword', BitOR(0x2, 0x80000000), 'str', '', 'int', 85)
Global $OSLang = $ret[3]
$ret = DllCall('kernel32.dll', 'int', 'GetLocaleInfo', 'dword', '0x' & @KBLayout, 'dword', BitOR(0x2, 0x80000000), 'str', '', 'int', 85)
Global $KBLayout = $ret[3]
Global $Bin = RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'DigitalProductID')

Global $Gui = GUICreate($Title, 600, 480, Default, 25, BitOR($WS_MAXIMIZEBOX, $WS_SIZEBOX))
GUISetOnEvent($GUI_EVENT_CLOSE, '_End')
If FileExists(@ScriptDir & '\prog.ico') Then
	GUISetIcon(@ScriptDir & '\prog.ico', -1)
Else
	GUISetIcon('shell32.dll', -13)
EndIf
Global $Edit = GUICtrlCreateEdit(@CRLF & '    Bitte warten...', 5, 5, 585, 400, BitOR($ES_READONLY, $WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)
;GUICtrlSetBkColor(-1, 0xffffff),ffffcc9=hellgelb;C0C0C0=hellgrau
GUICtrlSetBkColor(-1, 0xe1fffe)
Global $Send = GUICtrlCreateButton('Bericht mailen...', 5, 420, 120, 25)
GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetOnEvent(-1, '_Send')
GUICtrlSetTip($Send, "Den Bericht über Mail versenden, Mailprogramm muß vorher schon konfiguriert sein!")
Global $Save = GUICtrlCreateButton('Bericht speichern...', 258, 420, 120, 25)
GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetOnEvent(-1, '_Save')
GUICtrlSetTip($Save, "Den Bericht in einer Textdatei im gleichen Ordner abspeichern.")
Global $End = GUICtrlCreateButton('Beenden', 510, 420, 80, 25)
GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE)
GUICtrlSetState(-1, $GUI_FOCUS)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetOnEvent(-1, '_End')
GUICtrlSetTip($End, "Das Programm jetzt Beenden.")
WinMove($Title, '', Default, Default, 600, @DesktopHeight - 80)

GUISetState()

Global $colItems = '', $Output = '', $objItem
$Output &= $Title & ' (c) Programm by Oscar (www.autoit.de)' & @CRLF & @CRLF
$Output &= 'Heutiges Datum:   ' & @TAB & _NowDate() & '   ' & _NowTime() & @CRLF & @CRLF
$Output &= @CRLF & '[ ~ Betriebssystem ~ ]' & @CRLF
$Output &= '==============================================================' & @CRLF
Global $objWMIService = ObjGet('winmgmts:\\localhost\root\CIMV2')

GUICtrlSetData($Edit, '    Bitte warten...' & @CRLF & @CRLF & '    Win32_Desktop')
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_Desktop', 'WQL', 0x30)
If IsObj($colItems) Then
	For $objItem In $colItems
		If StringInStr($objItem.Name, @UserName) Then
			$Wallpaper = 'Hintergrundbild:   ' & @TAB & _Iif($objItem.Wallpaper <> '', $objItem.Wallpaper, 'Nicht vorhanden!') & @CRLF & @CRLF
			$ScreenSaver = 'Bildschirmschoner: ' & @TAB & _Iif($objItem.ScreenSaverExecutable <> '', $objItem.ScreenSaverExecutable, 'Nicht vorhanden!') & @CRLF
		EndIf
	Next
Else
	$Output &= 'Keine WMI-Objekte gefunden für die class: Win32_Desktop' & @CRLF & @CRLF
EndIf

GUICtrlSetData($Edit, '    Bitte warten...' & @CRLF & @CRLF & '    nslookup')
RunWait(@ComSpec & " /c " & "nslookup localhost >" & Chr(34) & @TempDir & "\cominfo.txt" & Chr(34), "", @SW_HIDE)
$DNSServer = StringReplace(FileReadLine(@TempDir & "\cominfo.txt", 1), 'Server: ', 'DNS-Server:   ' & @TAB)
$IPAdress = StringReplace(FileReadLine(@TempDir & "\cominfo.txt", 2), 'Address: ', ' (IP: ')
$DNSServer &= $IPAdress & ')'
FileDelete(@TempDir & "\cominfo.txt")

GUICtrlSetData($Edit, '    Bitte warten...' & @CRLF & @CRLF & '    Win32_ComputerSystem')
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_ComputerSystem', 'WQL', 0x30)
If IsObj($colItems) Then
	For $objItem In $colItems
		$System = 'Computer:       ' & @TAB & $objItem.SystemType & @CRLF
		$Domain = 'Arbeitsgruppe:  ' & @TAB & $objItem.Domain & @CRLF
		$StartOpt = 'Start-Optionen:    ' & @TAB & $objItem.SystemStartupOptions(0) & @CRLF & @CRLF
	Next
Else
	$Output &= 'Keine WMI-Objekte gefunden für die class: Win32_ComputerSystem'
EndIf

GUICtrlSetData($Edit, '    Bitte warten...' & @CRLF & @CRLF & '    Win32_OperatingSystem')
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_OperatingSystem', 'WQL', 0x30)
If IsObj($colItems) Then
	For $objItem In $colItems
		$Output &= $objItem.Caption & ' ('
		$Output &= $objItem.CreationClassName & ')' & @CRLF
		$Output &= 'inkl. ' & $objItem.CSDVersion & '   ('
		$Output &= 'Version: ' & $objItem.Version & ')' & @CRLF & @CRLF
		$Output &= 'Reg. Benutzer:     ' & @TAB & $objItem.RegisteredUser & @CRLF
		$Output &= $System
		$Output &= 'Computersystem:    ' & @TAB & $objItem.CSCreationClassName & @CRLF
		$Output &= 'Sprachversion:     ' & @TAB & $OSLang & @CRLF
		$Output &= 'Produktkey:        ' & @TAB & _ProdKey($Bin) & @CRLF
		$Output &= $StartOpt
		$Output &= 'Windows-Ordner:    ' & @TAB & $objItem.WindowsDirectory & @CRLF
		$Output &= 'Installationsdatum:' & @TAB & _WMIDateStringToDate($objItem.InstallDate) & @CRLF
		$Output &= 'Zuletzt gestartet: ' & @TAB & _WMIDateStringToDate($objItem.LastBootUpTime) & @CRLF & @CRLF
		$aMemory = MemGetStats()
		$Output &= 'Hauptspeicher      ' & @CRLF
		$Output &= '    (Gesamt):      ' & @TAB & _DisplayMemorySize($aMemory[1]) & @CRLF
		$Output &= '      (Frei):      ' & @TAB & _DisplayMemorySize($aMemory[2]) & @CRLF
		$Output &= 'Auslagerungsdatei  ' & @CRLF
		$Output &= '    (Gesamt):      ' & @TAB & _DisplayMemorySize($aMemory[5]) & @CRLF
		$Output &= '      (Frei):      ' & @TAB & _DisplayMemorySize($aMemory[6]) & @CRLF & @CRLF
	Next
Else
	$Output &= 'Keine WMI-Objekte gefunden für die class: Win32_OperatingSystem' & @CRLF & @CRLF
EndIf

GUICtrlSetData($Edit, '    Bitte warten...' & @CRLF & @CRLF & '    Win32_UserAccount')
$Output &= @CRLF & '[ ~ Benutzerkonten ~ ]' & @CRLF
$Output &= '==============================================================' & @CRLF
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_UserAccount', 'WQL', 0x30)
If IsObj($colItems) Then
	For $objItem In $colItems
		If $objItem.Status = 'OK' Then
			$Output &= '             Name:' & @TAB & $objItem.Name & @CRLF
			$Output &= '     Beschreibung:' & @TAB & _Iif($objItem.Description <> '', $objItem.Description, 'Nicht vorhanden!') & @CRLF
			$Output &= 'Passwort benötigt:' & @TAB & _Iif($objItem.PasswordRequired = -1, 'Ja', 'Nein') & @CRLF
			$Output &= '         änderbar:' & @TAB & _Iif($objItem.PasswordChangeable = -1, 'Ja', 'Nein') & @CRLF
			$Output &= '         läuft ab:' & @TAB & _Iif($objItem.PasswordExpires = -1, 'Ja', 'Nein') & @CRLF & @CRLF
		EndIf
	Next
Else
	$Output &= 'Keine WMI-Objekte gefunden für die class: Win32_UserAccount' & @CRLF & @CRLF
EndIf

GUICtrlSetData($Edit, '    Bitte warten...' & @CRLF & @CRLF & '    Win32_PhysicalMemory')
$Output &= @CRLF & '[ ~ Hauptspeicher (RAM) ~ ]' & @CRLF
$Output &= '==============================================================' & @CRLF
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_PhysicalMemory', 'WQL', 0x30)
If IsObj($colItems) Then
	For $objItem In $colItems
		$Output &= 'Belegung:       ' & @TAB & $objItem.BankLabel & @CRLF
		$Output &= 'Kapazität:      ' & @TAB & _DisplayMemorySize($objItem.Capacity / 1024) & @CRLF
		$Output &= 'Bandbreite:     ' & @TAB & $objItem.DataWidth & ' Bit' & @CRLF
		$Output &= 'Steckplatz:     ' & @TAB & $objItem.DeviceLocator & @CRLF
		$Output &= 'FormFaktor:     ' & @TAB & $objItem.FormFactor & @CRLF
		$Output &= 'Geschwindigkeit:' & @TAB & $objItem.Speed & ' MHz' & @CRLF & @CRLF
	Next
Else
	$Output &= 'Keine WMI-Objekte gefunden für die class: Win32_PhysicalMemory' & @CRLF & @CRLF
EndIf

GUICtrlSetData($Edit, '    Bitte warten...' & @CRLF & @CRLF & '    Win32_CacheMemory')
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_CacheMemory', 'WQL', 0x30)
Global $Cache
If IsObj($colItems) Then
	For $objItem In $colItems
		$Cache &= 'Speicher:     ' & @TAB & $objItem.Purpose & '   (' & $objItem.InstalledSize & ' KB)' & @CRLF
	Next
Else
	$Cache &= 'Keine WMI-Objekte gefunden für die class: Win32_CacheMemory' & @CRLF & @CRLF
EndIf

GUICtrlSetData($Edit, '    Bitte warten...' & @CRLF & @CRLF & '    Win32_Prozessor')
$Output &= @CRLF & '[ ~ Prozessor(en) ~ ]' & @CRLF
$Output &= '==============================================================' & @CRLF
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_Processor', 'WQL', 0x30)
If IsObj($colItems) Then
	For $objItem In $colItems
		$Output &= 'Name:         ' & @TAB & $objItem.Name & @CRLF
		$Output &= 'CPU-Kerne:    ' & @TAB & GetCPUCores() & @CRLF
		$Output &= 'Prozessor:    ' & @TAB & $objItem.DeviceID & @CRLF
		$Output &= 'Sockel:       ' & @TAB & $objItem.SocketDesignation & @CRLF
		$Output &= 'Taktfrequenz: ' & @TAB & $objItem.CurrentClockSpeed & ' MHz' & @CRLF
		$Output &= $Cache & @CRLF
	Next
Else
	$Output &= 'Keine WMI-Objekte gefunden für die class: Win32_Processor' & @CRLF & @CRLF
EndIf

GUICtrlSetData($Edit, '    Bitte warten...' & @CRLF & @CRLF & '    Win32_BaseBoard')
$Output &= @CRLF & '[ ~ Mainboard ~ ]' & @CRLF
$Output &= '==============================================================' & @CRLF
Local $x = 1, $sExtConnector = '', $sIntConnector = '', $sTmp
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_PortConnector', 'WQL', 0x30)
If IsObj($colItems) Then
	For $objItem In $colItems
		$sTmp = $objItem.ExternalReferenceDesignator
		If StringLen($sTmp) > 1 Then
			$sExtConnector &= $sTmp & ' ** '
			ContinueLoop
		EndIf
		$sTmp = $objItem.InternalReferenceDesignator
		If StringLen($sTmp) > 1 Then $sIntConnector &= $sTmp & ' ** '
	Next
EndIf
$sExtConnector = StringTrimRight($sExtConnector, 4)
$sIntConnector = StringTrimRight($sIntConnector, 4)
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_BaseBoard', 'WQL', 0x30)
If IsObj($colItems) Then
	For $objItem In $colItems
		$Output &= 'Hersteller:     ' & @TAB & $objItem.Manufacturer & @CRLF
		$Output &= 'Produkt:        ' & @TAB & $objItem.Product & @CRLF
		$Output &= 'Version:        ' & @TAB & $objItem.Version & @CRLF
		$Output &= 'Seriennummer:   ' & @TAB & $objItem.SerialNumber & @CRLF
		$Output &= 'Int. Anschlüsse:' & @TAB & $sIntConnector & @CRLF
		$Output &= 'Ext. Anschlüsse:' & @TAB & $sExtConnector & @CRLF & @CRLF
	Next
Else
	$Output &= 'Keine WMI-Objekte gefunden für die class: Win32_BaseBoard' & @CRLF & @CRLF
EndIf

GUICtrlSetData($Edit, '    Bitte warten...' & @CRLF & @CRLF & '    Win32_DiskDrive')
$Output &= @CRLF & '[ ~ Festplatte(n) ~ ]' & @CRLF
$Output &= '==============================================================' & @CRLF
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_DiskDrive', 'WQL', 0x30)
If IsObj($colItems) Then
	For $objItem In $colItems
		$Output &= 'Bezeichnung: ' & @TAB & $objItem.Model & @CRLF
		$Output &= 'Größe:       ' & @TAB & _DisplayMemorySize($objItem.Size / 1024) & @CRLF
		$Output &= 'Anschluss:   ' & @TAB & $objItem.InterfaceType & @CRLF
		$Output &= 'Bytes/Sektor:' & @TAB & $objItem.BytesPerSector & @CRLF
		$Output &= 'PNPDeviceID: ' & @TAB & $objItem.PNPDeviceID & @CRLF
		$Output &= 'Status:      ' & @TAB & $objItem.Status & @CRLF & @CRLF
	Next
Else
	$Output &= 'Keine WMI-Objekte gefunden für die class: Win32_DiskDrive' & @CRLF & @CRLF
EndIf

GUICtrlSetData($Edit, '    Bitte warten...' & @CRLF & @CRLF & '    Win32_VideoController')
$Output &= @CRLF & '[ ~ Grafikkarte(n) ~ ]' & @CRLF
$Output &= '==============================================================' & @CRLF
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_VideoController', 'WQL', 0x30)
If IsObj($colItems) Then
	For $objItem In $colItems
		$strAcceleratorCapabilities = $objItem.AcceleratorCapabilities(0)
		$Output &= 'Hersteller:        ' & @TAB & $objItem.AdapterCompatibility & @CRLF
		$Output &= 'Beschreibung:      ' & @TAB & $objItem.Description & @CRLF
		$Output &= 'RAMDAC:            ' & @TAB & $objItem.AdapterDACType & @CRLF
		$Output &= 'Grafikkarten-RAM:  ' & @TAB & _DisplayMemorySize($objItem.AdapterRAM / 1024) & @CRLF
		$Output &= 'Horiz.  Auflösung: ' & @TAB & $objItem.CurrentHorizontalResolution & @CRLF
		$Output &= 'Vertik. Auflösung: ' & @TAB & $objItem.CurrentVerticalResolution & @CRLF
		$Output &= 'Bits/Pixel:        ' & @TAB & $objItem.CurrentBitsPerPixel & @CRLF
		$Output &= 'Anzahl der Farben: ' & @TAB & _StringAddThousandsSep($objItem.CurrentNumberOfColors, '.', ',') & @CRLF
		$Output &= 'TreiberVersion:    ' & @TAB & $objItem.DriverVersion & @CRLF
		$Output &= 'Treiberdatum:      ' & @TAB & _WMIDateStringToDate($objItem.DriverDate) & @CRLF & @CRLF
	Next
Else
	$Output &= 'Keine WMI-Objekte gefunden für die class: Win32_VideoController' & @CRLF & @CRLF
EndIf

GUICtrlSetData($Edit, '    Bitte warten...' & @CRLF & @CRLF & '    Win32_SoundDevice')
$Output &= @CRLF & '[ ~ Soundkarte(n) ~ ]' & @CRLF
$Output &= '==============================================================' & @CRLF
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_SoundDevice', 'WQL', 0x30)
If IsObj($colItems) Then
	For $objItem In $colItems
		$Output &= 'Hersteller: ' & @TAB & $objItem.Manufacturer & @CRLF
		$Output &= 'Name:       ' & @TAB & $objItem.Name & @CRLF
		$Output &= 'PNPDeviceID:' & @TAB & $objItem.PNPDeviceID & @CRLF & @CRLF
	Next
Else
	$Output &= 'Keine WMI-Objekte gefunden für die class: Win32_SoundDevice' & @CRLF & @CRLF
EndIf

GUICtrlSetData($Edit, '    Bitte warten...' & @CRLF & @CRLF & '    Win32_Keyboard')
$Output &= @CRLF & '[ ~ Tastatur(en) ~ ]' & @CRLF
$Output &= '==============================================================' & @CRLF
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_Keyboard', 'WQL', 0x30)
If IsObj($colItems) Then
	For $objItem In $colItems
		$Output &= 'Tastatur-Typ:  ' & @TAB & $objItem.CreationClassName & @CRLF
		$Output &= 'Tastenbelegung:' & @TAB & $KBLayout & @CRLF
		$Output &= 'Anschluss:     ' & @TAB & $objItem.Description & @CRLF
		$Output &= 'Name:          ' & @TAB & $objItem.Name & @CRLF
		$Output &= 'F-Tastenanzahl:' & @TAB & $objItem.NumberOfFunctionKeys & @CRLF & @CRLF
	Next
Else
	$Output &= 'Keine WMI-Objekte gefunden für die class: Win32_Keyboard' & @CRLF & @CRLF
EndIf

GUICtrlSetData($Edit, '    Bitte warten...' & @CRLF & @CRLF & '    Win32_PointingDevice')
$Output &= @CRLF & '[ ~ Mäuse ~ ]' & @CRLF
$Output &= '==============================================================' & @CRLF
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_PointingDevice', 'WQL', 0x30)
If IsObj($colItems) Then
	For $objItem In $colItems
		$Output &= 'Hersteller:  ' & @TAB & $objItem.Manufacturer & @CRLF
		$Output &= 'Name:        ' & @TAB & $objItem.Name & @CRLF
		$Output &= 'Tastenanzahl:' & @TAB & $objItem.NumberOfButtons & @CRLF & @CRLF
	Next
Else
	$Output &= 'Keine WMI-Objekte gefunden für die class: Win32_PointingDevice' & @CRLF & @CRLF
EndIf

GUICtrlSetData($Edit, '    Bitte warten...' & @CRLF & @CRLF & '    Win32_Printer')
$Output &= @CRLF & '[ ~ Drucker ~ ]' & @CRLF
$Output &= '==============================================================' & @CRLF
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_Printer', 'WQL', 0x30)
If IsObj($colItems) Then
	For $objItem In $colItems
		$Output &= 'Name:              ' & @TAB & _Iif($objItem.Name <> '', $objItem.Name, 'Kein Eintrag!') & @CRLF
		$Output &= 'TreiberName:       ' & @TAB & $objItem.DriverName & @CRLF
		$Output &= 'Anschluss:         ' & @TAB & $objItem.PortName & @CRLF
		$Output &= 'Horiz.  Auflösung: ' & @TAB & $objItem.HorizontalResolution & @CRLF
		$Output &= 'Vertik. Auflösung: ' & @TAB & $objItem.VerticalResolution & @CRLF & @CRLF
	Next
Else
	$Output &= 'Keine WMI-Objekte gefunden für die class: Win32_Printer' & @CRLF & @CRLF
EndIf

GUICtrlSetData($Edit, '    Bitte warten...' & @CRLF & @CRLF & '    Win32_LogicalDisk')
$Output &= @CRLF & '[ ~ Logische Laufwerke ~ ]' & @CRLF
$Output &= '==============================================================' & @CRLF
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_LogicalDisk', 'WQL', 0x30)
If IsObj($colItems) Then
	For $objItem In $colItems
		$Output &= 'Laufwerk:          ' & @TAB & $objItem.Name & @CRLF
		$Output &= 'Beschreibung:      ' & @TAB & $objItem.Description & @CRLF
		If $objItem.Description = 'Netzwerkverbindung:' Then
			$Output &= 'Netzwerkpfad:      ' & @TAB & $objItem.ProviderName & @CRLF
		EndIf
		$Output &= 'Größe:             ' & @TAB & _DisplayMemorySize($objItem.Size / 1024) & @CRLF
		$Output &= 'Freier Speicher:   ' & @TAB & _DisplayMemorySize($objItem.FreeSpace / 1024) & @CRLF
		$Output &= 'DateiSystem:       ' & @TAB & $objItem.FileSystem & @CRLF
		$Output &= 'Datenträger:       ' & @TAB & _Iif($objItem.VolumeName <> '', $objItem.VolumeName, 'Kein Datenträger eingelegt!') & @CRLF
		$Output &= 'Seriennummer:      ' & @TAB & $objItem.VolumeSerialNumber & @CRLF & @CRLF
	Next
Else
	$Output &= 'Keine WMI-Objekte gefunden für die class: Win32_LogicalDisk' & @CRLF & @CRLF
EndIf

GUICtrlSetData($Edit, '    Bitte warten...' & @CRLF & @CRLF & '    Win32_CDROMDrive')
$Output &= @CRLF & '[ ~ CD-/DVD-ROM-Laufwerk(e) ~ ]' & @CRLF
$Output &= '==============================================================' & @CRLF
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_CDROMDrive', 'WQL', 0x30)
If IsObj($colItems) Then
	For $objItem In $colItems
		$Output &= 'Laufwerk:    ' & @TAB & $objItem.Drive & @CRLF
		$Output &= 'Bezeichnung: ' & @TAB & $objItem.Name & @CRLF
		$Output &= 'PNPDeviceID: ' & @TAB & $objItem.PNPDeviceID & @CRLF
		$Output &= 'Status:      ' & @TAB & $objItem.Status & @CRLF & @CRLF
	Next
Else
	$Output &= 'Keine WMI-Objekte gefunden für die class: Win32_CDROMDrive' & @CRLF & @CRLF
EndIf

GUICtrlSetData($Edit, '    Bitte warten...' & @CRLF & @CRLF & '    Win32_SystemSlot')
$Output &= @CRLF & '[ ~ Steckplätze für Erweiterungskarten ~ ]' & @CRLF
$Output &= '==============================================================' & @CRLF
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_SystemSlot', 'WQL', 0x30)
If IsObj($colItems) Then
	For $objItem In $colItems
		$Output &= 'Bezeichnung:       ' & @TAB & $objItem.SlotDesignation & @CRLF
		$Output &= 'Steckplatz belegt: ' & @TAB & _Iif($objItem.CurrentUsage = 4, 'Ja', 'Nein') & @CRLF & @CRLF
	Next
Else
	$Output &= 'Keine WMI-Objekte gefunden für die class: ' & 'Win32_SystemSlot' & @CRLF & @CRLF
EndIf

GUICtrlSetData($Edit, '    Bitte warten...' & @CRLF & @CRLF & '    Win32_OperatingSystem')
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_OperatingSystem', 'WQL', 0x30)
If IsObj($colItems) Then
	For $objItem In $colItems
		$Output &= @CRLF & '[ ~ Netzwerk ~ ]' & @CRLF
		$Output &= '==============================================================' & @CRLF
		$Output &= 'Benutzername:      ' & @TAB & @UserName & @CRLF
		$Output &= 'Computername:      ' & @TAB & $objItem.CSName & '   ('
		$Output &= $objItem.Description & ')' & @CRLF
		$Output &= $Domain & @CRLF
		$IP = _GetIP()
		$Output &= 'Internet-IP:       ' & @TAB & _Iif($IP <> -1, $IP, 'IP-Test fehlgeschlagen!') & @CRLF
		$Output &= $DNSServer & @CRLF & @CRLF
		$Output &= 'Ping-Zeiten:       ' & @CRLF
		_PingTime()
	Next
Else
	$Output &= 'Keine WMI-Objekte gefunden für die class: Win32_OperatingSystem' & @CRLF & @CRLF
EndIf

GUICtrlSetData($Edit, '    Bitte warten...' & @CRLF & @CRLF & '    Win32_NetworkAdapter')
$Output &= @CRLF & '[ ~ Netzwerkadapter ~ ]' & @CRLF
$Output &= '==============================================================' & @CRLF
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_NetworkAdapter WHERE Netconnectionstatus = 2', 'WQL', 0x30)
If IsObj($colItems) Then
	For $objItem In $colItems
		$Output &= '  Hersteller:' & @TAB & $objItem.Manufacturer & @CRLF
		$Output &= '        Name:' & @TAB & $objItem.Name & @CRLF
		$Output &= ' Adapter-Typ:' & @TAB & $objItem.AdapterType & @CRLF
		$Output &= '     Kennung:' & @TAB & $objItem.NetConnectionID & @CRLF
		$Output &= 'MAC-Addresse:' & @TAB & $objItem.MACAddress & @CRLF
		$colItems2 = $objWMIService.ExecQuery('SELECT * FROM Win32_NetworkAdapterConfiguration', 'WQL', 0x30)
		If IsObj($colItems2) Then
			For $objItem2 In $colItems2
				If $objItem.Caption = $objItem2.Caption Then
					If $objItem2.IPEnabled = -1 Then
						If $objItem2.DHCPEnabled = -1 Then
							$Output &= '  Adresstyp:     ' & @TAB & 'von DHCP zugewiesen' & @CRLF
							$Output &= 'DHCP-Server:     ' & @TAB & $objItem2.DHCPServer & @CRLF
							$Output &= 'IP erhalten:     ' & @TAB & _WMIDateStringToDate($objItem2.DHCPLeaseObtained) & @CRLF
							$Output &= 'IP läuft ab:     ' & @TAB & _WMIDateStringToDate($objItem2.DHCPLeaseExpires) & @CRLF
						Else
							$Output &= 'Adresstyp:       ' & @TAB & 'Manuell konfiguriert' & @CRLF
						EndIf
						$Output &= 'IP-Addresse:      ' & @TAB & $objItem2.IPAddress(0) & @CRLF
						$Output &= 'Subnetzmaske:     ' & @TAB & $objItem2.IPSubnet(0) & @CRLF
						$Output &= 'Standardgateway:  ' & @TAB & $objItem2.DefaultIPGateway(0) & @CRLF & @CRLF
					Else
						$Output &= @CRLF
					EndIf
				EndIf
			Next
		Else
			$Output &= 'Keine WMI-Objekte gefunden für die class: Win32_NetworkAdapterConfiguration' & @CRLF & @CRLF
		EndIf
	Next
Else
	$Output &= 'Keine WMI-Objekte gefunden für die class: Win32_NetworkAdapter' & @CRLF & @CRLF
EndIf

GUICtrlSetData($Edit, '    Bitte warten...' & @CRLF & @CRLF & '    Win32_BIOS')
$Output &= @CRLF & '[ ~ BIOS ~ ]' & @CRLF
$Output &= '==============================================================' & @CRLF
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_BIOS', 'WQL', 0x30)
If IsObj($colItems) Then
	For $objItem In $colItems
		$Output &= 'Hersteller:  ' & @TAB & $objItem.Manufacturer & @CRLF
		$Output &= 'Name:        ' & @TAB & $objItem.Name & @CRLF
		$Output &= 'Version:     ' & @TAB & $objItem.Version & @CRLF
		$Output &= 'BIOS-Version:' & @TAB & $objItem.SMBIOSBIOSVersion & @CRLF
		$Output &= 'Datum:       ' & @TAB & _WMIDateStringToDate($objItem.ReleaseDate) & @CRLF & @CRLF
	Next
Else
	$Output &= 'Keine WMI-Objekte gefunden für die class: Win32_BIOS' & @CRLF & @CRLF
EndIf

Local $DevPath, $xOutput
$RegPath = "HKCU\Control Panel\Desktop"
$ConWall = RegRead($RegPath, "ConvertedWallpaper")
$AutoXTasks = RegRead($RegPath, "AutoEndTasks")
$HungApp = RegRead($RegPath, "HungAppTimeout")
$Wait2Kill = RegRead($RegPath, "WaitToKillAppTimeout")
$RegRead = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "DevicePath")
$DevPath = StringSplit($RegRead, ';')

$Output &= @CRLF & '[ ~ Treiberpfade + Endverhalten ~ ]' & @CRLF
$Output &= '==============================================================' & @CRLF
$Output &= 'Desktop-Bild aktiv:' & @TAB & _Iif($ConWall <> '', $ConWall, 'Nicht vorhanden!') & @CRLF
$Output &= $ScreenSaver
$Output &= $Wallpaper
$Output &= 'AutoEndTasks:      ' & @TAB & $AutoXTasks & @CRLF
$Output &= 'HungAppTimeout:   ' & @TAB & $HungApp & @CRLF
$Output &= 'WaitToKillApp...  ' & @TAB & $Wait2Kill & @CRLF & @CRLF
$Output &= 'Treiberpfade      ' & @CRLF
$xOutput = ""
For $r = 1 to UBound($DevPath,1) - 1
        $xOutput = $xOutput & $r & '. Treiberpfad: ' & $DevPath[$r] & @CRLF
Next
$Output &= _Iif($xOutput <> '', $xOutput, 'Keine Einträge!') & @CRLF & @CRLF

GUICtrlSetData($Edit, $Output)
GUICtrlSetState($Edit, $GUI_FOCUS)
GUICtrlSetState($End, $GUI_ENABLE)
GUICtrlSetState($Send, $GUI_ENABLE)
GUICtrlSetState($Save, $GUI_ENABLE)

While True
	Sleep(100)
WEnd

Func _End()
	Exit
EndFunc   ;==>_End

Func _Send()
	_INetMail($s_MailTo, $s_MailSubject, '')
	ClipPut($Output)
	Sleep(6000)
	Send('{TAB 3}')
	Send('^v')
EndFunc   ;==>_Send

Func _Save()
    Local $Textdat = @ScriptDir & '\Computer-Info_' & @UserName & '.txt'
	If _SaveTxt($Textdat, $Output) = 1 Then
		If MsgBox(262212, "Computer-Info v1.8", "Die Computer-Info.txt ist erfolgreich erstellt worden." & @CRLF & @CRLF & _
				"Wollen Sie die Computer-Info.txt jetzt in Notepad ansehen?", 15) = 6 Then
			ShellExecute($Textdat)
		EndIf
	Else
        MsgBox(262192, "Computer-Info v1.8", "Die Computer-Info.txt konnte wegen unbekannten Fehler nicht erstellt werden!")
	EndIf
EndFunc   ;==>_Save

Func _SaveTxt($sLogPath, $sLogMsg, $iFlag = -1)
	Local $iOpenMode = 2; 2 = Überschreiben , 1 = An Textende anhängen!
	Local $sMsg = $sLogMsg
	If $iFlag <> -1 Then
		$sMsg &= @CRLF & FileRead($sLogPath)
		$iOpenMode = 2
	EndIf
	Local $hOpenFile = FileOpen($sLogPath, $iOpenMode)
	If $hOpenFile = -1 Then Return SetError(1, 0, 0)
	Local $iWriteFile = FileWriteLine($hOpenFile, $sMsg)
	Local $iRet = FileClose($hOpenFile)
	If $iWriteFile = -1 Then Return SetError(2, $iRet, 0)
	Return $iRet
EndFunc   ;==>_SaveTxt

Func GetCPUCores()
	Local $S_SYSTEM_INFO = DllStructCreate("ushort dwOemId;short wProcessorArchitecture;dword dwPageSize;ptr lpMinimumApplicationAddress;" & _
			"ptr lpMaximumApplicationAddress;long_ptr dwActiveProcessorMask;dword dwNumberOfProcessors;dword dwProcessorType;dword dwAllocationGranularity;" & _
			"short wProcessorLevel;short wProcessorRevision")
	Local $err
	;Anzahl der CPUs bestimmen
	$err = DllCall("Kernel32.dll", "none", "GetSystemInfo", "ptr", DllStructGetPtr($S_SYSTEM_INFO))
	If @error Or Not IsArray($err) Then ;Fehler beim Dll Aufruf
		Return -1
	Else
		Return DllStructGetData($S_SYSTEM_INFO, "dwNumberOfProcessors")
	EndIf
EndFunc   ;==>GetCPUCores

Func _WMIDateStringToDate($dtmDate)
	Return StringMid($dtmDate, 7, 2) & '.' & StringMid($dtmDate, 5, 2) & '.' & StringLeft($dtmDate, 4) _
			 & '   ' & _
			StringMid($dtmDate, 9, 2) & ':' & StringMid($dtmDate, 11, 2) & ':' & StringMid($dtmDate, 13, 2)
EndFunc   ;==>_WMIDateStringToDate

Func _DisplayMemorySize($DMSize)
	Return _StringAddThousandsSep(Round($DMSize / 1024), '.', ',') & ' MB   (' & _StringAddThousandsSep($DMSize * 1024, '.', ',') & ' Bytes)'
EndFunc   ;==>_DisplayMemorySize

Func _PingTime()
	Local $time
	$time = Ping('www.ard.de', 1000)
	$Output &= 'www.ard.de  ' & @TAB & _Iif(($time < 1000) And ($time > 0), $time & ' ms', 'Antwortzeit überschritten!') & @CRLF
	$time = Ping('www.heise.de', 1000)
	$Output &= 'www.heise.de' & @TAB & _Iif(($time < 1000) And ($time > 0), $time & ' ms', 'Antwortzeit überschritten!') & @CRLF
	$time = Ping('www.t-online.de', 1000)
	$Output &= 'www.t-online.de' & @TAB & _Iif(($time < 1000) And ($time > 0), $time & ' ms', 'Antwortzeit überschritten!') & @CRLF
	$time = Ping('www.google.de', 1000)
	$Output &= 'www.google.de' & @TAB & _Iif(($time < 1000) And ($time > 0), $time & ' ms', 'Antwortzeit überschritten!') & @CRLF & @CRLF
EndFunc   ;==>_PingTime

; ----------------------------------------------------------------------------
; AutoIt Version: 3.1.1 beta
; Author:         Unknown & Thorsten Meger <Thorsten.Meger@gmx.de>
;
; Script Function: Decode REG_BINARY
; ----------------------------------------------------------------------------
Func _ProdKey($bia)
	Dim $a[15], $b[29], $c[24], $s = 15, $d = 29, $v = 0, $n = 0, $i = 0, $r, $h = 0
	$c = StringSplit("BCDFGHJKMPQRTVWXY2346789", "")
	$bia = StringMid($bia, 107, 30)
	For $i = 1 To 29 Step 2
		$a[Int($i / 2)] = Dec(StringMid($bia, $i, 2))
	Next
	For $i = $d - 1 To 0 Step -1
		If Mod(($i + 1), 6) = 0 Then
			$b[$i] = "-"
		Else
			$h = 0
			For $n = $s - 1 To 0 Step -1
				$v = BitOR(BitShift($h, -8), $a[$n])
				$a[$n] = Int($v / 24)
				$h = Mod($v, 24)
			Next
			$b[$i] = $c[$h + 1]
		EndIf
	Next
	For $i = 0 To 28
		$r = $r & $b[$i]
	Next
	Return $r
EndFunc   ;==>_ProdKey

Func _StringAddThousandsSep($sString, $sThousands = ",", $sDecimal = ".")
	Local $aNumber, $sLeft, $sResult = "", $iNegSign = "", $DolSgn = ""
    If Number(StringRegExpReplace($sString, "[^0-9\-.+]", "\1")) < 0 Then $iNegSign = "-" ; Allows for a negative value
    If StringRegExp($sString, "\$") And StringRegExpReplace($sString, "[^0-9]", "\1") <> "" Then $DolSgn = "$" ; Allow for Dollar sign
    $aNumber = StringRegExp($sString, "(\d+)\D?(\d*)", 1)
    If UBound($aNumber) = 2 Then
        $sLeft = $aNumber[0]
        While StringLen($sLeft)
            $sResult = $sThousands & StringRight($sLeft, 3) & $sResult
            $sLeft = StringTrimRight($sLeft, 3)
        WEnd
        $sResult = StringTrimLeft($sResult, 1); Strip leading thousands separator
        If $aNumber[1] <> "" Then $sResult &= $sDecimal & $aNumber[1] ; Add decimal
    EndIf
    Return $iNegSign & $DolSgn & $sResult ; Adds minus or "" (nothing)and Adds $ or ""
EndFunc ;==>_StringAddThousandsSep
