scwoobles Posted July 8, 2016 Share Posted July 8, 2016 I know that it is probably something super simple but I need another couple of thousand eyes on this. Thanks expandcollapse popup#RequireAdmin #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiIPAddress.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <FileConstants.au3> $Form1_1 = GUICreate("Form1", 293, 328, 192, 124) $Group1 = GUICtrlCreateGroup("Network Information", 8, 8, 273, 193) $IPAddress1 = _GUICtrlIpAddress_Create($Form1_1, 128, 24, 145, 17) _GUICtrlIpAddress_Set($IPAddress1, "192.168.4.100") $Subnet = _GUICtrlIpAddress_Create($Form1_1, 128, 48, 145, 17) _GUICtrlIpAddress_Set($Subnet, "255.255.255.0") $DefaultGateway = _GUICtrlIpAddress_Create($Form1_1, 128, 72, 145, 17) _GUICtrlIpAddress_Set($DefaultGateway, "192.168.4.1") $DNS1 = _GUICtrlIpAddress_Create($Form1_1, 128, 112, 146, 17) _GUICtrlIpAddress_Set($DNS1, "192.168.4.1") _GUICtrlIpAddress_ShowHide($DNS1, @SW_HIDE) $DNS2 = _GUICtrlIpAddress_Create($Form1_1, 128, 136, 145, 17) _GUICtrlIpAddress_Set($DNS2, "8.8.4.4") _GUICtrlIpAddress_ShowHide($DNS2, @SW_HIDE) $Checkbox1 = GUICtrlCreateCheckbox("Custom DNS", 24, 168, 97, 17) $Label1 = GUICtrlCreateLabel("IP Address", 24, 24, 55, 17) $Label2 = GUICtrlCreateLabel("Subnet Mask", 24, 48, 67, 17) $Label3 = GUICtrlCreateLabel("Default Gateway", 24, 72, 83, 17) $Label4 = GUICtrlCreateLabel("Primary DNS", 24, 120, 64, 17) $Label5 = GUICtrlCreateLabel("Secondary DNS", 24, 136, 81, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("OK", 216, 288, 65, 33) $Button2 = GUICtrlCreateButton("Cancel", 16, 288, 65, 33) $cpuname = GUICtrlCreateInput("cpuname", 128, 224, 145, 21) $Label6 = GUICtrlCreateLabel("Computer Name", 24, 224, 80, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### #Region ;Varibles Local $string = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}" Local $Value1 = "ProviderName" Local $Value2 = "PnPCapabilities" Local $key0 = RegRead($string &"\0000",$Value1) Local $key1 = RegRead($string &"\0001",$Value1) Local $key2 = RegRead($string &"\0002",$Value1) Local $key3 = RegRead($string &"\0003",$Value1) Local $key4 = RegRead($string &"\0004",$Value1) Local $key5 = RegRead($string &"\0005",$Value1) Local $key6 = RegRead($string &"\0006",$Value1) Local $key7 = RegRead($string &"\0007",$Value1) Local $key8 = RegRead($string &"\0008",$Value1) Local $key9 = RegRead($string &"\0009",$Value1) Local $key10 = RegRead($string &"\0010",$Value1) Local $key11 = RegRead($string &"\0011",$Value1) Local $key12 = RegRead($string &"\0012",$Value1) Local $key13 = RegRead($string &"\0013",$Value1) Local $key14 = RegRead($string &"\0014",$Value1) Local $key15 = RegRead($string &"\0015",$Value1) Local $key16 = RegRead($string &"\0016",$Value1) Local $key17 = RegRead($string &"\0017",$Value1) Local $key18 = RegRead($string &"\0018",$Value1) Local $key19 = RegRead($string &"\0019",$Value1) Local $key20 = RegRead($string &"\0020",$Value1) #EndRegion While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Checkbox1 If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then _GUICtrlIpAddress_ShowHide($DNS1, @SW_SHOW) _GUICtrlIpAddress_ShowHide($DNS2, @SW_SHOW) EndIf Case $Button2 Exit Case $Button1 #Region ; Logging DirCreate ( "C:\Setup\" ) DirCreate ( "C:\Setup\Logs\" ) FileInstall("C:\work\files\UserSetup.bat","C:\Setup\UserSetup.bat") FileInstall("C:\work\files\firewall_ports.bat","C:\Setup\firewall_ports.bat") FileInstall("C:\work\files\setwork.ps1","C:\Setup\setwork.ps1") #EndRegion #Region ;Registry MsgBox(64,"Terminal Registry","The Registry will be modified",0,0) Sleep(2000) RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\","DisabledComponents","REG_DWORD",0xffffffff) ;tcpip6 RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\","DisabledDHCPMediaSense","REG_DWORD",1) RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CSC\","Start","REG_DWORD",4) RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters\","FileinfoCacheLifetime","REG_DWORD",0) RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters\","FileNotFoundCacheLiftime","REG_DWORD",0) RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters\","DirectoryCacheLiftime","REG_DWORD",0) RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Windows Error Reporting\","DontShowUI","REG_DWORD",1) RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\","SoftwareSASGeneration","REG_DWORD",1) RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\","EnableLUA","REG_DWORD",0); Disables UAC RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\","ConsentPromptBehaviorAdmin","REG_DWORD",0); Disables UAC RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\","PromptOnSecureDesktop","REG_DWORD",0); Disables UAC RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\","dontdisplaylastusername","REG_DWORD",1); Disables UAC RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\","DontDisplayLockedUserId","REG_DWORD",8); Disables UAC RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL\","CheckedValue","REG_DWORD",1);show folders RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\HideFileExt\","CheckedValue","REG_DWORD",1); show file extentions RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\SharingWizardOn\","CheckedValue","REG_DWORD",1); should disable file share wiz RegWrite("HKLM\SYSTEM\ControlSet001\Control\TimeZoneInformation\","TimeZoneKeyName","REG_SZ","Mountain Standard Time"); first timezone change RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\","TimeZoneKeyName","REG_SZ","Mountain Standard Time"); Second timezone change ; Windows 10 Disable RegWrite("HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\","DisableOSUpgrade","REG_DWORD",1) RegWrite("HKLM\SOFTWARE\Policies\Microsoft\Windows\GWX\","DisableGwx","REG_DWORD",1) RegWrite("HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade\","ReservationsAllowed","REG_DWORD",0) ; Windows 10 Disable RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\381b4222-f694-41f0-9685-ff5bb260df2e\0012ee47-9041-4b5d-9b77-535fba8b1442\6738e2c4-e8a5-4a42-b16a-e040e769756e\","ACSettingIndex","REG_DWORD",0) if not RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\DontDisplayLockedUserId",2) Then RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\","DontDisplayLockedUserId","REG_DWORD",2) EndIf if not RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\AUOptions",4) Then RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\","AUOptions","REG_DWORD",4) EndIf if not RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\ScheduledInstallDay",2) Then RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\","ScheduledInstallDay","REG_DWORD",2) EndIf if not RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\ScheduledInstallTime",5) Then RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\","ScheduledInstallTime","REG_DWORD",5) EndIf if not RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\IncludeRecommendedUpdates",0) Then RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\","IncludeRecommendedUpdates","REG_DWORD",0) EndIf if not RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\ElevateNonAdmins",1) Then RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\","ElevateNonAdmins","REG_DWORD",1) EndIf MsgBox(64,"Terminal Registry","The Registry has been modified",0,0) #EndRegion Sleep(2000) MsgBox(64,"Terminal Commands","The DOS commands will start in 2 Seconds",0,0) Sleep(2000) Run(@ComSpec & " /c " & 'NET TIME \\server.local /SET /YES > C:\Setup\Logs\Nettime.log', "", @SW_HIDE) Run(@ComSpec & " /c " & 'bcdedit.exe /set nx alwaysoff > C:\Setup\Logs\bcdedit.log', "", @SW_HIDE) Run(@ComSpec & " /c " & 'sc config "UI0Detect" start= disabled > C:\Setup\Logs\isd.log', "", @SW_HIDE); Interactive Services detection Sleep(2000) #Region ;Network IP setting Run(@ComSpec & " /c " & 'netsh interface ip set address name="Local Area Connection" source=static addr='& $IPAddress1 &' mask='& $Subnet &' gateway='& $DefaultGateway &' gwmetric=1', "", @SW_HIDE) ;setting of IP address Run(@ComSpec & " /c " & 'netsh interface ipv4 add dns "Local Area Connection" ' & $DNS1, "", @SW_HIDE) ;setting of Dns 1 address Run(@ComSpec & " /c " & 'netsh interface ipv4 add dns "Local Area Connection" ' & $DNS2 & ' index=2', "", @SW_HIDE) ;setting of Dns 2 address Run(@ComSpec & " /c " & 'wmic computersystem where name="%COMPUTERNAME%" call rename name="' & GUICtrlRead($ALOHABOH) & '"', "", @SW_HIDE) MsgBox(64,"Terminal User Setup","The User Setup will start in 2 Seconds",0,0) Sleep(2000) Run(@ComSpec & " /c " & 'C:\Setup\UserSetup.bat', "", @SW_SHOW) Run(@ComSpec & " /c " & 'Powershell.exe C:\Setup\setwork.ps1', "", @SW_SHOW) Run(@ComSpec & " /c " & 'C:\Setup\firewall_ports.bat > C:\Setup\Logs\Firewall.log', "", @SW_HIDE) Run(@ComSpec & " /c " & 'wmic nicconfig where TcpipNetbiosOptions=0 call SetTcpipNetbios 2 > C:\Setup\Logs\Netbios.log', "", @SW_HIDE) ; Netbios Run(@ComSpec & " /c " & 'powercfg -x -disk-timeout-ac 0', "", @SW_HIDE) #Region ;Network Power Disable if not ($key0 ="Microsoft") Then RegWrite($string &"\0000",$Value2,"REG_DWORD",24) EndIf if not ($key1 ="Microsoft") Then RegWrite($string &"\0001",$Value2,"REG_DWORD",24) EndIf if not ($key2 ="Microsoft") Then RegWrite($string &"\0002",$Value2,"REG_DWORD",24) EndIf if not ($key3 ="Microsoft") Then RegWrite($string &"\0003",$Value2,"REG_DWORD",24) EndIf if not ($key4 ="Microsoft") Then RegWrite($string &"\0004",$Value2,"REG_DWORD",24) EndIf if not ($key5 ="Microsoft") Then RegWrite($string &"\0005",$Value2,"REG_DWORD",24) EndIf if not ($key6 ="Microsoft") Then RegWrite($string &"\0006",$Value2,"REG_DWORD",24) EndIf if not ($key7 ="Microsoft") Then RegWrite($string &"\0007",$Value2,"REG_DWORD",24) EndIf if not ($key8 ="Microsoft") Then RegWrite($string &"\0008",$Value2,"REG_DWORD",24) EndIf if not ($key9 ="Microsoft") Then RegWrite($string &"\0009",$Value2,"REG_DWORD",24) EndIf if not ($key10 ="Microsoft") Then RegWrite($string &"\0010",$Value2,"REG_DWORD",24) EndIf if not ($key11 ="Microsoft") Then RegWrite($string &"\0011",$Value2,"REG_DWORD",24) EndIf if not ($key12 ="Microsoft") Then RegWrite($string &"\0012",$Value2,"REG_DWORD",24) EndIf if not ($key13 ="Microsoft") Then RegWrite($string &"\0013",$Value2,"REG_DWORD",24) EndIf if not ($key14 ="Microsoft") Then RegWrite($string &"\0014",$Value2,"REG_DWORD",24) EndIf if not ($key15 ="Microsoft") Then RegWrite($string &"\0015",$Value2,"REG_DWORD",24) EndIf if not ($key16 ="Microsoft") Then RegWrite($string &"\0016",$Value2,"REG_DWORD",24) EndIf if not ($key17 ="Microsoft") Then RegWrite($string &"\0017",$Value2,"REG_DWORD",24) EndIf if not ($key18 ="Microsoft") Then RegWrite($string &"\0018",$Value2,"REG_DWORD",24) EndIf if not ($key19 ="Microsoft") Then RegWrite($string &"\0019",$Value2,"REG_DWORD",24) EndIf if not ($key20 ="Microsoft") Then RegWrite($string &"\0020",$Value2,"REG_DWORD",24) EndIf #EndRegion #Region ; Set Long File Date all users If @OSArch = "X86" Then Fileinstall("C:\work\files\Script files\slongdate.exe","C:\Users\All Users\Microsoft\Windows\Start Menu\Programs\Startup\slongdate.exe") ElseIf @OSArch = "X64" Then Fileinstall("C:\work\files\Script files\slongdate64.exe","C:\Users\All Users\Microsoft\Windows\Start Menu\Programs\Startup\slongdate64.exe") EndIf sleep(2500) ;Run(@ComSpec & " /c " & 'copy C:\slongdate.exe C:\Windows\System32\GroupPolicy\User\Scripts\Logon\slongdate.exe', "", @SW_HIDE) ;Sleep(2500) ;FileOpen("C:\Windows\System32\GroupPolicy\User\Scripts\scripts.ini",$FO_OVERWRITE) ;FileWriteLine("C:\Windows\System32\GroupPolicy\User\Scripts\scripts.ini", @CRLF) ;FileWriteLine("C:\Windows\System32\GroupPolicy\User\Scripts\scripts.ini", "[Logon]" & @CRLF) ;FileWriteLine("C:\Windows\System32\GroupPolicy\User\Scripts\scripts.ini", "0CmdLine=slongdate.exe" & @CRLF) ;FileWriteLine("C:\Windows\System32\GroupPolicy\User\Scripts\scripts.ini", "0Parameters=" & @CRLF) ;FileWriteLine("C:\Windows\System32\GroupPolicy\User\Scripts\scripts.ini", @CRLF) ;FileClose("C:\Windows\System32\GroupPolicy\User\Scripts\scripts.ini") #EndRegion MsgBox(64,"Checklist","The Checklist has been run",0,0) Sleep(7000) ProcessWaitClose("cmd.exe") FileDelete("C:\Setup\UserSetup.bat") FileDelete("C:\Setup\firewall_ports.bat") FileDelete("C:\Setup\setwork.ps1") Shutdown(6) Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
scwoobles Posted July 8, 2016 Author Share Posted July 8, 2016 what i am having problems with is the $IPAddress1 = _GUICtrlIpAddress_Create($Form1_1, 128, 24, 145, 17) _GUICtrlIpAddress_Set($IPAddress1, "192.168.4.100") the value that is returned for that varible is something like 0x0003e675a, where what i am looking for it to return is Eg, 192.168.4.100 Link to comment Share on other sites More sharing options...
BrewManNH Posted July 8, 2016 Share Posted July 8, 2016 Where are you attempting to READ from the control? The value that, for example $DNS1, contains is the handle to the control, not its contents. You need to use _GUICtrlIpAddress_Get or _GUICtrlIpAddress_GetArray to retrieve the contents. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
scwoobles Posted July 8, 2016 Author Share Posted July 8, 2016 27 minutes ago, BrewManNH said: Where are you attempting to READ from the control? The value that, for example $DNS1, contains is the handle to the control, not its contents. You need to use _GUICtrlIpAddress_Get or _GUICtrlIpAddress_GetArray to retrieve the contents. Thank You I guess i just had an Id10T error it works now thanks 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