Jump to content

When setting a Time zone via radio box I get a value of 1


scwoobles
 Share

Recommended Posts

***** Please Do not run this Script without Looking at it, It Will make several Registry changes that will alter the Behavior of your computer.*****

If I set the value staticly, it works but if I set the value to read from a Radio button it's gives a value of 1(not sure why). 

#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\..\..\Users\Aaron.Kennedy\Downloads\hourglass_128px_1139215_easyicon.net.ico
#AutoIt3Wrapper_Outfile=C:\Users\Aaron.Kennedy\AppData\Local\Temp\test.exe
#AutoIt3Wrapper_Outfile_x64=..\..\..\..\..\work\Hospitallity\Script files\GUI_Test_x64.exe
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiIPAddress.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <FileConstants.au3>
#include <Date.au3>
#include <Array.au3>
#include <ComboConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\aaron.kennedy\desktop\test1.kxf
Global $iHour, $iWeekday
Global $aWeekdays[8] = [7, "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
;a 1 based array row 0 = count of real elements
Global $aHours[24]  ;a 0 based array all rows are used from elements
_initHours()
$Form1_1 = GUICreate("Aloha Staging", 340, 590, 260, 270)
$Group1 = GUICtrlCreateGroup("Network Information", 8, 8, 321, 193)
$IPAddress1 = _GUICtrlIpAddress_Create($Form1_1, 144, 24, 177, 17)
_GUICtrlIpAddress_Set($IPAddress1, "192.168.0.100")
$Subnet = _GUICtrlIpAddress_Create($Form1_1, 144, 48, 177, 17)
_GUICtrlIpAddress_Set($Subnet, "255.255.255.0")
$DefaultGateway = _GUICtrlIpAddress_Create($Form1_1, 144, 72, 177, 17)
_GUICtrlIpAddress_Set($DefaultGateway, "192.168.0.0")
$DNS1 = _GUICtrlIpAddress_Create($Form1_1, 144, 112, 178, 17)
_GUICtrlIpAddress_Set($DNS1, "192.168.1.1")
_GUICtrlIpAddress_ShowHide($DNS1, @SW_SHOW)
$DNS2 = _GUICtrlIpAddress_Create($Form1_1, 144, 136, 177, 17)
_GUICtrlIpAddress_Set($DNS2, "8.8.4.4")
_GUICtrlIpAddress_ShowHide($DNS2, @SW_SHOW)
;$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", 264, 544, 65, 33)
$Button2 = GUICtrlCreateButton("Cancel", 8, 544, 65, 33)
$ALOHABOH = GUICtrlCreateInput("ALOHABOH", 144, 224, 177, 21)
$Label6 = GUICtrlCreateLabel("Computer Name", 16, 224, 96, 17)
$Group2 = GUICtrlCreateGroup("Time Zone", 8, 256, 321, 105)
$Radio1 = GUICtrlCreateRadio("Pacific Standard Time", 16, 280, 121, 17)
$Radio2 = GUICtrlCreateRadio("Mountain Standard Time", 16, 304, 137, 17)
$Radio3 = GUICtrlCreateRadio("Central Standard Time", 16, 328, 129, 17)
$Radio4 = GUICtrlCreateRadio("Eastern Standard Time", 160, 280, 129, 17)
$Radio5 = GUICtrlCreateRadio("Atlantic Standard Time", 160, 304, 129, 17)
$Radio6 = GUICtrlCreateRadio("Newfoundland Standard Time", 160, 328, 169, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("Windows Updates Schedule", 8, 376, 321, 65)
$Combo1 = GUICtrlCreateCombo("", 24, 400, 129, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Combo2 = GUICtrlCreateCombo("", 192, 400, 129, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label7 = GUICtrlCreateLabel("Time Business Machines 2016", 96, 552, 148, 17)
$Button3 = GUICtrlCreateButton("Update Time", 130, 470, 70, 40)
_SetDay()
_setHour()
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 $Combo1
            $select = GUICtrlRead($Combo1)
            $iWeekday=_ArraySearch($aWeekdays,$select)

        Case $Combo2
            $select = GUICtrlRead($Combo2)
            $iHour =_ArraySearch($aHours,$select)

        Case $Radio1
            $Timezone = GUICtrlRead($Radio1)

        Case $Radio2
            $Timezone = GUICtrlRead($Radio2)

        Case $Radio3
            $Timezone = GUICtrlRead($Radio3)

        Case $Radio4
            $Timezone = GUICtrlRead($Radio4)

        Case $Radio5
            $Timezone = GUICtrlRead($Radio5)

        Case $Radio6
            $Timezone = GUICtrlRead($Radio6)

        Case $Button2
            Exit

        Case $Button3
        Run(@ComSpec & " /c " & 'sc start w32time > C:\Setup\Logs\time-start.log', "", @SW_HIDE)
        Sleep(1000)
        Run(@ComSpec & " /c " & 'w32tm /resync /nowait > C:\Setup\Logs\time-update.log', "", @SW_HIDE)
        Sleep(800)
        Run(@ComSpec & " /c " & 'sc stop w32time > C:\Setup\Logs\time-stop.log', "", @SW_HIDE)
        MsgBox(64,"Computer Time","The Time on the computer has been updated",0,0)

        Case $Button1


#Region ; Logging
DirCreate ( "C:\Setup\" )
DirCreate ( "C:\Setup\Logs\" )
FileInstall("C:\work\Hospitallity\TBMUserSetup.bat","C:\Setup\TBMUserSetup.bat")
FileInstall("C:\work\Hospitallity\firewall_ports.bat","C:\Setup\firewall_ports.bat")
#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\","FileNotFoundCacheLifetime","REG_DWORD",0)
RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters\","DirectoryCacheLifetime","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

MsgBox(64,"Terminal Commands",$Timezone,0,0)
RegWrite("HKLM\SYSTEM\ControlSet001\Control\TimeZoneInformation\","TimeZoneKeyName","REG_SZ",$Timezone); first timezone change
MsgBox(64,"cs1",RegRead("HKLM\SYSTEM\ControlSet001\Control\TimeZoneInformation\","TimeZoneKeyName"),0,0)
RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\","TimeZoneKeyName","REG_SZ",$Timezone); Second timezone change
MsgBox(64,"ccs",RegRead("HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\","TimeZoneKeyName"),0,0)
; 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

RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\","ScheduledInstallDay","REG_DWORD",$iWeekday)
RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\","ScheduledInstallTime","REG_DWORD",$iHour)

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
#EndRegion
#Region Logging
$var1 = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\","DisabledComponents")
if $var1 = "0xffffffff" Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var1
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Network", "TCPIPv6 Disabled Components", $log)

$var2 = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\","DisabledDHCPMediaSense")
if $var2 = 1 Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var2
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Network", "Disabled DHCP MediaSense", $log)

$var3 = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CSC\","Start")
if $var3 = 4 Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var3
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Network", "Disabled Client Side Caching", $log)

$var4 = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters\","FileinfoCacheLifetime")
if $var4 = 0 Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var4
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Network", "File Info Cache Lifetime", $log)

$var5 = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters\","FileNotFoundCacheLifetime")
if $var5 = 0 Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var5
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Network", "File Not Found Cache Lifetime", $log)

$var6 = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters\","DirectoryCacheLifetime")
if $var6 = 0 Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var6
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Network", "Directory Cache Lifetime", $log)

$var7 = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Windows Error Reporting\","DontShowUI")
if $var7 = 1 Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var7
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Windows Settings", "Windows Error Reporting", $log)

$var8 = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\","SoftwareSASGeneration")
if $var8 = 1 Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var8
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Windows Settings", "SoftwareSASGeneration - Local Group Policy", $log)

$var9 = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\","EnableLUA")
if $var9 = 0 Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var9
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Windows Settings", "Disable UAC", $log)

$var10 = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\","ConsentPromptBehaviorAdmin")
if $var10 = 0 Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var10
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Windows Settings", "Consent Prompt Behavior Admin - Disable UAC", $log)

$var11 = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\","PromptOnSecureDesktop")
if $var11 = 0 Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var11
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Windows Settings", "Prompt On Secure Desktop - Disable UAC", $log)

$var12 = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\","dontdisplaylastusername")
if $var12 = 1 Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var12
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Windows Settings", "dont display last username", $log)

$var13 = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\","DontDisplayLockedUserId")
if $var13 = 2 Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var13
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Windows Settings", "Dont Display Locked User Id", $log)

$var14 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL\","CheckedValue")
if $var14 = 1 Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var14
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Windows Settings", "Show Hidden Folders", $log)

$var15 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\HideFileExt\","CheckedValue")
if $var15 = 1 Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var15
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Windows Settings", "Show File Exstentions", $log)

$var16 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\SharingWizardOn\","CheckedValue")
if $var16 = 1 Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var16
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Windows Settings", "Sharing Wizard On", $log)

$var17 = RegRead("HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\","DisableOSUpgrade")
if $var17 = 1 Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var17
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Windows Settings", "Disable OS Upgrade", $log)

$var18 = RegRead("HKLM\SOFTWARE\Policies\Microsoft\Windows\GWX\","DisableGwx")
if $var18 = 1 Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var18
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Windows Settings", "Disable Gwx", $log)

$var19 = RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade\","ReservationsAllowed")
if $var19 = 0 Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var19
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Windows Settings", "Disable OS Upgrade", $log)

$var20 = RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\381b4222-f694-41f0-9685-ff5bb260df2e\0012ee47-9041-4b5d-9b77-535fba8b1442\6738e2c4-e8a5-4a42-b16a-e040e769756e\","ACSettingIndex")
if $var20 = 0 Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var20
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Windows Settings", "Power Schemes", $log)

$var21 = RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\","AUOptions")
if $var21 = 4 Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var21
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Windows Update", "Auto Update", $log)

$var22 = RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\","IncludeRecommendedUpdates")
if $var22 = 0 Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var22
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Windows Update", "Include Recommended Updates", $log)

$var23 = RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\","ElevateNonAdmins")
if $var23 = 1 Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var23
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Windows Update", "Elevate NonAdmins", $log)

$var24 = RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\","ScheduledInstallDay")
if $var24 = $iWeekday Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var24
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Windows Update", "Scheduled Install Day", $log)

$var25 = RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\","ScheduledInstallTime")
if $var25 = $iHour Then
    $log = " Success "
Else
    $log = @error & " " & "Failure " & $var25
EndIf
IniWrite("C:\Setup\Logs\Staging.ini", "Windows Update", "Scheduled Install Time", $log)

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)
if NOT FileExists("C:\Setup\Logs\time-update.log") Then
Run(@ComSpec & " /c " & 'NET TIME \\ALOHABOH /SET /YES > C:\Setup\Logs\Nettime.log', "", @SW_HIDE)
EndIf
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='&  _GUICtrlIpAddress_Get( $IPAddress1) &' mask='& _GUICtrlIpAddress_Get($Subnet) &' gateway='& _GUICtrlIpAddress_Get($DefaultGateway) &' gwmetric=1', "", @SW_HIDE) ;setting of IP address
Run(@ComSpec & " /c " & 'netsh interface ipv4 add dns "Local Area Connection" ' & _GUICtrlIpAddress_Get($DNS1), "", @SW_HIDE) ;setting of Dns 1 address
Run(@ComSpec & " /c " & 'netsh interface ipv4 add dns "Local Area Connection" ' & _GUICtrlIpAddress_Get($DNS2) & ' index=2', "", @SW_HIDE) ;setting of Dns 2 address

Run(@ComSpec & " /c " & 'netsh interface ip set address name="Local Area Connection 1" source=static addr='&  _GUICtrlIpAddress_Get( $IPAddress1) &' mask='& _GUICtrlIpAddress_Get($Subnet) &' gateway='& _GUICtrlIpAddress_Get($DefaultGateway) &' gwmetric=1', "", @SW_HIDE) ;setting of IP address
Run(@ComSpec & " /c " & 'netsh interface ipv4 add dns "Local Area Connection 1" ' & _GUICtrlIpAddress_Get($DNS1), "", @SW_HIDE) ;setting of Dns 1 address
Run(@ComSpec & " /c " & 'netsh interface ipv4 add dns "Local Area Connection 1" ' & _GUICtrlIpAddress_Get($DNS2) & ' index=2', "", @SW_HIDE) ;setting of Dns 2 address

Run(@ComSpec & " /c " & 'netsh interface ip set address name="Local Area Connection 2" source=static addr='&  _GUICtrlIpAddress_Get( $IPAddress1) &' mask='& _GUICtrlIpAddress_Get($Subnet) &' gateway='& _GUICtrlIpAddress_Get($DefaultGateway) &' gwmetric=1', "", @SW_HIDE) ;setting of IP address
Run(@ComSpec & " /c " & 'netsh interface ipv4 add dns "Local Area Connection 2" ' & _GUICtrlIpAddress_Get($DNS1), "", @SW_HIDE) ;setting of Dns 1 address
Run(@ComSpec & " /c " & 'netsh interface ipv4 add dns "Local Area Connection 2" ' & _GUICtrlIpAddress_Get($DNS2) & ' index=2', "", @SW_HIDE) ;setting of Dns 2 address

Run(@ComSpec & " /c " & 'netsh interface ip set address name="Local Area Connection 3" source=static addr='&  _GUICtrlIpAddress_Get( $IPAddress1) &' mask='& _GUICtrlIpAddress_Get($Subnet) &' gateway='& _GUICtrlIpAddress_Get($DefaultGateway) &' gwmetric=1', "", @SW_HIDE) ;setting of IP address
Run(@ComSpec & " /c " & 'netsh interface ipv4 add dns "Local Area Connection 3" ' & _GUICtrlIpAddress_Get($DNS1), "", @SW_HIDE) ;setting of Dns 1 address
Run(@ComSpec & " /c " & 'netsh interface ipv4 add dns "Local Area Connection 3" ' & _GUICtrlIpAddress_Get($DNS2) & ' index=2', "", @SW_HIDE) ;setting of Dns 2 address

Run(@ComSpec & " /c " & 'netsh interface ip set address name="Local Area Connection 4" source=static addr='&  _GUICtrlIpAddress_Get( $IPAddress1) &' mask='& _GUICtrlIpAddress_Get($Subnet) &' gateway='& _GUICtrlIpAddress_Get($DefaultGateway) &' gwmetric=1', "", @SW_HIDE) ;setting of IP address
Run(@ComSpec & " /c " & 'netsh interface ipv4 add dns "Local Area Connection 4" ' & _GUICtrlIpAddress_Get($DNS1), "", @SW_HIDE) ;setting of Dns 1 address
Run(@ComSpec & " /c " & 'netsh interface ipv4 add dns "Local Area Connection 4" ' & _GUICtrlIpAddress_Get($DNS2) & ' index=2', "", @SW_HIDE) ;setting of Dns 2 address

Run(@ComSpec & " /c " & 'netsh interface ip set address name="Local Area Connection 5" source=static addr='&  _GUICtrlIpAddress_Get( $IPAddress1) &' mask='& _GUICtrlIpAddress_Get($Subnet) &' gateway='& _GUICtrlIpAddress_Get($DefaultGateway) &' gwmetric=1', "", @SW_HIDE) ;setting of IP address
Run(@ComSpec & " /c " & 'netsh interface ipv4 add dns "Local Area Connection 5" ' & _GUICtrlIpAddress_Get($DNS1), "", @SW_HIDE) ;setting of Dns 1 address
Run(@ComSpec & " /c " & 'netsh interface ipv4 add dns "Local Area Connection 5" ' & _GUICtrlIpAddress_Get($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\TBMUserSetup.bat', "", @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 1 > C:\Setup\Logs\Netbios.log', "", @SW_HIDE) ; Netbios
Run(@ComSpec & " /c " & 'powercfg -x -disk-timeout-ac 0', "", @SW_HIDE)
#EndRegion
#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
#cs                                                     This has become invalid due to the nature of windows registry
If @OSArch = "X86" Then
Fileinstall("C:\work\Hospitallity\Script files\slongdate.exe","C:\Users\All Users\Microsoft\Windows\Start Menu\Programs\Startup\slongdate.exe")
ElseIf @OSArch = "X64" Then
Fileinstall("C:\work\Hospitallity\Script files\slongdate64.exe","C:\Users\All Users\Microsoft\Windows\Start Menu\Programs\Startup\slongdate64.exe")
EndIf
#ce
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\TBMUserSetup.bat")
FileDelete("C:\Setup\firewall_ports.bat")

;Shutdown(6)
Exit
    EndSwitch
WEnd
#Region ;Funcs
Func _initHours()
    For $i=0 to 12
        $aHours[$i]=$i&':00 am'
    Next
    For $i=13 to 23
        $aHours[$i]=$i&':00 pm'
    Next
EndFunc

Func _SetDay()
    Local $iWeekday = _DateToDayOfWeek(@YEAR, @MON, @MDAY)
    For $i = 1 To 7
        If $i = $iWeekday Then
            GUICtrlSetData($Combo1, $aWeekdays[$i], $aWeekdays[$i])
        Else
            GUICtrlSetData($Combo1, $aWeekdays[$i])
        EndIf
    Next
EndFunc   ;==>_SetDay

Func _setHour()
    For $i=0 To 23
        If $i=@HOUR Then
            GUICtrlSetData($Combo2, $aHours[$i], $aHours[$i])
        Else
            GUICtrlSetData($Combo2, $aHours[$i])
        EndIf
    Next
    $iHour=@HOUR
EndFunc
#EndRegion

 

Thanks Again

Link to comment
Share on other sites

  • Moderators

@scwoobles the help file is your friend ;) 

If you check out GuiCtrlRead in the help file you will see by default if only returns whether it is checked or unchecked

For Checkbox and Radio controls only the $GUI_CHECKED (1), $GUI_UNCHECKED (4) or $GUI_INDETERMINATE (2) states are returned so the value can be used directly

If you want the text of the radio button control, you need to set the advanced parameter in GUICTrlRead

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Just a question, right now I am using a couple of batch files and just calling them and including them in my script, is there a way to do a multi line command.

Example:

Ipconfig /all

Ipconfig /release

Ipconfig /renew

but all in one window

Link to comment
Share on other sites

  • 2 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...