#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Tools\PPS_Logo_16x16.ico #AutoIt3Wrapper_Outfile=PPS-Installer.exe #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;################################################################################ ; File......: PPS-Install.exe ; Author....: Adam Seitz (aseitz@pps.net) ; Purpose...: This script runs the first time the computer is logged in after ; after imaging. This script configures the computer and customizes ; it for the end user. ;################################################################################ ; Includes and Compiler Flags #include #include #include #include #include #include ; Variables MUST be declared - helps save memory foot print and it runs faster too ;Opt('MustDeclareVars', 1) ;################################################################################ ; SET VARIABLES ;################################################################################ ; This phase of the installer is used to prepare all of our globals for use ; through-out the rest of the installation process. ; Set Administrator Password Global $AdminUser = Global $AdminPassword = RunWait(@ComSpec & " /c " & 'NET User ' & $AdminUser & ' ' & $AdminPassword, "", @SW_HIDE) ; This path is the full path to the Installers folder root. Global $PPS_ROOT = "C:\Installers" ; This variable is the full path to the Tools folder for the installations. Global $TOOLS = "C:\Installers\Tools" ; Create the Drivers Folder If Not FileExists("C:\Drivers") Then DirCreate("C:\Drivers") EndIf ; This is the log file to be used by the installer Global $LogDir = "C:\Logs" Global $LogFileName = @ComputerName & "-PostBoot-" & @MON & "_" & @MDAY & "_" & @YEAR & ".log" Global $Log = FileOpen($LogDir & '\' & $LogFileName, 9) ; The following 3 variables are the program title and program version information. Global $PPS_VERSION = "v10.0" Global $PPS_BUILD = "1007" Global $PPS_VERDATE = "06-13-2016" Global $PPS_TITLE = "PPS Image Customization Tool" Global $WINBLD = @OSBuild, $WINVER = @OSVersion, $WINSPK = @OSServicePack, $WINARC = @OSArch, $HWTYPE = "Workstation", $HWCPUARC = @CPUArch, $Profile ; Change to System Root FileChangeDir(@SystemDir) ; Set Windows Version to Human Readable If (@OSVersion = "WIN_7") Then $WINVER = "Windows 7" $Profile = "C:\Users" ElseIf ((@OSVersion = "WIN_8") or (@OSVersion = "WIN_81")) Then $WINVER = "Windows 8" $Profile = "C:\Users" ElseIf (@OSVersion = "WIN_10") Then $WINVER = "Windows 10" $Profile = "C:\Users" EndIf ; Set Windows Service Pack to Human Readable If (@OSServicePack = "") Then $WINSPK = "Release" EndIf ; Set Windows Architecture to Human Readable If (@OSArch = "x86") Then $WINARC = "32-Bit" ElseIf (@OSArch = "x64") Then $WINARC = "64-Bit" EndIf ; Detect Hardware Specificatitons If FileExists("C:\Drivers\Laptop.cfg") Then If FileExists("C:\Drivers\Netbook.cfg") Then $HWTYPE = "Netbook" Else $HWTYPE = "Laptop" EndIf EndIf ; This group of variables is used for file / folder work. Global $File, $FileAttributes, $FullFilePath, $Search = FileFindFirstFile($PPS_ROOT & "\*.*"), $CountValid = 0 Global $CountInstall = 1, $PROF_VAR = 0, $BatchFileTitleDisplay, $BatchFileTitle, $PercentDone ; Progress Bar Window position centered, near bottom. Global $iGuiHeight = 100, $iGuiWidth = 100, $iGuiXPos = (@DesktopWidth/2)-$iGuiWidth/2, $iGuiYPos = (@DesktopHeight/2)-$iGuiHeight ; Application Installation Arrays Global $ApplicationList[1], $ApplicationName[1], $BatchFileContents[1] ; General Use Variables Global $ErrorLevel, $UserName= "djoiner", $Password = "P3nj0in3r", $Domain = "ad.ppsnet", $LogRepository = "\\wnsccm.ad.ppsnet\ImageLogs", $BarPercent, $Counter, $PID ;################################################################################ ; Function LogWrite() ;################################################################################ ; This is the function that handles the log file Func LogWrite($text) ; Windows OS's have built in event managment that is better than the internal _Event_ Functions. RunAsWait( $AdminUser, @ComputerName, $AdminPassword, 1, @ComSpec & " /c " & 'start /wait /min eventcreate.exe /ID 1 /L Application /T Information /SO PPS-Installer /D "' & $text & '"', "", @SW_HIDE) EndFunc ;==>LogWrite ;################################################################################ ; Function Forground() ;################################################################################ ; This function attempts to put the pps-installer in the foreground when it is ; executed. Func Foreground($title) If Not WinActive($title) Then WinActivate($title) EndIf EndFunc ;==>Foreround ;################################################################################ ; Function Reboot() ;################################################################################ ; This is the function that handles the reboots ; Passing flag "0" causes the installer to no longer run. ; Passing flag "1" causes the installer to run again next time as Administrator Func Reboot($flag, $text, $time) FileOpen($Log) FileWriteLine($Log, $text & @CRLF) If($flag = "0") Then Print(@CRLF & " ### REBOOTING WITHOUT RUNNING AGAIN ###" & @CRLF) If($WINARC = "64-Bit") Then RegWrite('HKLM64\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon', 'AutoAdminLogon', 'REG_SZ', '0') RegWrite('HKLM64\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon', 'AutoLogonCount', 'REG_SZ', '0') RegDelete('HKLM64\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon', 'DefaultUserName') RegDelete('HKLM64\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon', 'DefaultPassword') Else RegWrite('HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon', 'AutoAdminLogon', 'REG_SZ', '0') RegWrite('HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon', 'AutoLogonCount', 'REG_SZ', '0') RegDelete('HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon', 'DefaultUserName') RegDelete('HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon', 'DefaultPassword') EndIf EndIf If($flag = "1") Then Print(@CRLF & " ### REBOOTING AND RUNNING AGAIN ###" & @CRLF) If($WINARC = "64-Bit") Then RegWrite('HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce','PPS-Installer','REG_SZ','C:\Installers\PPS-Installer.exe') RegWrite('HKLM64\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon', 'AutoAdminLogon', 'REG_SZ', '1') RegWrite('HKLM64\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon', 'AutoLogonCount', 'REG_SZ', '1') RegWrite('HKLM64\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon', 'DefaultUserName', 'REG_SZ', 'administrator') RegWrite('HKLM64\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon', 'DefaultPassword', 'REG_SZ', $AdminPassword) Else RegWrite('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce','PPS-Installer','REG_SZ','C:\Installers\PPS-Installer.exe') RegWrite('HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon', 'AutoAdminLogon', 'REG_SZ', '1') RegWrite('HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon', 'AutoLogonCount', 'REG_SZ', '1') RegWrite('HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon', 'DefaultUserName', 'REG_SZ', 'administrator') RegWrite('HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon', 'DefaultPassword', 'REG_SZ', $AdminPassword) EndIf EndIf ; REBOOOOT! FileClose($Log) RunAs($AdminUser, @ComputerName, $AdminPassword, 1, @ComSpec & " /c " & 'shutdown /r /t ' & $time, "", @SW_HIDE) Exit EndFunc ;==>Reboot ;################################################################################ ; Function Print() ;################################################################################ ; This is the function that handles the log file Func Print($text) ConsoleWrite($text & @CRLF) FileWriteLine($Log, $text & @CRLF) EndFunc ;==>Print ;################################################################################ ; Function ProfWrite() ;################################################################################ ; This is the function that handles writing Changes to the Profiles. ; - Passing PFlag "0" Writes to All Profiles. ; - Passing PFlag "1" Writes to Administrator Only - HKCU\$PKey ; - Passing PFlag "2" Writes to Default User Only - HKU\DefaultUser\$PKey Func ProfWrite($PKey, $PValue, $PType, $PData, $PFlag) ; If its binary data format it for AutoIT If StringUpper($PType) = "REG_BINARY" Then ; Strip Out Comma's $PData = StringReplace($PData, ",", "") ; Make it a Binary Value $PData = Binary('0x' & $PData & '') EndIf ; Administrator Write If (($PFlag = "0") or ($PFlag = "1")) Then RegWrite("HKCU\" & $PKey, $PValue, $PType, $PData) EndIf ; Default User Open / Write / Close If (($PFlag = "0") or ($PFlag = "2")) Then RunWait(@ComSpec & " /c " & 'reg load HKU\DefaultUser "' & $Profile & '\Default User\ntuser.dat" > NUL', "", @SW_HIDE) RegWrite("HKU\DefaultUser\" & $PKey, $PValue, $PType, $PData) RunWait(@ComSpec & " /c " & 'reg unload HKU\DefaultUser > NUL', "", @SW_HIDE) EndIf EndFunc ;==>ProfWrite ;################################################################################ ; Function ProfDelete() ;################################################################################ ; This is the function that handles writing Changes to the Profiles. ; - Passing PFlag "0" Delete to All Profiles. ; - Passing PFlag "1" Delete to Administrator Only. ; - Passing PFlag "2" Delete to Default User Only. Func ProfDelete($PKey, $PValue, $PFlag) ; Administrator Delete (Already open) If (($PFlag = "0") or ($PFlag = "1")) Then RegDelete($PKey, $PValue) EndIf ; Default User Open -> Delete -> Close If (($PFlag = "0") or ($PFlag = "2")) Then RunWait(@ComSpec & " /c " & 'reg load HKU\DefaultUser "' & $Profile & '\Default User\ntuser.dat" > NUL', "", @SW_HIDE) RegDelete("HKU\DefaultUser\" & $PKey, $PValue) RunWait(@ComSpec & " /c " & 'reg unload HKU\DefaultUser > NUL', "", @SW_HIDE) EndIf EndFunc ;==>ProfDelete ;################################################################################ ; BACKGROUND IMAGE ;################################################################################ ; Creates a background image for the theme Global Const $destination = "C:\Installers\Tools\Image_8_1.jpg" Global Const $width = @DesktopWidth + 3 Global Const $height = @DesktopHeight + 3 Global Const $centerX = (@DesktopWidth - $width) / 2 Global Const $centerY = (@DesktopHeight - $height) / 2 SplashImageOn("Splash Screen", $destination, $width, $height, $centerX, $centerY, 1) ProgressOn($PPS_TITLE & ' ' & $PPS_VERSION, "Preparing System", "0 percent", -1, -1, 18) ;################################################################################ ; INFORMATION FOR END-USER ;################################################################################ ProgressSet(5, "Setting Up Variables") ; Show User System Specifications Print("+ Detecting System: " & @ComputerName) Print(" - Software: " & $WINVER & " " & $WINSPK & " (" & $WINARC & " Installed)") Print(" - Hardware: " & $HWTYPE & " (" & $HWCPUARC & ")") Print(" - Installer: " & $PPS_VERSION & " (Build: " & $PPS_BUILD & ")") Print(" - User: " & @UserName & @CRLF) ;################################################################################ ; SETUP INSTALLER ;################################################################################ ; This phase of the installer is used to prepare the system for the software ; installations and any other configs that need to occur before software is ; installed. Print("+ Preparing for PPS-Installer Routines") Foreground("PPS-Installer.exe") If (@OSVersion = "WIN_10") Then ProgressSet(10, "Enabling Network Discovery", "Preparing for PPS-Installer") Print(" - Starting Network Discovery Services") RunAsWait( $AdminUser, @ComputerName, $AdminPassword, 1, @ComSpec & " /c " & 'sc start dnscache', "", @SW_HIDE) RunAsWait( $AdminUser, @ComputerName, $AdminPassword, 1, @ComSpec & " /c " & 'sc config FDResPub start=auto', "", @SW_HIDE) RunAsWait( $AdminUser, @ComputerName, $AdminPassword, 1, @ComSpec & " /c " & 'sc start FDResPub', "", @SW_HIDE) RunAsWait( $AdminUser, @ComputerName, $AdminPassword, 1, @ComSpec & " /c " & 'sc config SSDPSRV start=auto', "", @SW_HIDE) RunAsWait( $AdminUser, @ComputerName, $AdminPassword, 1, @ComSpec & " /c " & 'sc start SSDPSRV', "", @SW_HIDE) RunAsWait( $AdminUser, @ComputerName, $AdminPassword, 1, @ComSpec & " /c " & 'sc config upnphost start=auto', "", @SW_HIDE) RunAsWait( $AdminUser, @ComputerName, $AdminPassword, 1, @ComSpec & " /c " & 'sc start upnphost', "", @SW_HIDE) RunAsWait( $AdminUser, @ComputerName, $AdminPassword, 1, @ComSpec & " /c " & 'netsh advfirewall firewall set rule group="Network Discovery" new enable=Yes', "", @SW_HIDE) ProgressSet(11, "Setup Installer: Network Discovery Enabled", "Preparing for PPS-Installer") EndIf ; Copy System Tools (Must Happen First or logging won't work). ProgressSet(10, "Copy System Tools", "Preparing for PPS-Installer") Print(" - Copying " & $WINVER & " System Tools") RunAsWait( $AdminUser, @ComputerName, $AdminPassword, 1, @ComSpec & " /c " & 'Copy C:\Installers\Tools\System32\*.* C:\Windows\System32\*.*', "", @SW_HIDE) ProgressSet(11, "Halting Firewall", "Preparing for PPS-Installer") ; Halting Windows Update Service ProgressSet(12, "Halting Update Service", "Preparing for PPS-Installer") Print(" - Halting " & $WINVER & " Update Service") RunAsWait( $AdminUser, @ComputerName, $AdminPassword, 1, @ComSpec & " /c " & 'sc stop wuauserv', "", @SW_HIDE) LogWrite("Setup Installer: Windows Update Halted") ; Halting Microsoft SCCM Service (it latches on to MSIExec at random times) ProgressSet(13, "Halting SCCM Service", "Preparing for PPS-Installer") Print(" - Halting Microsoft SCCM Service") RunAsWait( $AdminUser, @ComputerName, $AdminPassword, 1, @ComSpec & " /c " & 'sc stop ccmexec', "", @SW_HIDE) LogWrite("Setup Installer: Microsoft SCCM Service Halted") ; Halting Microsoft End Point Protection Service ProgressSet(14, "Halting SCEP Service", "Preparing for PPS-Installer") Print(" - Halting Microsoft SCEP Service") RunAsWait( $AdminUser, @ComputerName, $AdminPassword, 1, @ComSpec & " /c " & 'sc stop msmpsvc', "", @SW_HIDE) LogWrite("Setup Installer: Microsoft SCEP Service Halted") LogWrite("Setup Installer: Has Completed") Print(" - Done" & @CRLF) ProgressSet(15, "Completed", "Preparing for PPS-Installer") ; ################################################################################ ; PREFORM HARDWARE ROUTINES ; ################################################################################ ; This phase of the installer will prepare the hardware for use. ; Notify user Print("+ Configuring: " & $HWTYPE) LogWrite("Configuring: " & $HWTYPE) ProgressSet(16, "Configuring: " & $HWTYPE, "PPS-Installer: Processing Hardware") ; If there is a laptop.cfg file - it is a Laptop If ($HWTYPE = "Laptop") Or ($HWTYPE = "Netbook") Then ; Adjust video resolution to maximum supported by video card / display Print(" - Adjusting Video Resolution (Laptop Maximum)") RunWait(@ComSpec & " /c " & 'start /wait /min ' & $TOOLS & '\dc.exe -quiet -width=max -height=max -depth=max', "", @SW_HIDE) LogWrite("Hardware: Setting Desktop Resolution to -width=max -height=max -depth=max") ProgressSet(17, "Configuring: " & $HWTYPE, "PPS-Installer: Processing Hardware") Else ;<--- WORKSTATION IS DEFAULT If FileExists("C:\Drivers\MaxVid.cfg") Then ; Adjust video resolution to Max x Max x Max Bits Per Pixel Print(" - Adjusting Video Resolution (MaxVid.cfg)") RunWait(@ComSpec & " /c " & 'start /wait /min ' & $TOOLS & '\dc.exe -quiet -width=max -height=max -depth=max', "", @SW_HIDE) LogWrite("Hardware: Setting Desktop Resolution to -width=max -height=max -depth=max") ElseIf FileExists("C:\Drivers\NoVid.cfg") Then ; Adjust video resolution to Max x Max x Max Bits Per Pixel Print(" - Skipping Video Resolution") LogWrite("Hardware: Skipping Desktop Resolution") Else ; Adjust video resolution to Max x Max x Max Bits Per Pixel -- 1003 Print(" - Adjusting Video Resolution (Default Workstation) Max H * Max W * Max bpp * 60 Hertz ") RunWait(@ComSpec & " /c " & 'start /wait /min ' & $TOOLS & '\dc.exe -quiet -width=max -height=max -depth=max -refresh=60', "", @SW_HIDE) LogWrite("Hardware: Setting Desktop Resolution to -width=max -height=max -depth=max -refresh=60") EndIF ProgressSet(17, "Configuring: " & $HWTYPE, "PPS-Installer: Processing Hardware") EndIf ; Work Complete - Notify User and Log it Print(" - Done" & @CRLF) LogWrite("Hardware: Processing Completed") ProgressSet(18, "Configuring: " & $HWTYPE, "PPS-Installer: Finished Processing Hardware") ; ################################################################################ ; MODIFY IMAGE POWER PROFILE ; ################################################################################ ; This will create a imaging profile for power management, to prevent hibernation ; and monitor shutting off / locking during imaging. ; Notify User Print("+ Modifying Power Profiles") ProgressSet(19, "Power Profile", "PPS-Installer: Setup Power Profile") ; High Performance (Build: 6106) RunWait(@ComSpec & " /c " & 'POWERCFG -SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c', "", @SW_HIDE) Print(" - Done" & @CRLF) ProgressSet(20, "Power Profile", "PPS-Installer: Finished Power Profile") ; ################################################################################ ; VALIDATE COMPUTER NAME ; ################################################################################ ; This phase of the installer will analyze the name of the computer and attempt ; to have the end-user re-name the computer to appropriate name. If the tool ; detects the computer's name is already valid, it just exits back and ; continues on. This is an attempt to prevent computers named "MININT-*" from ; joining the domain. Print("+ Computer Name") ProgressSet(40, "Computer Name: Beginning Validation", "PPS-Installer: Computer Name") If Not FileExists("C:\Drivers\ComputerName.Valid") Then Print(" - Computer Name Validation is Required") ProgressSet(43, "Computer Name: Executing Validation Tool", "PPS-Installer: Computer Name") ; Launch and wait for the Computer Name tool. $PID = Run($TOOLS & "\ComputerName.exe","",@SW_SHOW) ; Watch the computer name process While ProcessExists("ComputerName.exe") ; Bring app to foreground if it is not. If Not WinActive("Computer Name") Then WinActivate("Computer Name") EndIf WEnd ProgressSet(46, "Computer Name: Validating Tool Finished", "PPS-Installer: Computer Name") If FileExists("C:\Drivers\ComputerName.NameUpdated") Then ; Reboot and Exit - Return as Administrator ProgressSet(49, "Computer Name: Processing Reboot Requirement", "PPS-Installer: Computer Name") Reboot(1, " - Rebooting to Rename Computer.", 0) Print(" - Done" & @CRLF) EndIf Else ; The Name must have been validated to be at this point Print(" - Computer Name Validated: " & @ComputerName) ProgressSet(49, "Computer Name: Processing Reboot Requirement", "PPS-Installer: Computer Name") EndIf Print(" - Done" & @CRLF) ProgressSet(50, "Computer Name: Completed", "PPS-Installer: Computer Name") ; ################################################################################ ; JOIN THE DOMAIN ; ################################################################################ ; This phase of the installer will Reboot the computer and join the domain. This ; is the LAST reboot before the domain will be joined. Once the Domain has been ; joined the ability to Auto-Logon is lost. Print("+ Domain Membership") ProgressSet(51, "Domain Membership: Preparing", "PPS-Installer: Domain Membership") If Not FileExists("C:\Drivers\DomJoin.Done") Then ; Create a Pre-Domain.Done so we don't preform this reboot a second time. Print(" - Domain Membership is Required") FileCopy("C:\Installers\Tools\System32\DomJoin.exe", "C:\Drivers\DomJoin.Done", 9) ProgressSet(53, "Domain Membership: Processing Reboot Requirement", "PPS-Installer: Domain Membership") ; Reboot and Exit - Return as Administrator Reboot(1, " - Rebooting to Begin Joining the Domain.", 0) ElseIf Not FileExists("C:\Drivers\DomJoin.Joined") Then ; Join Domain through DomJoin tool ProgressSet(55, "Domain Membership: Joining the Domain", "PPS-Installer: Domain Membership") Print(" - Silently Joining Domain") RunWait(@ComSpec & " /c " & 'start /wait /min C:\Installers\Tools\System32\DomJoin.exe /S', "", @SW_HIDE) ; Create a Pre-Domain.Done so we don't preform this reboot a second time. ProgressSet(58, "Domain Membership: Marking Process as Completed", "PPS-Installer: Domain Membership") Print(" - Marking Process as completed") FileCopy( $TOOLS & "\" & $WINVER & "\DomJoin.exe", "C:\Drivers\DomJoin.Joined", 9) EndIf Print(" - Done" & @CRLF) ProgressSet(59, "Domain Membership: Completed", "PPS-Installer: Domain Membership") ; ################################################################################ ; PREFORM SOFTWARE INSTALLER ROUTINES ; ################################################################################ ; This phase of the installer will loop through all the subfolders of %PPS_ROOT% ; and execute (while waiting for completion) the pps_install.bat file. Once the ; execution loop is completed, the script will pass on to the next phase. ; Notify User Print("+ Installing Software") LogWrite("Software Installation: Has Begun") ProgressSet(59, "Software Installation: Has Begun", "PPS-Installer: Software Installation") ; First Count How Many Installations to preform While 1 ; Keep looping on $Search until it breaks If $Search = -1 Then ; Exit at break ExitLoop EndIf ; Fill in our File variable and move on $File = FileFindNextFile($Search) ; This really will never happen If @error Then ExitLoop ; Set some variables to be used for file manipulation $FullFilePath = $PPS_ROOT & "\" & $File $FileAttributes = FileGetAttrib($FullFilePath) ; Check to see if the $File variable is currently looking at a directory If StringInStr($FileAttributes,"D") Then ; If so ... Does a pps_install.bat file exist in it? If FileExists( $FullFilePath & "\pps_install.bat") Then ; Read in lines of text until the EOF is reached as Array _FileReadToArray($FullFilePath & "\pps_install.bat", $BatchFileContents) ; Scan Array for line "TITLE " where <title> is the data we are looking for ; and "TITLE" is the command used to add a title to the batch window. $BatchFileTitle = _ArraySearch($BatchFileContents, "TITLE ", 0, 0, 0, 1) $BatchFileTitleDisplay = StringTrimLeft($BatchFileContents[$BatchFileTitle],6) If $BatchFileTitle = -1 Then ; If no result was found use the Folder Name _ArrayAdd($ApplicationName, $FullFilePath) Else ; Otherwise use the 'title' variable. _ArrayAdd($ApplicationName, $BatchFileTitleDisplay) EndIf ; Add Application file path to List _ArrayAdd($ApplicationList, $FullFilePath) ; Add to Valid Total $CountValid = $CountValid + 1 EndIf EndIf WEnd ; Close the file search FileClose($Search) ; Determine Progress Math $PercentDone = 100 / $CountValid ; Create a Progress Bar If ( $CountValid = 1 ) Then ProgressSet(0, "Preparing for " & $CountValid & " Installation.") Else ProgressSet(0, "Preparing for " & $CountValid & " Installations.") EndIf ; Start The Installations Print(" - Installing " & $CountValid & " Packages") While 1 ; Exit If There are 0 to do since 1 installation is the minimum. If ( $CountInstall > $CountValid ) Then ExitLoop Else ; Calculate Remaining Percentage of Bar $PercentDone = (100 / $CountValid) * $CountInstall ; Added for 8.1 Print(" - Package " & $CountInstall & ": " & $ApplicationName[$CountInstall]) ; Update everything - during install ProgressSet( $PercentDone, "Installation " & $CountInstall & " of " & $CountValid & " in progress.", $ApplicationName[$CountInstall]) LogWrite("Software Installation: Installing " & $ApplicationName[$CountInstall] & ".") RunAsWait( $AdminUser, @ComputerName, $AdminPassword, 1, @ComSpec & " /c " & 'start /wait /min "title" "' & $ApplicationList[$CountInstall] & '\pps_install.bat"', "", @SW_HIDE) EndIf ; Destroy and recreate to recenter splash image - after install ;SplashOff() ;SplashImageOn("Splash Screen", $destination, $width, $height, $centerX, $centerY, 1) ; Destroy and recreate the progress bar to re-center it - after install ProgressOff() ProgressOn("Software Installation: Processing", "Installation " & $CountInstall & " of " & $CountValid & " is complete.", $ApplicationName[$CountInstall], -1, -1, 18) ProgressSet( $PercentDone, "Installation " & $CountInstall & " of " & $CountValid & " is complete.", $ApplicationName[$CountInstall]) $CountInstall = $CountInstall + 1 ; This really will never happen If @error Then ExitLoop WEnd LogWrite("Software Installation: Has Completed") Print(" - Done" & @CRLF) ; ################################################################################ ; WINDOWS 7 FINALIZATION ; ################################################################################ ; This phase preforms Windows 7 specific tasks. ProgressSet(70, "Windows Finalization: Has Begin", "PPS-Installer: Windows Finalization") If (@OSVersion = "WIN_7") Then ; Notify Version Print("+ Windows 7 Detected") LogWrite("Windows 7 Finalization: Initiated") ProgressSet(71, "Windows Finalization: for Windows 7", "PPS-Installer: Windows 7 Finalization") ; CompuTrace Installer If FileExists("C:\Installers\CT\computrace.exe") Then ProgressSet(72, "Windows Finalization: Computrace", "PPS-Installer: Windows 7 Finalization") Print(" - CT EXE: Removing") LogWrite("Windows 7 Finalization: Computrace: Removing Installers Folder: C:\Installers\CT") RunWait(@ComSpec & " /c " & 'RD /s/q "C:\Installers\CT"', "", @SW_HIDE) EndIf ; ## ; #### MACHINE LEVEL SETTINGS ################################################ ; ## ProgressSet(73, "Windows Finalization: Machine Settings", "PPS-Installer: Windows 7 Finalization") ; MACHINE: Enabling 'Clear Last Logon Name' Policy (Build: 6104) Print(" - Machine: Enabling 'Clear Last Logon Name' Policy") LogWrite("Windows 7 Finalization: Machine: Enabling 'Clear Last Logon Name' Policy") RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "dontdisplaylastusername", "REG_DWORD", "0x00000001") ; MACHINE: Removing 'Unwanted Shortcuts' from Start Menu (Build: 6101) Print(" - Machine: Removing 'Unwanted Shortcuts' from Start Menu") LogWrite("Windows 7 Finalization: Machine: Removing 'Unwanted Shortcuts' from Start Menu") FileDelete("C:\ProgramData\Microsoft\Windows\Start Menu\Default Programs.lnk") FileDelete("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Windows Defender.lnk") FileDelete("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Windows Mail.lnk") FileDelete("C:\users\temp\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows Mail.lnk") ; MACHINE: Disabling 'Windows Backup in Action Center' Policy Print(" - Machine: Disabling 'Windows Backup in Action Center' Policy") LogWrite("Win 7 Finalization: Machine: Disabling 'Windows Backup in Action Center' Policy") ; RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsBackup", "DisableMonitoring", "REG_DWORD", "0x00000001") RunAsWait( $AdminUser, @ComputerName, $AdminPassword, 1, @ComSpec & " /c " & 'REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsBackup" /v "DisableMonitoring" /t REG_DWORD /d "1" /f', "", @SW_HIDE) ; MACHINE: Disabling 'System Restore' Service (Build: 6101) Print(" - Machine: Disabling 'System Restore' Service") LogWrite("Windows 7 Finalization: Machine: Disabling 'System Restore' Service") RunWait(@ComSpec & " /c " & 'start /wait /min wmic /namespace:\\root\default path SystemRestore call Disable %SystemDrive%\', "", @SW_HIDE) ; MACHINE: Disabling 'Remote Assistance' on Start Menu (Build: 6102) Print(" - Machine: Disabling 'Remote Assistance' on Start Menu") LogWrite("Windows 7 Finalization: Machine: Disabling 'Remote Assistance' on Start Menu") FileDelete("C:\Users\Administrator\Start Menu\Programs\Remote Assistance.lnk") FileDelete("C:\Users\Default\Start Menu\Programs\Remote Assistance.lnk") ; MACHINE: Enabling 'Remote Desktop Connection' Policy (Build: 6102) Print(" - Machine: Enabling 'Remote Desktop Connection' Policy") LogWrite("Win 7 Finalization: Machine: Enabling 'Remote Desktop Connection' Policy") RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server", "fAllowToGetHelp", "REG_DWORD", "0x00000000") RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server", "fDenyTSConnections", "REG_DWORD", "0x00000000") ; MACHINE: Enabling 'Remote Registry' Service (Build: 6102) Print(" - Machine: Enabling 'Remote Registry' Service") LogWrite("Windows 7 Finalization: Enabling 'Remote Registry' Service") RunWait(@ComSpec & " /c " & 'SC CONFIG REMOTEREGISTRY start= "auto" > NUL', "", @SW_HIDE) ; MACHINE: 'Disable all IPv6 components, except the IPv6 loopback interface'(Build: 6111) Print(" - Machine: 'Disable all IPv6 components, except the IPv6 loopback interface'") LogWrite("Windows 7 Finalization: 'Disable all IPv6 components, except the IPv6 loopback interface'") RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters", "DisabledComponents", "REG_DWORD", "0xffffffff") ; ## ; #### ADMINISTRATOR PROFILE SETTINGS ######################################## ; ## ProgressSet(75, "Windows Finalization: Administrator Settings", "PPS-Installer: Windows 7 Finalization") ; ADMINISTRATOR: Show Hidden Files (Build: 6103) Print(" - Administrator: Show Hidden Files") LogWrite("Windows 7 Finalization: Administrator: Show Hidden Files") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Hidden", "REG_DWORD", "0x00000001", "1") ; ADMINISTRATOR: Show Admin Tools in the Start Menu (Build: 6103) Print(" - Administrator: Show Admin Tools in the Start Menu") LogWrite("Windows 7 Finalization: Administrator: Show Admin Tools in the Start Menu") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "StartMenuAdminTools", "REG_DWORD", "0x00000001", "1") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_AdminToolsRoot", "REG_DWORD", "0x00000002", "1") ; ## ; #### GLOBAL PROFILE SETTINGS ############################################### ; ## ProgressSet(77, "Windows Finalization: Global Settings", "PPS-Installer: Windows 7 Finalization") ; GLOBAL: Enable desktop icons for Computer, User's Files, and Internet Explorer (Build: 6104) Print(" - Global: Enable Desktop Icons") LogWrite("Windows 7 Finalization: Global: Enable Desktop Icons") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "REG_DWORD", "0x00000000", "0") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{59031a47-3f72-44a7-89c5-5595fe6b30ee}", "REG_DWORD", "0x00000000", "0") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{871C5380-42A0-1069-A2EA-08002B30309D}", "REG_DWORD", "0x00000000", "0") ; GLOBAL: Enable 'All Icons' on Start Menu and 'Notification' on Task Bar (Build: 6103) Print(" - Global: Enable 'All Icons' on Notification on Task Bar") LogWrite("Windows 7 Finalization: Global: Show All Icons on Notification on Task Bar") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer", "EnableAutoTray", "REG_DWORD", "0x00000000", "0") ; GLOBAL: Enable 'Known File Extensions' in File System (Build: 6104) Print(" - Global: Enable 'Known File Extensions' in File System") LogWrite("Windows 7 Finalization: Global: Enable 'Known File Extensions' in File System") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", "REG_DWORD", "0x00000000", "0") ; GLOBAL: Enable 'Run' on Start Menu (Build: 6106) Print(" - Global: Enable 'Run' on Start Menu") LogWrite("Windows 7 Finalization: Global: Enable 'Run' on Start Menu") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_ShowRun", "REG_DWORD", "0x00000001", "0") ; GLOBAL: Display Full Path in the Menu Bar (Classic Theme Only) (Build: 7001) Print(" - Global: Display the Full Path in the Title Bar (Classic Theme Only)") LogWrite("Windows 7 Finalization: Global: Display the Full Path in the Title Bar (Classic Theme Only)") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState", "FullPath", "REG_DWORD", "0x00000001", "0") ; End of Windows 7 Customizations ProgressSet(79, "Windows Finalization: Global Settings", "PPS-Installer: Windows 7 Finalization") Print(" - Done" & @CRLF) LogWrite("Windows 7 Finalization: Done") EndIf ; ################################################################################ ; WINDOWS 8.1 FINALIZATION ; ################################################################################ ; This phase preforms Windows 8 specific tasks. ProgressSet(70, "Windows Finalization: Has Begin", "PPS-Installer: Windows Finalization") If ((@OSVersion = "WIN_8") or (@OSVersion = "WIN_81")) Then ; Notify Version Print("+ Windows 8 Detected") LogWrite("Windows 8 Finalization: Initiated") ProgressSet(71, "Windows Finalization: for Windows 8", "PPS-Installer: Windows 8 Finalization") ; CompuTrace Installer If FileExists("C:\Installers\CT\computrace.exe") Then ProgressSet(72, "Windows Finalization: Computrace", "PPS-Installer: Windows 8 Finalization") Print(" - CT EXE: Removing") LogWrite("Windows 8 Finalization: Computrace: Removing Installers Folder: C:\Installers\CT") RunWait(@ComSpec & " /c " & 'RD /s/q "C:\Installers\CT"', "", @SW_HIDE) EndIf ; ## ; #### MACHINE LEVEL SETTINGS ################################################ ; ## ProgressSet(73, "Windows Finalization: Machine Settings", "PPS-Installer: Windows 8 Finalization") ; MACHINE: 'Disable all IPv6 components, except the IPv6 loopback interface' Print(" - Machine: 'Disable all IPv6 components, except the IPv6 loopback interface'") LogWrite("Windows 8 Finalization: 'Disable all IPv6 components, except the IPv6 loopback interface'") RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters", "DisabledComponents", "REG_DWORD", "0xffffffff") ; MACHINE: Disabling 'First Sign-in Animation' Print(" - Machine: Disabling 'First Sign-in Animation'") LogWrite("Windows 8 Finalization: Disabling 'First Sign-in Animation'") RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableFirstLogonAnimation", "REG_DWORD", "0x00000000") ; MACHINE: Disabling 'Help Tips' Print(" - Machine: Disabling 'Help Tips'") LogWrite("Windows 8 Finalization: Disabling 'Help Tips'") RegWrite("HKLM\SOFTWARE\Policies\Microsoft\Windows\EdgeUI", "DisableHelpSticker", "REG_DWORD", "0x00000001") ; MACHINE: Disabling 'System Restore' Service Print(" - Machine: Disabling 'System Restore' Service") LogWrite("Windows 8 Finalization: Machine: Disabling 'System Restore' Service") RunWait(@ComSpec & " /c " & 'start /wait /min wmic /namespace:\\root\default path SystemRestore call Disable %SystemDrive%\', "", @SW_HIDE) ; MACHINE: Disabling 'Remote Assistance' on Start Menu Print(" - Machine: Disabling 'Remote Assistance' on Start Menu") LogWrite("Windows 8 Finalization: Machine: Disabling 'Remote Assistance' on Start Menu") FileDelete("C:\Users\Administrator\Start Menu\Programs\Remote Assistance.lnk") FileDelete("C:\Users\Default\Start Menu\Programs\Remote Assistance.lnk") ; MACHINE: Enabling 'Boot to Desktop' Policy Print(" - Machine: Enabling Boot to Desktop' Policy") LogWrite("Windows 8 Finalization: Machine: Enabling Boot to Desktop' Policy") RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\StartPage", "OpenAtLogon", "REG_DWORD", "0x00000000") ; MACHINE: Enabling 'Remote Desktop Connection' Policy Print(" - Machine: Enabling 'Remote Desktop Connection' Policy") LogWrite("Win 8 Finalization: Machine: Enabling 'Remote Desktop Connection' Policy") RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server", "fAllowToGetHelp", "REG_DWORD", "0x00000000") RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server", "fDenyTSConnections", "REG_DWORD", "0x00000000") ; MACHINE: Enabling 'Remote Registry' Service Print(" - Machine: Enabling 'Remote Registry' Service") LogWrite("Windows 8 Finalization: Enabling 'Remote Registry' Service") RunWait(@ComSpec & " /c " & 'SC CONFIG REMOTEREGISTRY start= "auto" > NUL', "", @SW_HIDE) ; ## ; #### ADMINISTRATOR PROFILE SETTINGS ######################################## ; ## ProgressSet(75, "Windows Finalization: Administrator Settings", "PPS-Installer: Windows 8 Finalization") ; ## ; #### GLOBAL PROFILE SETTINGS ############################################### ; ## ProgressSet(77, "Windows Finalization: Global Settings", "PPS-Installer: Windows 8 Finalization") ; GLOBAL: Disable File Selection Checkboxes Print(" - Global: Disable File Selection Checkboxes") LogWrite("Windows 8 Finalization: Global: Disable File Selection Checkboxes") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "AutoCheckSelect", "REG_DWORD", "0x00000000", "0") ; GLOBAL: Display Full Path in the Menu Bar (Classic Theme Only) Print(" - Global: Display the Full Path in the Title Bar (Classic Theme Only)") LogWrite("Windows 8 Finalization: Global: Display the Full Path in the Title Bar (Classic Theme Only)") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState", "FullPath", "REG_DWORD", "0x00000001", "0") ; GLOBAL: Enable 'All Icons' on Start Menu and 'Notification' on Task Bar Print(" - Global: Enable 'All Icons' on Notification on Task Bar") LogWrite("Windows 8 Finalization: Global: Show All Icons on Notification on Task Bar") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer", "EnableAutoTray", "REG_DWORD", "0x00000000", "0") ; GLOBAL: Enable 'Known File Extensions' in File System Print(" - Global: Enable 'Known File Extensions' in File System") LogWrite("Windows 8 Finalization: Global: Enable 'Known File Extensions' in File System") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", "REG_DWORD", "0x00000000", "0") ; GLOBAL: Enable desktop icons for Computer, User's Files, and Internet Explorer Print(" - Global: Enable Desktop Icons") LogWrite("Windows 8 Finalization: Global: Enable Desktop Icons") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "REG_DWORD", "0x00000000", "0") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{59031a47-3f72-44a7-89c5-5595fe6b30ee}", "REG_DWORD", "0x00000000", "0") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{871C5380-42A0-1069-A2EA-08002B30309D}", "REG_DWORD", "0x00000000", "0") ; GLOBAL: Enable 'Show Desktop Background on Start Menu' on System Print(" - Global: Enable 'Show Desktop Background on Start Menu' on System") LogWrite("Win 8 Finalization: Global: Enable 'Show Desktop Background on Start Menu' on System") ProfWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent", "MotionAccentId_v1.00", "REG_DWORD", "0x00000219", "0") ; End of Windows 8 Customizations ProgressSet(79, "Windows Finalization: Global Settings", "PPS-Installer: Windows 8 Finalization") Print(" - Done" & @CRLF) LogWrite("Windows 8 Finalization: Done") EndIf ; ################################################################################ ; WINDOWS 10 FINALIZATION ; ################################################################################ ; This phase preforms Windows 10 specific tasks. ProgressSet(70, "Windows Finalization: Has Begin", "PPS-Installer: Windows Finalization") If (@OSVersion = "WIN_10") Then ; Notify Version Print("+ Windows 10 Detected") LogWrite("Windows 10 Finalization: Initiated") ProgressSet(71, "Windows Finalization: for Windows 10", "PPS-Installer: Windows 10 Finalization") ; CompuTrace Installer If FileExists("C:\Installers\CT\computrace.exe") Then ProgressSet(72, "Windows Finalization: Computrace", "PPS-Installer: Windows 10 Finalization") Print(" - CT EXE: Removing") LogWrite("Windows 10 Finalization: Computrace: Removing Installers Folder: C:\Installers\CT") RunWait(@ComSpec & " /c " & 'RD /s/q "C:\Installers\CT"', "", @SW_HIDE) EndIf ; ## ; #### MACHINE LEVEL SETTINGS ################################################ ; ## ProgressSet(73, "Windows Finalization: Machine Settings", "PPS-Installer: Windows 10 Finalization") ; MACHINE: Customize 'Windows 10 Start Menu' Print(" - Machine: Customize 'Windows 10 Start Menu'") LogWrite("Windows 10 Finalization: Machine: Customize 'Windows 10 Start Menu'") RunAsWait( $AdminUser, @ComputerName, $AdminPassword, 1, @ComSpec & " /c " & 'PowerShell.exe -ExecutionPolicy "Bypass" -Command "C:\Installers\Tools\Import-StartMenu.ps1"', "", @SW_HIDE) ; MACHINE: Disabling 'First Sign-in Animation' Print(" - Machine: Disabling 'First Sign-in Animation'") LogWrite("Windows 10 Finalization: Disabling 'First Sign-in Animation'") RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", "EnableFirstLogonAnimation", "REG_DWORD", "0x00000000") ; MACHINE: Disabling 'System Restore' Service Print(" - Machine: Disabling 'System Restore' Service") LogWrite("Windows 10 Finalization: Machine: Disabling 'System Restore' Service") RunWait(@ComSpec & " /c " & 'start /wait /min wmic /namespace:\\root\default path SystemRestore call Disable %SystemDrive%\', "", @SW_HIDE) ; MACHINE: 'Disable all IPv6 components, except the IPv6 loopback interface' Print(" - Machine: 'Disable all IPv6 components, except the IPv6 loopback interface'") LogWrite("Windows 10 Finalization: 'Disable all IPv6 components, except the IPv6 loopback interface'") RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters", "DisabledComponents", "REG_DWORD", "0xffffffff") ; MACHINE: Enabling 'Remote Registry' Service Print(" - Machine: Enabling 'Remote Registry' Service") LogWrite("Windows 10 Finalization: Enabling 'Remote Registry' Service") RunWait(@ComSpec & " /c " & 'SC CONFIG REMOTEREGISTRY start= "auto" > NUL', "", @SW_HIDE) ; MACHINE: Uninstall 'Default Windows 10 Applications' Print(" - Machine: Uninstall 'Default Windows 10 Applications'") LogWrite("Windows 10 Finalization: Machine: Uninstall 'Default Windows 10 Applications'") RunAsWait( $AdminUser, @ComputerName, $AdminPassword, 1, @ComSpec & " /c " & 'PowerShell.exe -ExecutionPolicy "Bypass" -Command "C:\Installers\Tools\Uninstall-Apps.ps1"', "", @SW_HIDE) ; ## ; #### ADMINISTRATOR PROFILE SETTINGS ######################################## ; ## ProgressSet(75, "Windows Finalization: Administrator Settings", "PPS-Installer: Windows 10 Finalization") ; ## ; #### GLOBAL PROFILE SETTINGS ############################################### ; ## ProgressSet(77, "Windows Finalization: Global Settings", "PPS-Installer: Windows 10 Finalization") ; GLOBAL: Disable File Selection Checkboxes Print(" - Global: Disable File Selection Checkboxes") LogWrite("Windows 10 Finalization: Global: Disable File Selection Checkboxes") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "AutoCheckSelect", "REG_DWORD", "0x00000000", "0") ; GLOBAL: Disable 'Most Used Apps' on Start Menu Print(" - Global: Disable 'Most Used Apps' on Start Menu") LogWrite("Windows 10 Finalization: Global: Disable 'Most Used Apps' on Start Menu") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Start_TrackProgs", "REG_DWORD", "0x00000000", "0") ; GLOBAL: Enable 'All Icons' on Start Menu and 'Notification' on Task Bar Print(" - Global: Enable 'All Icons' on Notification on Task Bar") LogWrite("Windows 10 Finalization: Global: Show All Icons on Notification on Task Bar") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer", "EnableAutoTray", "REG_DWORD", "0x00000000", "0") ; GLOBAL: Enable desktop icons for Computer, User's Files, and Internet Explorer Print(" - Global: Enable Desktop Icons") LogWrite("Windows 10 Finalization: Global: Enable Desktop Icons") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "REG_DWORD", "0x00000000", "0") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{59031a47-3f72-44a7-89c5-5595fe6b30ee}", "REG_DWORD", "0x00000000", "0") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", "{871C5380-42A0-1069-A2EA-08002B30309D}", "REG_DWORD", "0x00000000", "0") ; GLOBAL: Enable 'Known File Extensions' in File System Print(" - Global: Enable 'Known File Extensions' in File System") LogWrite("Windows 10 Finalization: Global: Enable 'Known File Extensions' in File System") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", "REG_DWORD", "0x00000000", "0") ; GLOBAL: Modify 'Cortana' on Start Menu as 'Icon' on task bar Print(" - Global: Modify 'Cortana' on Start Menu as 'Icon' on task bar") LogWrite("Windows 10 Finalization: Global: Modify Cortana on Start Menu as Icon on task bar") ProfWrite("Software\Microsoft\Windows\CurrentVersion\Search", "SearchboxTaskbarMode", "REG_DWORD", "0x00000001", "0") ; End of Windows 10 Customizations ProgressSet(79, "Windows Finalization: Global Settings", "PPS-Installer: Windows 10 Finalization") Print(" - Done" & @CRLF) LogWrite("Windows 10 Finalization: Done") EndIf ; ################################################################################ ; WINDOWS GENERAL FINALIZATION (POST-PROFILE COPY) ; ################################################################################ ; This phase preforms Windows specific tasks regardless of version. Print("+ Finalizing Windows Environment") ProgressSet(80, "Windows Finalization: Environment", "PPS-Installer: Windows Finalization") LogWrite("Windows Environment Finalization: Initiated") ; Disabling AutoLogin and Removing Default Admin password ProgressSet(82, "Windows Finalization: Disabling AutoLogin", "PPS-Installer: Windows Finalization") Print(" - Finalization: Disabling AutoLogin and Removing Default Admin password") LogWrite("Cleaning Up: Disabling AutoLogin and Removing Default Admin password") RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AutoAdminLogon", "REG_SZ", "0") RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AutoLogonCount", "REG_SZ", "0") RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AltDefaultUserName") RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultUserName") RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultPassword") ; Set Domain as default login (updated for 6030) ProgressSet(84, "Windows Finalization: Set Domain as default login", "PPS-Installer: Windows Finalization") Print(" - Finalization: Enabling Domain as Default Login Method") LogWrite("Cleaning Up: Disabling AutoLogin and Removing Default Admin password") RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AltDefaultDomainName", "REG_SZ", "PPS") RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "CachePrimaryDomain", "REG_SZ", "PPS") RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultDomainName", "REG_SZ", "PPS") ; Remove the reg keys for pps-installer to run at boot ProgressSet(86, "Windows Finalization: Set Domain as default login", "PPS-Installer: Windows Finalization") Print(" - Finalization: Unscheduling Any Future PPS-Installer Operations") LogWrite("Cleaning Up: Unscheduling Any Future PPS-Installer Operations") RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run","PPS-Software") RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce","PPS-Software") ; Create initial OEMInfo.ini file (to be appended later) ProgressSet(88, "Windows Finalization: Installing OEM Info", "PPS-Installer: Windows Finalization") Print(" - Installing OEMInfo") LogWrite("Windows Environment Finalization: Installing OEMInfo") FileCopy($TOOLS & "\OEMLogo.bmp", @WindowsDir & "\System32\OEMLogo.bmp", 9) IniWrite(@WindowsDir & "\System32\OEMInfo.ini", "General", "Manufacturer", "Portland Public Schools") IniWrite(@WindowsDir & "\System32\OEMInfo.ini", "Support Information", "Line1", "For technical support, please contact the IT Service Desk at:") IniWrite(@WindowsDir & "\System32\OEMInfo.ini", "Support Information", "Line2", " ") IniWrite(@WindowsDir & "\System32\OEMInfo.ini", "Support Information", "Line3", "itservicedesk@pps.k12.or.us") IniWrite(@WindowsDir & "\System32\OEMInfo.ini", "Support Information", "Line4", "503-916-3375 Service Desk") IniWrite(@WindowsDir & "\System32\OEMInfo.ini", "Support Information", "Line5", "503-916-3162 Fax") IniWrite(@WindowsDir & "\System32\OEMInfo.ini", "Support Information", "Line6", " ") IniWrite(@WindowsDir & "\System32\OEMInfo.ini", "Support Information", "Line7", "Portland Public Schools ") IniWrite(@WindowsDir & "\System32\OEMInfo.ini", "Support Information", "Line8", "501 N. Dixon Street") IniWrite(@WindowsDir & "\System32\OEMInfo.ini", "Support Information", "Line9", "Portland, OR 97227") IniWrite(@WindowsDir & "\System32\OEMInfo.ini", "Support Information", "Line10", " ") IniWrite(@WindowsDir & "\System32\OEMInfo.ini", "Support Information", "Line11", "Image Version " & $PPS_VERSION & " [" & $PPS_BUILD & "]" & " [" & $PPS_VERDATE & "]") IniWrite(@WindowsDir & "\System32\OEMInfo.ini", "Support Information", "Line14", "Imaged on: " & @MDAY & "/" & @MON & "/" & @YEAR & " at: " & @HOUR & ":" & @MIN & ":" & @SEC & " ") IniWrite(@WindowsDir & "\System32\OEMInfo.ini", "Support Information", "Line12", "Software: " & $WINARC & " " & $WINVER & " " & $WINSPK) IniWrite(@WindowsDir & "\System32\OEMInfo.ini", "Support Information", "Line13", "Hardware: " & $HWTYPE & " (" & $HWCPUARC & ")") ; End of Windows General Finializations ProgressSet(90, "Windows Finalization: Done", "PPS-Installer: Windows Finalization") Print(" - Done" & @CRLF) LogWrite("Windows Environment Finalization: Done") ; ################################################################################ ; EXIT PROGRAM - AND LET REBOOT MANAGER HANDLE THINGS FROM HERE ; ################################################################################ ; This phase is the end of the script. ProgressSet(100, "Done", "PPS-Installer: Done") ; Notify User of impending reboot - reboot manager will handle it once the desktop loads. Print("+ Issuing Reboot") ; Close the Log Print(" - Closing Log File: Uploading" & @CRLF) FileClose($Log) RunWait(@ComSpec & " /c " & 'DEL /F /Q C:\Logs\*.evtx', "", @SW_HIDE) RunAsWait($UserName, $Domain, $Password, 0, @ComSpec & " /c " & 'start /wait /min xcopy /y ' & $LogDir & '\*.log ' & $LogRepository & '\', "", @SW_HIDE) ; Reboot and Exit Reboot(0, " - Done" & @CRLF, 0)