hemichallenger Posted June 6, 2014 Share Posted June 6, 2014 Could some one help me out. I dont know how to get the Default Gateway and Subnet IP added to my script from the local computer. Line 36 and 37 expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #Region ### START Koda GUI section ### Form=H:\Form1.kxf GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### _info() Func _info() $username = @UserName $CPUArch = @CPUArch $OsVersion = @OSVersion $OSArch = @OSArch $Computername = @ComputerName $ipaddress = @IPAddress1 $objWMIService = ObjGet('winmgmts:\\' & @ComputerName & '\root\CIMV2') $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=true") For $objAdapter In $colItems If $objAdapter.MACAddress <> "" Then Local $dtmConvertedDate = ObjCreate("WbemScripting.SWbemDateTime") $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & @ComputerName & "\root\cimv2") $colOperatingSystems = $objWMIService.ExecQuery("Select * from Win32_OperatingSystem") For $objOperatingSystem in $colOperatingSystems $dtmConvertedDate.Value = $objOperatingSystem.InstallDate $dtmInstallDate = $dtmConvertedDate.GetVarDate If $dtmInstallDate <> "" Then MsgBox(4096, "System Infomation", "OSD Version: " & "Build" & @CRLF & _ "Computer Name is: "& $Computername & @CRLF & _ "Install date is: "& _WMIDateStringToDate($dtmInstallDate)& @CRLF & _ "CPU architecture is: "& $CPUArch & @CRLF & _ "OS Version is: "&$OsVersion & " " & $OSArch & " Bit" & @CRLF & _ "MAC Address is: "& $objAdapter.MACAddress & @CRLF & _ "IP Address is: "& $ipaddress & @CRLF & _ "Default Gateway: "& "DefaultGateway" & @CRLF & _ "Subnet Mask : "& "Subnet Mask " & @CRLF & @CRLF & _ "To Copy: Press CTRL+C ") EndIf Next EndIf Next EndFunc Func _WMIDateStringToDate($dtmInstallDate) Return StringRegExpReplace($dtmInstallDate,"(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})","$2/$3/$1 $4:$5:$6") EndFunc Link to comment Share on other sites More sharing options...
hemichallenger Posted June 6, 2014 Author Share Posted June 6, 2014 Okay i got the Default gateway $objAdapter.DefaultIPGateway(0). Just need to figure out the Subnet mask. Link to comment Share on other sites More sharing options...
Solution jguinch Posted June 6, 2014 Solution Share Posted June 6, 2014 Try this : $DefaultGateway = $objAdapter.DefaultIPGateway[0] $mask = $objAdapter.IPSubnet[0] If you have more than one gateway or subnet mask, you can use DefaultIPGateway[0], DefaultIPGateway[1] ... or $objAdapter.IPSubnet[0], $objAdapter.IPSubnet[1]... Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
hemichallenger Posted June 6, 2014 Author Share Posted June 6, 2014 never mind i figured it out lol Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now