From b180b42ec9e46c4e5909a05ab34fd10df1e70e8f Mon Sep 17 00:00:00 2001 From: Alan Mason <@2Shirt> Date: Fri, 17 Nov 2017 00:53:08 -0700 Subject: [PATCH] 2016-10: Retroactive Updates # Migration to Python started # * PoSH has an extreme slowdown for some systems while it runs an optimization ** pass for .NET on the first PoSH script execution. ** This is reason enough to move to an alternative. * New additions: * User Data Transfer script * Will extract from a WIM or copy from a folder * Uses wimlib-imagex for images and FastCopy for folders * Removes undesired items after transfer/extraction * HWiNFO * Missing ODD repair registry patch * Q-Dir * SW Bundle install script * ConEmu * Moving back to ConEmu for better performance. * Copy-WizardKit * Now uses FastCopy * functions.py * Ported init.ps1 to Python using functions.py (from WinPE) as a base * Launch.cmd * Elevating programs/scripts now done using a temp VBScript file * Can run Python scripts (using either the 32 or 64 bit runtime) * transferred_keys.cmd * Expanded searched paths * Misc * Lots of variables and files renamed * Lots of hard-coded paths are now in variables * Should only be set in scripts in %bin%\Scripts * Moved a subset of the Diagnostics launchers to a new 'Extras' folder * The launchers moved are those that are less-often used * Refactored FindBin code to be more concise * Renamed "KitDir" "ClientDir" to indicate that it is on the client's system * Removed GeForce Experience launcher as it now requires an account * Added link to NVIDIA's driver webpage to download the correct driver * Removed AMD's Gaming Evolved launcher * This is usually bundled with the GPU driver anyway * Switched back to ConEmu * Variable and script names are now more descriptive * i.e. checklist -> final_checklist, and HH -> %kit_dir% * (not happy with %kit_dir%, will probably change again) --- .bin/Scripts/Launch.cmd | 64 +- .bin/Scripts/activate.ps1 | 70 -- .bin/Scripts/activate.py | 109 +++ .bin/Scripts/check_battery.ps1 | 12 +- .bin/Scripts/check_disk.cmd | 2 +- .bin/Scripts/check_disk.ps1 | 6 +- .bin/Scripts/check_disk_fix.ps1 | 6 +- .bin/Scripts/{os_check.ps1 => check_os.ps1} | 18 +- .bin/Scripts/checklist.ps1 | 45 +- .bin/Scripts/copy_office.cmd | 92 +- .bin/Scripts/diagnostics.ps1 | 55 +- .bin/Scripts/dism.ps1 | 10 +- .bin/Scripts/enter_safemode.ps1 | 4 +- .bin/Scripts/exit_safemode.ps1 | 4 +- .bin/Scripts/final_checklist.ps1 | 291 ++++++ .bin/Scripts/free_space.ps1 | 4 +- .bin/Scripts/functions.py | 818 +++++++++++++++++ .bin/Scripts/init.ps1 | 14 +- .bin/Scripts/init_client_dir.cmd | 53 ++ .bin/Scripts/install_sw_bundle.py | 79 ++ .bin/Scripts/installed_ram.ps1 | 10 +- .bin/Scripts/menu.py | 368 ++++++++ .bin/Scripts/partition_uids.py | 325 +++++++ .bin/Scripts/reset_browsers.ps1 | 92 +- .bin/Scripts/sfc_scan.cmd | 2 +- .bin/Scripts/sw_diagnostics.ps1 | 354 ++++++++ .bin/Scripts/transferred_keys.cmd | 134 ++- .bin/Scripts/update_kit.ps1 | 312 +++++++ .bin/Scripts/update_kit.py | 453 ++++++++++ .bin/Scripts/update_tools.ps1 | 188 ---- .bin/Scripts/user_data.ps1 | 10 +- .bin/Scripts/user_data_transfer.py | 248 +++++ .../vendor/conemu-maximus5/ConEmu.xml | 844 ------------------ Activate Windows.cmd | 31 + .../Activate Windows (with BIOS key).cmd | 44 - Battery Health.cmd | 39 - Copy-WizardKit.cmd | 133 +-- Data Recovery/PhotoRec (CLI).cmd | 20 +- Data Recovery/PhotoRec.cmd | 20 +- Data Recovery/TestDisk.cmd | 20 +- Data Transfers/Explorer++.cmd | 20 +- Data Transfers/FastCopy (as ADMIN).cmd | 28 +- Data Transfers/FastCopy.cmd | 28 +- Data Transfers/KVRT.cmd | 26 +- Data Transfers/Q-Dir.cmd | 31 + Data Transfers/Transferred Keys.cmd | 33 +- Data Transfers/User Data Transfer.cmd | 31 + Diagnostics/AIDA64.cmd | 20 +- Diagnostics/BatteryInfoView.cmd | 20 +- Diagnostics/BleachBit.cmd | 20 +- Diagnostics/BlueScreenView.cmd | 20 +- .../{ => Extras}/Auslogics DiskDefrag.cmd | 20 +- .../Autoruns (with VirusTotal Scan).cmd} | 20 +- Diagnostics/{ => Extras}/BIOSCodes.cmd | 20 +- Diagnostics/{ => Extras}/CPU-Z.cmd | 20 +- Diagnostics/{ => Extras}/ERUNT.cmd | 26 +- Diagnostics/{ => Extras}/HeavyLoad.cmd | 20 +- .../{ => Extras}/HitmanPro (FullBreach).cmd | 26 +- .../MailPasswordView (as ADMIN).cmd | 22 +- Diagnostics/{ => Extras}/MailPasswordView.cmd | 22 +- Diagnostics/GpuTest.cmd | 20 +- Diagnostics/HWMonitor.cmd | 20 +- Diagnostics/HWiNFO (Sensors).cmd | 39 + Diagnostics/HWiNFO.cmd | 39 + Diagnostics/HitmanPro.cmd | 26 +- Diagnostics/ProduKey.cmd | 71 +- Diagnostics/SIV.cmd | 31 + Drivers/Auto Detect - Acer.cmd | 20 +- Drivers/Auto Detect - Dell.cmd | 20 +- Drivers/Auto Detect - HP.cmd | 20 +- Drivers/Auto Detect - Intel.cmd | 20 +- Drivers/Auto Detect - Lenovo.cmd | 20 +- Drivers/Auto Detect - SDI.cmd | 20 +- Drivers/Auto Detect - Toshiba.cmd | 20 +- Drivers/GPU - AMD.cmd | 20 +- Drivers/GPU - Gaming Evolved (AMD).cmd | 39 - Drivers/GPU - GeForce Experience.cmd | 39 - Drivers/GPU - NVIDIA.cmd | 31 + Drivers/SSD - ExpressCache.cmd | 20 +- Drivers/SSD - Intel.cmd | 20 +- Drivers/SSD - Samsung.cmd | 20 +- Enter SafeMode.cmd | 20 +- Exit SafeMode.cmd | 20 +- Final Checklist.cmd | 22 +- .../2007 Microsoft Office system (SP3).cmd | 20 +- .../Extras/Office/2007/Access 2007 (SP3).cmd | 20 +- .../Extras/Office/2007/AccessRuntime2007.cmd | 20 +- .../2007/Home and Student 2007 (SP3).cmd | 20 +- .../Extras/Office/2007/Outlook 2007 (SP3).cmd | 20 +- .../Office/2007/Professional 2007 (SP3).cmd | 20 +- .../Office/2007/Publisher 2007 (SP3).cmd | 20 +- .../Office/2007/Small Business 2007 (SP3).cmd | 20 +- .../Office/2010/Outlook 2010 (SP2) (x32).cmd | 20 +- .../Office/2010/Outlook 2010 (SP2) (x64).cmd | 20 +- .../2010/Professional Plus 2010 (SP2).cmd | 20 +- .../Office/2010/Publisher 2010 (SP2).cmd | 20 +- .../Office/2010/Single Image 2010 (SP2).cmd | 20 +- .../Office/2013/Home and Business 2013.cmd | 20 +- .../Office/2013/Home and Student 2013.cmd | 20 +- .../Office/2013/Professional Plus 2013.cmd | 20 +- .../Office/2016/Home and Business 2016.cmd | 20 +- .../Office/2016/Home and Student 2016.cmd | 20 +- Installers/SW Bundle.cmd | 31 + Misc/Cmder (as ADMIN).cmd | 39 - Misc/Cmder.cmd | 39 - Misc/ConEmu (as ADMIN).cmd | 31 + Misc/ConEmu.cmd | 31 + Misc/DeviceRemover.cmd | 20 +- Misc/Explorer++.cmd | 20 +- Misc/Fix Missing Optical Drive.reg | 6 + Misc/Notepad2.cmd | 20 +- .../OutlookAttachView (as ADMIN).cmd | 22 +- {Diagnostics => Misc}/OutlookAttachView.cmd | 22 +- Misc/PerfMonitor2.cmd | 20 +- Misc/Q-Dir.cmd | 31 + Misc/SysinternalsSuite.cmd | 20 +- Misc/WinDirStat.cmd | 20 +- Misc/XMPlay.cmd | 21 +- Misc/_Update Kit.cmd | 29 +- Repairs/AdwCleaner.cmd | 20 +- Repairs/Autoruns.cmd | 20 +- Repairs/CHKDSK (Fix).cmd | 20 +- Repairs/CHKDSK.cmd | 20 +- Repairs/Complete Internet Repair.cmd | 26 +- Repairs/DISM.cmd | 20 +- Repairs/ESET & KVRT.cmd | 26 +- Repairs/JRT.cmd | 20 +- Repairs/MBAM.cmd | 22 +- Repairs/RKill.cmd | 28 +- Repairs/SAS (Deprecated).cmd | 20 +- Repairs/SFC Scan.cmd | 20 +- ...ner (Testing).cmd => Shortcut Cleaner.cmd} | 20 +- Repairs/TDSSKiller.cmd | 30 +- Reset Browsers.cmd | 20 +- SW Diagnostics.cmd | 22 +- Uninstallers/IObit Uninstaller.cmd | 20 +- Uninstallers/MyUninstaller.cmd | 39 - Uninstallers/PC Decrapifier (Deprecated).cmd | 39 - Uninstallers/Removal Tools.cmd | 20 +- Uninstallers/Revo Uninstaller.cmd | 20 +- 140 files changed, 4696 insertions(+), 3091 deletions(-) delete mode 100644 .bin/Scripts/activate.ps1 create mode 100644 .bin/Scripts/activate.py rename .bin/Scripts/{os_check.ps1 => check_os.ps1} (78%) create mode 100644 .bin/Scripts/final_checklist.ps1 create mode 100644 .bin/Scripts/functions.py create mode 100644 .bin/Scripts/init_client_dir.cmd create mode 100644 .bin/Scripts/install_sw_bundle.py create mode 100644 .bin/Scripts/menu.py create mode 100644 .bin/Scripts/partition_uids.py create mode 100644 .bin/Scripts/sw_diagnostics.ps1 create mode 100644 .bin/Scripts/update_kit.ps1 create mode 100644 .bin/Scripts/update_kit.py delete mode 100644 .bin/Scripts/update_tools.ps1 create mode 100644 .bin/Scripts/user_data_transfer.py delete mode 100644 .bin/cmder_mini/vendor/conemu-maximus5/ConEmu.xml create mode 100644 Activate Windows.cmd delete mode 100644 Activation/Activate Windows (with BIOS key).cmd delete mode 100644 Battery Health.cmd create mode 100644 Data Transfers/Q-Dir.cmd create mode 100644 Data Transfers/User Data Transfer.cmd rename Diagnostics/{ => Extras}/Auslogics DiskDefrag.cmd (64%) rename Diagnostics/{Autoruns.cmd => Extras/Autoruns (with VirusTotal Scan).cmd} (86%) rename Diagnostics/{ => Extras}/BIOSCodes.cmd (63%) rename Diagnostics/{ => Extras}/CPU-Z.cmd (62%) rename Diagnostics/{ => Extras}/ERUNT.cmd (56%) rename Diagnostics/{ => Extras}/HeavyLoad.cmd (63%) rename Diagnostics/{ => Extras}/HitmanPro (FullBreach).cmd (58%) rename Diagnostics/{ => Extras}/MailPasswordView (as ADMIN).cmd (71%) rename Diagnostics/{ => Extras}/MailPasswordView.cmd (71%) create mode 100644 Diagnostics/HWiNFO (Sensors).cmd create mode 100644 Diagnostics/HWiNFO.cmd create mode 100644 Diagnostics/SIV.cmd delete mode 100644 Drivers/GPU - Gaming Evolved (AMD).cmd delete mode 100644 Drivers/GPU - GeForce Experience.cmd create mode 100644 Drivers/GPU - NVIDIA.cmd create mode 100644 Installers/SW Bundle.cmd delete mode 100644 Misc/Cmder (as ADMIN).cmd delete mode 100644 Misc/Cmder.cmd create mode 100644 Misc/ConEmu (as ADMIN).cmd create mode 100644 Misc/ConEmu.cmd create mode 100644 Misc/Fix Missing Optical Drive.reg rename {Diagnostics => Misc}/OutlookAttachView (as ADMIN).cmd (72%) rename {Diagnostics => Misc}/OutlookAttachView.cmd (72%) create mode 100644 Misc/Q-Dir.cmd rename Repairs/{Shortcut Cleaner (Testing).cmd => Shortcut Cleaner.cmd} (63%) delete mode 100644 Uninstallers/MyUninstaller.cmd delete mode 100644 Uninstallers/PC Decrapifier (Deprecated).cmd diff --git a/.bin/Scripts/Launch.cmd b/.bin/Scripts/Launch.cmd index c8a4d0ea..c154a5c3 100644 --- a/.bin/Scripts/Launch.cmd +++ b/.bin/Scripts/Launch.cmd @@ -1,9 +1,15 @@ +:: Wizard Kit: Wrapper for launching programs and scripts. +:: +:: Some features: +:: * If the OS is 64-bit then the WorkingDir is scanned for a 64-bit version of the programs +:: * Allows for centralized terminal emulation settings management +:: * Allows for smaller "launcher" scripts to be used as they will rely on this script. + @echo off :Init setlocal EnableDelayedExpansion -color 1b -title WK Launcher +title Wizard Kit: Launcher :Flags set admin= @@ -11,15 +17,28 @@ set max= set wait= for %%f in (%*) do ( if /i "%%f" == "/DEBUG" (@echo on) - if /i "%%f" == "/admin" (@set admin=true) - if /i "%%f" == "/max" (@set max=true) - if /i "%%f" == "/wait" (@set wait=true) + if /i "%%f" == "/admin" (set admin=true) + if /i "%%f" == "/max" (set max=true) + if /i "%%f" == "/wait" (set wait=true) ) +:FindBin +set bin= & pushd "%~dp0" +:FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner +:FindBinDone +set "bin=%cd%\.bin" & popd + :SetVariables if /i "!PROCESSOR_ARCHITECTURE!" == "AMD64" set "arch=64" -set "con=%~dp0\..\cmder_mini\vendor\conemu-maximus5\ConEmu.exe" -if !arch! equ 64 set "con=%~dp0\..\cmder_mini\vendor\conemu-maximus5\ConEmu.exe" +set "con=%bin%\ConEmu\ConEmu.exe" +set "python=%bin%\Python\x32\python.exe" +if !arch! equ 64 ( + set "con=%bin%\ConEmu\ConEmu64.exe" + set "python=%bin%\Python\x64\python.exe" +) :Launch pushd "%2" @@ -27,6 +46,7 @@ if /i "%1" == "Console" (goto LaunchConsole) if /i "%1" == "Office" (goto LaunchOfficeSetup) if /i "%1" == "Program" (goto LaunchProgram) if /i "%1" == "PSScript" (goto LaunchPSScript) +if /i "%1" == "PyScript" (goto LaunchPyScript) goto Usage :LaunchConsole @@ -44,7 +64,7 @@ goto Done :LaunchOfficeSetup set "prog=%~3" -start "" "%con%" -cmd call "copy_office.cmd" "!prog!" -new_console:n +start "" "%con%" -cmd call "%bin%\copy_office.cmd" "!prog!" -new_console:n goto Done :LaunchProgram @@ -53,11 +73,12 @@ if !arch! equ 64 ( if exist "!prog:.=64.!" set "prog=!prog:.=64.!" ) if not exist "!prog!" goto ProgramNotFound -if not "%~4" == "" (set "ps_args=-argumentlist '%~4'") +if not "%~4" == "" (set "vb_args=%~4") if defined admin ( - if defined max (set "max=-WindowStyle Maximized") - if defined wait (set "wait=-Wait") - powershell -command "& {start '!prog!' !ps_args! -verb runas !max! !wait!}" + mkdir "%bin%\tmp" + echo Set UAC = CreateObject^("Shell.Application"^) > "%bin%\tmp\Elevate.vbs" + echo UAC.ShellExecute "!prog!", "!vb_args!", "", "runas", 1 >> "%bin%\tmp\Elevate.vbs" + cscript //nologo "%bin%\tmp\Elevate.vbs" ) else ( if defined max (set "max=/max") if defined wait (set "wait=/wait") @@ -70,18 +91,30 @@ set "script=%~3" if not exist "!script!" goto ScriptNotFound if defined wait (set "wait=-Wait") if defined admin ( - start "" "%con%" -cmd PowerShell -ExecutionPolicy Bypass -File "!script!" -NoProfile -new_console:a !wait! + start "" "%con%" -run PowerShell -ExecutionPolicy Bypass -File "!script!" -NoProfile -new_console:a !wait! ) else ( - start "" "%con%" -cmd PowerShell -ExecutionPolicy Bypass -File "!script!" -NoProfile !wait! + start "" "%con%" -run PowerShell -ExecutionPolicy Bypass -File "!script!" -NoProfile !wait! +) +goto Done + +:LaunchPyScript +set "script=%~3" +if not exist "!script!" goto ScriptNotFound +if defined admin ( + start "" "%con%" -run "%python%" "!script!" -new_console:a -new_console:n +) else ( + start "" "%con%" -run "%python%" "!script!" -new_console:n ) goto Done :Usage echo. echo.Usage: Launch.cmd Console "Working Dir" "Program" "Args" [/admin] +echo. Launch.cmd Office "Working Dir" "Product" "" echo. Launch.cmd Program "Working Dir" "Program" "Args" [/admin] [/max] [/wait] echo. Launch.cmd PSScript "Working Dir" "Program" "" [/admin] [/wait] -echo. (Args should be empty when using PSScript) +echo. Launch.cmd PyScript "Working Dir" "Program" "" [/admin] +echo. (Args should be empty when using PSScript or PyScript) echo. goto Abort @@ -109,5 +142,4 @@ goto Exit :Exit popd -color endlocal \ No newline at end of file diff --git a/.bin/Scripts/activate.ps1 b/.bin/Scripts/activate.ps1 deleted file mode 100644 index 150fb333..00000000 --- a/.bin/Scripts/activate.ps1 +++ /dev/null @@ -1,70 +0,0 @@ -# WK-Activate-w-BIOS-Key -# -## Finds the BIOS key using ProduKey and attempts to activate Windows with it -## NOTE: This script doesn't check if the key is accepted before activation. - -## Init ## -$wd = $(Split-Path $MyInvocation.MyCommand.Path) -pushd "$wd" -. .\init.ps1 -clear -$host.UI.RawUI.WindowTitle = "WK Activation Tool" -$logpath = "$WKPath\Info\$date" -md "$logpath" 2>&1 | out-null -$log = "$logpath\Activation.log" -$bin = (Get-Item $wd).Parent.FullName -$found_key = $false -$sz = "$bin\7-Zip\7za.exe" -$produkey = "$bin\tmp\ProduKey.exe" - -# OS Check -. .\os_check.ps1 -if ($arch -eq 64) { - $sz = "$bin\7-Zip\7za64.exe" - $produkey = "$bin\tmp\ProduKey64.exe" -} - -## Extract ProduKey -md "$bin\tmp" 2>&1 | out-null -start -wait $sz -argumentlist @("e", "$bin\ProduKey.7z", "-otmp", "-aoa", "-pAbracadabra", "-bsp0", "-bso0") -workingdirectory "$bin" -nonewwindow -rm "$bin\tmp\ProduKey*.cfg" -sleep -s 1 - -## Get Key ## -$produkey_args = @( - "/nosavereg", - "/scomma", "$logpath\keys.csv", - "/WindowsKeys", "1", - "/OfficeKeys", "0", - "/IEKeys", "0", - "/SQLKeys", "0", - "/ExchangeKeys", "0" -) -start -wait $produkey -argumentlist $produkey_args -workingdirectory "$bin\tmp" -$keys = import-csv -header ("Name", "ID", "Key") "$logpath\keys.csv" - -## Find BIOS Key and activate Windows with it -foreach ($k in $keys) { - $name = $k.Name - $key = $k.Key - if ($name -match 'BIOS' -and $key -match '^(\w{5}-\w{5}-\w{5}-\w{5}-\w{5})$') { - # NOTE: Assuming first match is correct and skip everything afterwards - $found = $true - wk-write "$name key found: $key" "$log" - if (ask " Activate Windows using this key?" "$log") { - start -wait "cscript.exe" -argumentlist @("slmgr.vbs", "/ipk", "$key", "//nologo") -nonewwindow -workingdirectory "$windir\System32" - start -wait "cscript.exe" -argumentlist @("slmgr.vbs", "/ato", "//nologo") -nonewwindow -workingdirectory "$windir\System32" - start -wait "cscript.exe" -argumentlist @("slmgr.vbs", "/xpr", "//nologo") -nonewwindow -workingdirectory "$windir\System32" - } - break - } -} - -## Print error if necessary -if (! $found) { - wk-error "BIOS Key not found." "$log" -} - -## Done ## -popd -pause "Press Enter to exit..." diff --git a/.bin/Scripts/activate.py b/.bin/Scripts/activate.py new file mode 100644 index 00000000..61e36e04 --- /dev/null +++ b/.bin/Scripts/activate.py @@ -0,0 +1,109 @@ +# Wizard Kit: Activate Windows using various methods + +import csv +import os +import re +import subprocess + +# Init +os.chdir(os.path.dirname(os.path.realpath(__file__))) +os.system('title Wizard Kit: Windows Activation Tool') +from functions import * +vars = init_vars() +vars_os = init_vars_os() +vars['ProduKey'] = '{BinDir}\\tmp\\ProduKey.exe'.format(**vars) +vars['SevenZip'] = '{BinDir}\\7-Zip\\7za.exe'.format(**vars) +if vars_os['Arch'] == 64: + vars['SevenZip'] = vars['SevenZip'].replace('7za.exe', '7za64.exe') + vars['ProduKey'] = vars['ProduKey'].replace('ProduKey.exe', 'ProduKey64.exe') + +def abort(): + print_warning('Aborted.') + exit_script() + +def exit_script(): + pause("Press Enter to exit...") + quit() + +def extract_produkey(): + """Extract ProduKey and remove stale configuration file(s).""" + lolwut = run_program(vars['SevenZip'], ['e', '{BinDir}\\ProduKey.7z'.format(**vars), '-o{TmpDir}'.format(**vars), '-pAbracadabra', '-aoa', '-bsp0', '-bso0'], check=False) + _cwd = os.getcwd() + os.chdir('{TmpDir}'.format(**vars)) + for _f in ['ProduKey.cfg', 'ProduKey64.cfg']: + try: + os.remove(_f) + except FileNotFoundError: + pass + os.chdir(_cwd) + +def activate_with_bios(): + """Attempt to activate Windows with a key stored in the BIOS.""" + extract_produkey() + _args = [ + '/nosavereg', + '/scomma', '{TmpDir}\\keys.csv'.format(**vars), + '/WindowsKeys', '1', + '/OfficeKeys', '0', + '/IEKeys', '0', + '/SQLKeys', '0', + '/ExchangeKeys', '0'] + try: + run_program(vars['ProduKey'], _args, pipe=False) + with open ('{TmpDir}\\keys.csv'.format(**vars), newline='') as key_file: + key_reader = csv.reader(key_file) + _key_found = False + for key in key_reader: + if 'BIOS' in key[0] and re.match(r'^\w{5}-\w{5}-\w{5}-\w{5}-\w{5}$', key[2]): + _key_found = True + print_standard('BIOS key found, installing...') + run_program('cscript {WINDIR}\\System32\\slmgr.vbs /ipk {pkey} //nologo'.format(**vars['Env'], pkey=key[2]), check=False, shell=True) + sleep(15) + print_standard('Attempting activation...') + run_program('cscript {WINDIR}\\System32\\slmgr.vbs /ato //nologo'.format(**vars['Env']), check=False, shell=True) + sleep(15) + # Open system properties for user verification + subprocess.Popen(['control', 'system']) + break + if not _key_found: + print_error('ERROR: BIOS not key found.') + abort() + except subprocess.CalledProcessError: + print_error('ERROR: Failed to extract BIOS key') + abort() + +def activate_with_hive(): + """Scan any transferred software hives for Windows keys and attempt activation.""" + # extract_produkey() + pass + +if __name__ == '__main__': + # Bail early if already activated + if 'The machine is permanently activated.' in vars_os['Activation']: + print_info('This system is already activated') + # exit_script() + + # Determine activation method + activation_methods = [ + {'Name': 'Activate with BIOS key', 'Function': activate_with_bios}, + {'Name': 'Activate with transferred SW hive', 'Function': activate_with_hive, 'Disabled': True}, + ] + if not re.match(r'^(8|10)$', vars_os['Version']): + activation_methods[0]['Disabled'] = True + actions = [ + {'Name': 'Quit', 'Letter': 'Q'}, + ] + + # Main loop + while True: + selection = menu_select('Wizard Kit: Windows Activation Menu', activation_methods, actions) + + if (selection.isnumeric()): + activation_methods[int(selection)-1]['Function']() + break + elif selection == 'Q': + exit_script() + + # Quit + print_success('Done.') + exit_script() \ No newline at end of file diff --git a/.bin/Scripts/check_battery.ps1 b/.bin/Scripts/check_battery.ps1 index de265fe5..ab2ddac1 100644 --- a/.bin/Scripts/check_battery.ps1 +++ b/.bin/Scripts/check_battery.ps1 @@ -1,3 +1,5 @@ +# Wizard Kit: List battery health by checking the current max charge against the original value + param([string]$log = "Battery.log") if ($log -match '^Battery.log$') { $log = "{0}\Battery.log" -f (gci env:temp).value @@ -13,16 +15,16 @@ try { $message = " Last full charge was {0:N0}% of designed capacity" -f $last_percentage if ($last_percentage -eq 100) { - wk-warn " Unable to determine battery health" "$log" + WK-warn " Unable to determine battery health" "$log" } elseif ($last_percentage -ge 90) { - wk-write $message "$log" + WK-write $message "$log" } elseif ($last_percentage -ge 50) { - wk-warn $message "$log" + WK-warn $message "$log" } else { - wk-error $message "$log" + WK-error $message "$log" } } catch { - wk-warn " No battery detected" "$log" + WK-warn " No battery detected" "$log" } ## Done ## diff --git a/.bin/Scripts/check_disk.cmd b/.bin/Scripts/check_disk.cmd index 2e4076c3..0e898dda 100644 --- a/.bin/Scripts/check_disk.cmd +++ b/.bin/Scripts/check_disk.cmd @@ -8,7 +8,7 @@ for %%f in (%*) do ( ) :Init -title WK CheckDisk +title Wizard Kit: CheckDisk color 1b :ScheduleCheck diff --git a/.bin/Scripts/check_disk.ps1 b/.bin/Scripts/check_disk.ps1 index faeb4f61..3fda3c04 100644 --- a/.bin/Scripts/check_disk.ps1 +++ b/.bin/Scripts/check_disk.ps1 @@ -1,14 +1,14 @@ -# WK-Check Disk +# Wizard Kit: Check Disk ## Init ## $wd = $(Split-Path $MyInvocation.MyCommand.Path) pushd "$wd" . .\init.ps1 clear -$host.UI.RawUI.WindowTitle = "WK Check Disk Tool" +$host.UI.RawUI.WindowTitle = "Wizard Kit: Check Disk Tool" # OS Check -. .\os_check.ps1 +. .\check_os.ps1 ## Run Scan (read-only) ## write-host "$systemdrive (System Drive)" diff --git a/.bin/Scripts/check_disk_fix.ps1 b/.bin/Scripts/check_disk_fix.ps1 index 1e335f4c..593e8979 100644 --- a/.bin/Scripts/check_disk_fix.ps1 +++ b/.bin/Scripts/check_disk_fix.ps1 @@ -1,14 +1,14 @@ -# WK-Check Disk +# Wizard Kit: Check Disk ## Init ## $wd = $(Split-Path $MyInvocation.MyCommand.Path) pushd "$wd" . .\init.ps1 clear -$host.UI.RawUI.WindowTitle = "WK Check Disk Tool" +$host.UI.RawUI.WindowTitle = "Wizard Kit: Check Disk Tool" # OS Check -. .\os_check.ps1 +. .\check_os.ps1 ## Run Scan (fix) ## write-host "$systemdrive (System Drive)" diff --git a/.bin/Scripts/os_check.ps1 b/.bin/Scripts/check_os.ps1 similarity index 78% rename from .bin/Scripts/os_check.ps1 rename to .bin/Scripts/check_os.ps1 index f1d662dd..db5707ba 100644 --- a/.bin/Scripts/os_check.ps1 +++ b/.bin/Scripts/check_os.ps1 @@ -1,6 +1,4 @@ -# WK-OS Check -# -# Set some OS specific variables. +# Wizard Kit: Set some OS specific variables. $win_info = gp hklm:"\SOFTWARE\Microsoft\Windows NT\CurrentVersion" if ($win_info.CurrentVersion -match "6.0") { @@ -14,9 +12,7 @@ if ($win_info.CurrentVersion -match "6.0") { $win_version = "8" } elseif ($win_info.CurrentBuildNumber -match "9600") { $win_version = "8" - } elseif ($win_info.CurrentBuildNumber -match "10240") { - $win_version = "10" - } elseif ($win_info.CurrentBuildNumber -match "10586") { + } elseif ($win_info.CurrentBuildNumber -ge "10240") { $win_version = "10" } } @@ -39,10 +35,14 @@ $arch = $arch -ireplace 'AMD64', '64' # 6.3.9200 # === 8.1u == # 6.3.9600 -# === 10 == +# === 10 v1507 "Threshold 1" == # 6.3.10240 -# === 10 v1511 == +# === 10 v1511 "Threshold 2" == # 6.3.10586 +# === 10 v1607 "Anniversary Update" "Redstone 1" == +# 6.3.14393 +# === 10 v____ "Redstone 2" == +# 6.3. $os_name = $win_info.ProductName $os_name += " " + $win_info.CSDVersion @@ -51,6 +51,8 @@ if ($win_info.CurrentBuild -match "9600") { $os_name += " Update" } elseif ($win_info.CurrentBuild -match "10586") { $os_name += " Release 1511" +} elseif ($win_info.CurrentBuild -match "14393") { + $os_name += " Release 1607 Anniversary Update" } # Get activation status diff --git a/.bin/Scripts/checklist.ps1 b/.bin/Scripts/checklist.ps1 index c89654f6..f20351fd 100644 --- a/.bin/Scripts/checklist.ps1 +++ b/.bin/Scripts/checklist.ps1 @@ -109,21 +109,6 @@ if (test-path "$programfiles\SUPERAntiSpyware") { } } -## Block Windows 10 ## -if ($win_version -notmatch '^10$') { - # Kill GWX - taskkill /f /im gwx.exe - - # Block upgrade via registry - New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade" -Force 2>&1 | out-null - Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade" -Name "AllowOSUpgrade" -Value 0 -Type "DWord" | out-null - Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade" -Name "ReservationsAllowed" -Value 0 -Type "DWord" | out-null - New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Gwx" -Force 2>&1 | out-null - Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Gwx" -Name "DisableGwx" -Value 1 -Type "DWord" | out-null - New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Force 2>&1 | out-null - Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "DisableOSUpgrade" -Value 1 -Type "DWord" | out-null -} - ## Summary ## wk-write "" "$log" wk-write "Starting SW Checklist" "$log" @@ -136,14 +121,14 @@ if (!(test-path "$logpath\Registry")) { } # AIDA64 -if (!(test-path "$logpath\aida-keys.txt")) { +if (!(test-path "$logpath\keys-aida64.txt")) { wk-write "* Running AIDA64 (Product Keys)" "$log" - start -wait "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\aida-keys.txt", "/CUSTOM", "$bin\AIDA64\licenses.rpf", "/TEXT", "/SILENT", "/SAFEST") -workingdirectory "$bin\AIDA64" + start -wait "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\keys-aida64.txt", "/CUSTOM", "$bin\AIDA64\licenses.rpf", "/TEXT", "/SILENT", "/SAFEST") -workingdirectory "$bin\AIDA64" } -if (!(test-path "$logpath\aida-installed_programs.txt")) { +if (!(test-path "$logpath\program_list-aida64.txt")) { wk-write "* Running AIDA64 (SW listing)" "$log" - start -wait "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\aida-installed_programs.txt", "/CUSTOM", "$bin\AIDA64\installed_programs.rpf", "/TEXT", "/SILENT", "/SAFEST") -workingdirectory "$bin\AIDA64" + start -wait "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\program_list-aida64.txt", "/CUSTOM", "$bin\AIDA64\installed_programs.rpf", "/TEXT", "/SILENT", "/SAFEST") -workingdirectory "$bin\AIDA64" } if (!(test-path "$logpath\aida64.htm")) { @@ -151,6 +136,22 @@ if (!(test-path "$logpath\aida64.htm")) { start "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\aida64.html", "/CUSTOM", "$bin\AIDA64\full.rpf", "/HTML", "/SILENT") -workingdirectory "$bin\AIDA64" } +# SIV +if (!(test-path "$logpath\keys-siv.txt")) { + wk-write "* Running SIV (Product Keys)" "$log" + start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=[product-ids]=$logpath\keys-siv.txt") -workingdirectory "$bin\SIV" +} + +if (!(test-path "$logpath\program_list-siv.txt")) { + wk-write "* Running SIV (SW listing)" "$log" + start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=[software]=$logpath\program_list-siv.txt") -workingdirectory "$bin\SIV" +} + +if (!(test-path "$logpath\aida64.htm")) { + wk-write "* Running SIV (Full listing) in background" "$log" + start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=$logpath\siv.txt") -workingdirectory "$bin\SIV" +} + # Product Keys ## Extract md "$bin\tmp" 2>&1 | out-null @@ -159,9 +160,9 @@ rm "$bin\tmp\ProduKey*.cfg" sleep -s 1 ## Run -if (!(test-path "$logpath\keys.txt")) { +if (!(test-path "$logpath\keys-produkey.txt")) { wk-write "* Saving Product Keys" "$log" - start -wait $produkey -argumentlist @("/nosavereg", "/stext", "$logpath\keys.txt") -workingdirectory "$bin\tmp" + start -wait $produkey -argumentlist @("/nosavereg", "/stext", "$logpath\keys-produkey.txt") -workingdirectory "$bin\tmp" } # User Data @@ -252,7 +253,7 @@ out-file -encoding "ASCII" -filepath "$wd\psftp_batch" -inputobject $batch # Upload files $psftp_args = @( "-noagent", - "-i", "$bin\PuTTY\Wizard-Kit.ppk", + "-i", "$bin\PuTTY\WK.ppk", "$diag_user@$diag_server", "-b", "$wd\psftp_batch") start "$bin\PuTTY\PSFTP.exe" -argumentlist $psftp_args -wait -windowstyle minimized diff --git a/.bin/Scripts/copy_office.cmd b/.bin/Scripts/copy_office.cmd index 3b2884dd..eb13531b 100644 --- a/.bin/Scripts/copy_office.cmd +++ b/.bin/Scripts/copy_office.cmd @@ -8,57 +8,68 @@ for %%f in (%*) do ( :Init setlocal EnableDelayedExpansion -title WK Office Installer +title Wizard Kit: Office Installer color 1b echo Initializing... -set "pd=%cd%" -set "NAS=\\10.0.0.10\Office" -set "dest=%systemdrive%\WK\Office" -set "source=%~1" -pushd "!NAS!" -:VerifyCopyAndRun -if /i "!source!" == "" (goto UsageError) +:FindBin +set bin= & pushd "%~dp0" +:FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner +:FindBinDone +set "bin=%cd%\.bin" & popd -if /i "!source:~-3,3!" == "exe" ( - if not exist "!source!" goto OfficeNotFound - call :CopyFile "!source!" -) else if /i "!source:~-3,3!" == "msi" ( - if not exist "!source!" goto OfficeNotFound - call :CopyFile "!source!" -) else ( - if not exist "!source!\setup.exe" goto OfficeNotFound - call :CopyFolder "!source!" +:SetVariables +if /i "!PROCESSOR_ARCHITECTURE!" == "AMD64" set "arch=64" +set "fastcopy=%bin%\FastCopy\FastCopy.exe" +if !arch! equ 64 ( + set "fastcopy=%bin%\FastCopy\FastCopy64.exe" ) +set "fastcopy_args=/cmd=diff /no_ui /auto_close" +rem Create %client_dir%\Office +call "%bin%\Scripts\init_client_dir.cmd" /Office +set "product=%~1" +set "source=\\10.0.0.10\Office\%product%" +set "dest=%client_dir%\Office" + +:FileOrFolder +if /i "%source%" == "" goto UsageError +if /i "%source:~-3,3%" == "exe" goto CopyFile +if /i "%source:~-3,3%" == "msi" goto CopyFile +goto CopyFolder + +:CopyFile +if not exist "%source%" goto OfficeNotFound +echo Copying installer... +start "" /wait "%fastcopy%" %fastcopy_args% "%source%" /to="%dest%\%product:0,4%\" +:: Run Setup :: +start "" "%dest%\%product:0,4%\%product:~5%" goto Done -:: Sub-routines :: -:CopyFile -set "file=%~1" -echo Copying files... -mkdir "!dest!" > nul 2>&1 -robocopy /r:3 /w:0 "!file:~0,4!" "!dest!" "!file:~5!" -:: Run Setup :: -start "" "!dest!\!file:~5!" -goto :EOF - :CopyFolder -set "folder=%~1" -mkdir "!dest!\!folder!" > nul 2>&1 -robocopy /s /r:3 /w:0 "!folder!" "!dest!\!folder!" +if not exist "%source%\setup.exe" goto OfficeNotFound +echo Copying setup files... +start "" /wait "%fastcopy%" %fastcopy_args% "%source%" /to="%dest%\%product:0,4%\" :: Run Setup :: -if exist "!dest!\!folder!\configuration.xml" ( - pushd "!dest!\!folder!" +if exist "%dest%\%product:0,4%\configuration.xml" ( + pushd "%dest%\%product:0,4%" start "" "setup.exe" /configure popd ) else ( - start "" "!dest!\!folder!\setup.exe" + start "" "%dest%\%product:0,4%\setup.exe" ) -goto :EOF +goto Done :: Errors :: +:ErrorNoBin +popd +echo ERROR: ".bin" folder not found. +goto Abort + :OfficeNotFound -echo ERROR: "!source!" not found. +echo ERROR: "%source%" not found. goto Abort :UsageError @@ -71,21 +82,16 @@ goto Abort color 4e echo. echo Aborted. +echo. +echo Press any key to exit... +pause>nul goto Exit :Done -set silent=true echo. echo Done. goto Exit :Exit -rem if not defined silent ( -rem echo Press any key to exit... -rem pause>nul -rem ) -popd color endlocal - -:EOF diff --git a/.bin/Scripts/diagnostics.ps1 b/.bin/Scripts/diagnostics.ps1 index 30607c47..c99693c3 100644 --- a/.bin/Scripts/diagnostics.ps1 +++ b/.bin/Scripts/diagnostics.ps1 @@ -1,11 +1,11 @@ -# WK-Checklist +# Wizard Kit: Diagnostics Tool ## Init ## $wd = $(Split-Path $MyInvocation.MyCommand.Path) pushd "$wd" . .\init.ps1 clear -$host.UI.RawUI.WindowTitle = "WK Diagnostics Tool" +$host.UI.RawUI.WindowTitle = "Wizard Kit: Diagnostics Tool" $backup_path = "$WKPath\Backups\$username\$date" $logpath = "$WKPath\Info\$date" md "$backup_path" 2>&1 | out-null @@ -18,6 +18,7 @@ $diag_user = "wkdiag" $conemu = "$bin\cmder_mini\vendor\conemu-maximus5\ConEmu.exe" $sz = "$bin\7-Zip\7za.exe" $produkey = "$bin\tmp\ProduKey.exe" +$siv = "$bin\SIV\SIV.exe" # OS Check . .\os_check.ps1 @@ -25,6 +26,7 @@ if ($arch -eq 64) { $conemu = "$bin\cmder_mini\vendor\conemu-maximus5\ConEmu64.exe" $sz = "$bin\7-Zip\7za64.exe" $produkey = "$bin\tmp\ProduKey64.exe" + $siv = "$bin\SIV\SIV64.exe" } # Set Service Order @@ -187,14 +189,14 @@ if (!(test-path "$logpath\autoruns.arn")) { } # AIDA64 -if (!(test-path "$logpath\aida-keys.txt")) { +if (!(test-path "$logpath\keys-aida64.txt")) { wk-write "* Running AIDA64 (Product Keys)" "$log" - start -wait "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\aida-keys.txt", "/CUSTOM", "$bin\AIDA64\licenses.rpf", "/TEXT", "/SILENT", "/SAFEST") -workingdirectory "$bin\AIDA64" + start -wait "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\keys-aida64.txt", "/CUSTOM", "$bin\AIDA64\licenses.rpf", "/TEXT", "/SILENT", "/SAFEST") -workingdirectory "$bin\AIDA64" } -if (!(test-path "$logpath\aida-installed_programs.txt")) { +if (!(test-path "$logpath\program_list-aida64.txt")) { wk-write "* Running AIDA64 (SW listing)" "$log" - start -wait "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\aida-installed_programs.txt", "/CUSTOM", "$bin\AIDA64\installed_programs.rpf", "/TEXT", "/SILENT", "/SAFEST") -workingdirectory "$bin\AIDA64" + start -wait "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\program_list-aida64.txt", "/CUSTOM", "$bin\AIDA64\installed_programs.rpf", "/TEXT", "/SILENT", "/SAFEST") -workingdirectory "$bin\AIDA64" } if (!(test-path "$logpath\aida64.htm")) { @@ -202,6 +204,22 @@ if (!(test-path "$logpath\aida64.htm")) { start "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\aida64.html", "/CUSTOM", "$bin\AIDA64\full.rpf", "/HTML", "/SILENT") -workingdirectory "$bin\AIDA64" } +# SIV +if (!(test-path "$logpath\keys-siv.txt")) { + wk-write "* Running SIV (Product Keys)" "$log" + start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=[product-ids]=$logpath\keys-siv.txt") -workingdirectory "$bin\SIV" +} + +if (!(test-path "$logpath\program_list-siv.txt")) { + wk-write "* Running SIV (SW listing)" "$log" + start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=[software]=$logpath\program_list-siv.txt") -workingdirectory "$bin\SIV" +} + +if (!(test-path "$logpath\aida64.htm")) { + wk-write "* Running SIV (Full listing) in background" "$log" + start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=$logpath\siv.txt") -workingdirectory "$bin\SIV" +} + # Product Keys ## Extract md "$bin\tmp" 2>&1 | out-null @@ -210,24 +228,9 @@ rm "$bin\tmp\ProduKey*.cfg" sleep -s 1 ## Run -if (!(test-path "$logpath\keys.txt")) { +if (!(test-path "$logpath\keys-produkey.txt")) { wk-write "* Saving Product Keys" "$log" - start -wait $produkey -argumentlist @("/nosavereg", "/stext", "$logpath\keys.txt") -workingdirectory "$bin\tmp" -} - -# Block Windows 10 # -if ($win_version -notmatch '^10$') { - # Kill GWX - taskkill /f /im gwx.exe - - # Block upgrade via registry - New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade" -Force 2>&1 | out-null - Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade" -Name "AllowOSUpgrade" -Value 0 -Type "DWord" | out-null - Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade" -Name "ReservationsAllowed" -Value 0 -Type "DWord" | out-null - New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Gwx" -Force 2>&1 | out-null - Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Gwx" -Name "DisableGwx" -Value 1 -Type "DWord" | out-null - New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Force 2>&1 | out-null - Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "DisableOSUpgrade" -Value 1 -Type "DWord" | out-null + start -wait $produkey -argumentlist @("/nosavereg", "/stext", "$logpath\keys-produkey.txt") -workingdirectory "$bin\tmp" } ## Summary ## @@ -254,7 +257,7 @@ wk-write "" "$log" # List installed Office programs wk-write "==== Installed Office Programs ====" "$log" -$installed_office = (gc "$logpath\aida-installed_programs.txt") -imatch 'Office' | sort +$installed_office = (gc "$logpath\program_list-aida64.txt") -imatch 'Office' | sort foreach ($_ in $installed_office) { $_ = $_ -ireplace '^\s+(.*?)\s\s+.*', '$1' wk-write " $_" "$log" @@ -263,7 +266,7 @@ wk-write "" "$log" # Saved keys wk-write "==== Found Product Keys ====" "$log" -$keys = (gc "$logpath\keys.txt") -imatch '(product.name)' +$keys = (gc "$logpath\keys-produkey.txt") -imatch '(product.name)' foreach ($_ in $keys) { $_ = $_ -ireplace '^product name\s+: ', ' ' wk-write $_ "$log" @@ -333,7 +336,7 @@ out-file -encoding "ASCII" -filepath "$wd\psftp_batch" -inputobject $batch ## Upload files $psftp_args = @( "-noagent", - "-i", "$bin\PuTTY\Wizard-Kit.ppk", + "-i", "$bin\PuTTY\WK.ppk", "$diag_user@$diag_server", "-b", "$wd\psftp_batch") start "$bin\PuTTY\PSFTP.exe" -argumentlist $psftp_args -wait -windowstyle minimized diff --git a/.bin/Scripts/dism.ps1 b/.bin/Scripts/dism.ps1 index 150aef1d..2dbb2aa9 100644 --- a/.bin/Scripts/dism.ps1 +++ b/.bin/Scripts/dism.ps1 @@ -1,20 +1,20 @@ -# WK-DISM wrapper +# Wizard Kit: DISM wrapper ## Init ## $wd = $(Split-Path $MyInvocation.MyCommand.Path) pushd "$wd" . .\init.ps1 clear -$host.UI.RawUI.WindowTitle = "WK DISM wrapper" -$logpath = "$WKPath\Info\$date" +$host.UI.RawUI.WindowTitle = "Wizard Kit: DISM wrapper" +$logpath = "$ClientPath\Info\$date" md "$logpath" 2>&1 | out-null $log = "$logpath\DISM.log" $bin = (Get-Item $wd).Parent.FullName # OS Check -. .\os_check.ps1 +. .\check_os.ps1 if ($win_version -notmatch '^8|10$') { - wk-error "This tool is not intended for $os_name." + WK-error "This tool is not intended for $os_name." } else { # Get mode $modes = @( diff --git a/.bin/Scripts/enter_safemode.ps1 b/.bin/Scripts/enter_safemode.ps1 index aea7f2fa..85941a85 100644 --- a/.bin/Scripts/enter_safemode.ps1 +++ b/.bin/Scripts/enter_safemode.ps1 @@ -1,11 +1,11 @@ -# WK-Enter SafeMode +# Wizard Kit: Enter SafeMode by setting it as {default} ## Init ## $wd = $(Split-Path $MyInvocation.MyCommand.Path) pushd "$wd" . .\init.ps1 clear -$host.UI.RawUI.WindowTitle = "WK SafeMode Tool" +$host.UI.RawUI.WindowTitle = "Wizard Kit: SafeMode Tool" # Ask user if (!(ask "Enable booting to SafeMode (with Networking)?")) { diff --git a/.bin/Scripts/exit_safemode.ps1 b/.bin/Scripts/exit_safemode.ps1 index aa3ea99d..a4815b76 100644 --- a/.bin/Scripts/exit_safemode.ps1 +++ b/.bin/Scripts/exit_safemode.ps1 @@ -1,11 +1,11 @@ -# WK-Exit SafeMode +# Wizard Kit: Exit SafeMode removing safeboot from {default} ## Init ## $wd = $(Split-Path $MyInvocation.MyCommand.Path) pushd "$wd" . .\init.ps1 clear -$host.UI.RawUI.WindowTitle = "WK SafeMode Tool" +$host.UI.RawUI.WindowTitle = "Wizard Kit: SafeMode Tool" # Ask user if (!(ask "Disable booting to SafeMode?")) { diff --git a/.bin/Scripts/final_checklist.ps1 b/.bin/Scripts/final_checklist.ps1 new file mode 100644 index 00000000..92779c1c --- /dev/null +++ b/.bin/Scripts/final_checklist.ps1 @@ -0,0 +1,291 @@ +# Wizard Kit: Final Checklist + +## Init ## +$wd = $(Split-Path $MyInvocation.MyCommand.Path) +pushd "$wd" +. .\init.ps1 +clear +$host.UI.RawUI.WindowTitle = "Wizard Kit: Checklist Tool" +$logpath = "$ClientPath\Info\$date" +md "$logpath" 2>&1 | out-null +$log = "$logpath\Checklist.log" +$bin = (Get-Item $wd).Parent.FullName +$diag_dest = "/srv/Diagnostics" +$diag_server = "10.0.0.10" +$diag_user = "WKdiag" +$sz = "$bin\7-Zip\7za.exe" +$produkey = "$bin\tmp\ProduKey.exe" + +# OS Check +. .\check_os.ps1 +if ($arch -eq 64) { + $sz = "$bin\7-Zip\7za64.exe" + $produkey = "$bin\tmp\ProduKey64.exe" +} + +# Set Service Order +while ($service_order -notmatch '^\d+') { + $service_order = read-host "Please enter the service order number" + if ($service_order -notmatch '^\d+') { + write-host "ERROR: Invalid SO`r`n" -foreground "red" + } +} +clear +out-file -filepath "$logpath\TicketNumber" -inputobject $service_order -append +WK-write "Starting final checklist for Ticket #$service_order" "$log" +WK-write "" "$log" + +## Cleanup ## +WK-write "Pre-Checklist Cleanup" "$log" + +# Uninstall AdwCleaner +if (test-path "$systemdrive\AdwCleaner") { + try { + WK-write "* Uninstalling AdwCleaner" "$log" + move-item "$systemdrive\AdwCleaner\*log" "$ClientPath\Info\" + move-item "$systemdrive\AdwCleaner\*txt" "$ClientPath\Info\" + if (test-path "$systemdrive\AdwCleaner\Quarantine") { + move-item "$systemdrive\AdwCleaner\Quarantine" "$ClientPath\Quarantine\AdwCleaner" + } + remove-item "$systemdrive\AdwCleaner" -recurse + } catch { + WK-error " Failed to uninstall AdwCleaner; please remove manually." "$log" + } +} + +# Uninstall Autoruns +if (test-path "HKCU:\Software\Sysinternals\AutoRuns") { + WK-write "* Uninstalling Autoruns" "$log" + Remove-Item -Path HKCU:\Software\Sysinternals\AutoRuns -Recurse 2>&1 | out-null + if ((Get-ChildItem -Path HKCU:\Software\Sysinternals 2> out-null | Measure-Object).count -eq 0) { + Remove-Item -Path HKCU:\Software\Sysinternals 2>&1 | out-null + } +} + +# Uninstall ESET +if (test-path "$programfiles86\ESET\ESET Online Scanner") { + WK-write "* Uninstalling ESET" "$log" + start -wait "$programfiles86\ESET\ESET Online Scanner\OnlineScannerUninstaller.exe" -argumentlist "/s" + rm -path "$programfiles86\ESET\ESET Online Scanner" -recurse 2>&1 | out-null + if ((gci -path "$programfiles86\ESET" 2> out-null | Measure-Object).count -eq 0) { + rm -path "$programfiles86\ESET" 2>&1 | out-null + } +} + +# Move JRT logs & backups +if (test-path "$userprofile\Desktop\JRT*") { + WK-write "* Cleaning up JRT leftovers" "$log" + WK-warn " TODO" "$log" +} + +# Uninstall MBAM +if (test-path "$programfiles86\Malwarebytes") { + WK-warn "Malwarebytes Anti-Malware installation found." "$log" + if (ask " Uninstall?" "$log") { + WK-write "* Uninstalling Malwarebytes Anti-Malware" "$log" + WK-warn " TODO" "$log" + } +} + +# Move RKill logs & backups +if (test-path "$userprofile\Desktop\rkill*") { + WK-write "* Cleaning up RKill leftovers" "$log" + WK-warn " TODO" "$log" +} + +# Uninstall SUPERAntiSpyware +# It is always in programfiles (not x86) ?? +$sas_force_remove = $false +if (test-path "$programfiles\SUPERAntiSpyware") { + WK-warn "SUPERAntiSpyware installation found." "$log" + if (ask " Uninstall?" "$log") { + if (test-path "$programfiles\SUPERAntiSpyware\Uninstall.exe") { + WK-write "* Uninstalling SUPERAntiSpyware" "$log" + start -wait "$programfiles\SUPERAntiSpyware\Uninstall.exe" + } else { + WK-error "The SUPERAntiSpyware removal tool will be used as the installation is damaged" "$log" + $sas_force_remove = $true + } + } +} + +## Summary ## +WK-write "" "$log" +WK-write "Starting SW Checklist" "$log" +WK-write "" "$log" + +# Backup Registry +if (!(test-path "$logpath\Registry")) { + WK-write "* Backing up registry" "$log" + start -wait "$bin\Erunt\ERUNT.EXE" -argumentlist @("$logpath\Registry", "sysreg", "curuser", "otherusers", "/noprogresswindow") -workingdirectory "$bin\Erunt" +} + +# AIDA64 +if (!(test-path "$logpath\keys-aida64.txt")) { + WK-write "* Running AIDA64 (Product Keys)" "$log" + start -wait "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\keys-aida64.txt", "/CUSTOM", "$bin\AIDA64\licenses.rpf", "/TEXT", "/SILENT", "/SAFEST") -workingdirectory "$bin\AIDA64" +} + +if (!(test-path "$logpath\program_list-aida64.txt")) { + WK-write "* Running AIDA64 (SW listing)" "$log" + start -wait "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\program_list-aida64.txt", "/CUSTOM", "$bin\AIDA64\installed_programs.rpf", "/TEXT", "/SILENT", "/SAFEST") -workingdirectory "$bin\AIDA64" +} + +if (!(test-path "$logpath\aida64.htm")) { + WK-write "* Running AIDA64 (Full listing) in background" "$log" + start "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\aida64.html", "/CUSTOM", "$bin\AIDA64\full.rpf", "/HTML", "/SILENT") -workingdirectory "$bin\AIDA64" +} + +# SIV +if (!(test-path "$logpath\keys-siv.txt")) { + WK-write "* Running SIV (Product Keys)" "$log" + start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=[product-ids]=$logpath\keys-siv.txt") -workingdirectory "$bin\SIV" +} + +if (!(test-path "$logpath\program_list-siv.txt")) { + WK-write "* Running SIV (SW listing)" "$log" + start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=[software]=$logpath\program_list-siv.txt") -workingdirectory "$bin\SIV" +} + +if (!(test-path "$logpath\aida64.htm")) { + WK-write "* Running SIV (Full listing) in background" "$log" + start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=$logpath\siv.txt") -workingdirectory "$bin\SIV" +} + +# Product Keys +## Extract +md "$bin\tmp" 2>&1 | out-null +start -wait $sz -argumentlist @("e", "$bin\ProduKey.7z", "-otmp", "-aoa", "-pAbracadabra", "-bsp0", "-bso0") -workingdirectory "$bin" -nonewwindow +rm "$bin\tmp\ProduKey*.cfg" +sleep -s 1 + +## Run +if (!(test-path "$logpath\keys-produkey.txt")) { + WK-write "* Saving Product Keys" "$log" + start -wait $produkey -argumentlist @("/nosavereg", "/stext", "$logpath\keys-produkey.txt") -workingdirectory "$bin\tmp" +} + +# User Data +WK-write "==== User Data ====" "$log" +& "$wd\user_data.ps1" "$log" +WK-write "" "$log" + +# OS Info +WK-write "==== Operating System ====" "$log" +WK-write " $os_name x$arch" "$log" +WK-write "$win_act" "$log" +if ($win_act -notmatch "permanent") {slui} +WK-write "" "$log" + +# Set Timezone and sync clock +WK-write "==== Clock ====" "$log" +start "tzutil" -argumentlist @("/s", '"Pacific Standard Time"') -nonewwindow -redirectstandardoutput out-null +stop-service -name "w32time" 2>&1 | out-null +start "w32tm" -argumentlist @("/config", "/syncfromflags:manual", '/manualpeerlist:"us.pool.ntp.org time.nist.gov time.windows.com"') -nonewwindow -redirectstandardoutput out-null +start-service -name "w32time" 2>&1 | out-null +start "w32tm" -argumentlist "/resync" -nonewwindow -redirectstandardoutput out-null +# gross assumption that tz=PST (should've been set earlier) +WK-write $(get-date -uformat " %a %Y-%m-%d %H:%m (PST/PDT)") "$log" +WK-write "" "$log" + +### DISABLED FOR NOW ### +## Reset power plans +#WK-write "==== Reset Power Plans ====" "$log" +## Export current power plans +#$pow_backup_path = "$ClientPath\Backups\$date\Power Plans" +#md "$pow_backup_path" > $null 2>&1 | out-null +#$old_power_plans = @() +#foreach ($plan in (powercfg /L)) { +# if ($plan -imatch '^Power Scheme.*') { +# $guid = $plan -replace 'Power Scheme GUID:\s+([0-9a-f\-]+).*', '$1' +# $name = $plan -replace 'Power Scheme GUID:\s+[0-9a-f\-]+\s+\(([^\)]+)\).*', '$1' +# $set = ($plan -imatch '.*\*$') +# $old_power_plans += @{GUID = $guid; Name = $name; Set = $set} +# if (!(test-path "$pow_backup_path\$name.pow")) { +# powercfg /export "$pow_backup_path\$name.pow" $guid +# } +# } +#} +# +#start "powercfg.exe" -argumentlist "-restoredefaultschemes" -nonewwindow -redirectstandardoutput out-null +#WK-write " All power plans reset to defaults" "$log" +## TODO: Re-add and reset SSD plan(s) +#WK-warn " If the system has a SSD please verify the correct plan has been selected" "$log" +#WK-write "" "$log" +### DISABLED FOR NOW ### + +# Free Space +WK-write "==== Free Space ====" "$log" +& "$wd\free_space.ps1" "$log" +WK-write "" "$log" + +# RAM +WK-write "==== RAM ====" "$log" +& "$wd\installed_ram.ps1" "$log" +WK-write "" "$log" + +# Battery Check +WK-write "==== Battery Check ====" "$log" +& "$wd\check_battery.ps1" "$log" +WK-write "" "$log" + +## Launch Extra Tools ## +# HWMonitor +if ($arch -eq 64) { + $prog = "$bin\HWMonitor\HWMonitor64.exe" +} else { + $prog = "$bin\HWMonitor\HWMonitor.exe" +} +start $prog + +# XMPlay +start "$bin\..\Misc\XMPlay.cmd" + +## Upload info ## +write-host "Uploading info to NAS..." + +# Write batch +$batch = "lcd `"{0}`"`r`n" -f $ClientPath +$batch += "cd `"{0}`"`r`n" -f $diag_dest +$batch += "put -r Info `"{0}`"`r`n" -f $service_order +out-file -encoding "ASCII" -filepath "$wd\psftp_batch" -inputobject $batch + +# Upload files +$psftp_args = @( + "-noagent", + "-i", "$bin\PuTTY\WK.ppk", + "$diag_user@$diag_server", + "-b", "$wd\psftp_batch") +start "$bin\PuTTY\PSFTP.exe" -argumentlist $psftp_args -wait -windowstyle minimized + +## Done ## +popd +pause "Press Enter to review drivers and updates..." + +# Launch post progs +start devmgmt.msc +if ($win_version -eq 10) { + start ms-settings:windowsupdate +} else { + start wuapp +} + +# Launch SAS Removal Tool (if necessary) +if ($sas_force_remove) { + pushd "$bin\_Removal Tools" + if ($arch -eq 64) { + $prog = "SASUNINST64.exe" + } else { + $prog = "SASUNINST.exe" + } + start $prog + popd +} + +# Open log +$notepad2 = "$bin\Notepad2\Notepad2-Mod.exe" +if (test-path "$notepad2") { + start "$notepad2" -argumentlist $log +} else { + start "notepad" -argumentlist $log +} diff --git a/.bin/Scripts/free_space.ps1 b/.bin/Scripts/free_space.ps1 index 8d4e73c6..db9f0789 100644 --- a/.bin/Scripts/free_space.ps1 +++ b/.bin/Scripts/free_space.ps1 @@ -1,3 +1,5 @@ +# Wizard Kit: List free space for all drives + param([string]$log) cd $(Split-Path $MyInvocation.MyCommand.Path) @@ -28,5 +30,5 @@ foreach ($d in [char]'C'..[char]'Z') { } $drive[$x] = $tmp } - wk-write $(" {0} {1:N0}% Free ({2} / {3})" -f $letter, $percent, $drive[2], $drive[1]) $log + WK-write $(" {0} {1:N0}% Free ({2} / {3})" -f $letter, $percent, $drive[2], $drive[1]) $log } diff --git a/.bin/Scripts/functions.py b/.bin/Scripts/functions.py new file mode 100644 index 00000000..8d2c09c4 --- /dev/null +++ b/.bin/Scripts/functions.py @@ -0,0 +1,818 @@ +# Wizard Kit: Init + +import os +import partition_uids +import re +import shutil +import subprocess +import time +import winreg + +# Server info +BACKUP_SERVERS = [ + { 'IP': '10.0.0.10', + 'Mounted': False, + 'Name': 'ServerOne', + 'Share': 'Backups', + 'User': 'restore', + 'Pass': 'Abracadabra', + }, + { 'IP': '10.0.0.11', + 'Name': 'ServerTwo', + 'Mounted': False, + 'Share': 'Backups', + 'User': 'restore', + 'Pass': 'Abracadabra', + }, +] +OFFICE_SERVER = { + 'IP': '10.0.0.10', + 'Name': 'ServerOne', + 'Mounted': False, + 'Share': 'Office', + 'User': 'restore', # Using these credentials in case the backup shares are also mounted. + 'Pass': 'Abracadabra', # This is because Windows only allows one set of credentials to be used per server at a time. +} +WINDOWS_SERVER = { + 'IP': '10.0.0.10', + 'Name': 'ServerOne', + 'Mounted': False, + 'Share': 'Windows', + 'User': 'restore', # Using these credentials in case the backup shares are also mounted. + 'Pass': 'Abracadabra', # This is because Windows only allows one set of credentials to be used per server at a time. +} + +# Colors +COLORS = { + 'CLEAR': '\033[0m', + 'RED': '\033[31m', + 'GREEN': '\033[32m', + 'YELLOW': '\033[33m', + 'BLUE': '\033[34m'} + +# General functions +def ask(prompt='Kotaero'): + """Prompt the user with a Y/N question and return a bool.""" + answer = None + prompt = prompt + ' [Y/N]: ' + while answer is None: + tmp = input(prompt) + if re.search(r'^y(es|)$', tmp): + answer = True + elif re.search(r'^n(o|ope|)$', tmp): + answer = False + return answer + +def assign_volume_letters(): + """Assign a drive letter for all attached volumes.""" + with open(diskpart_script, 'w') as script: + script.write('list volume\n') + process_return = run_program('diskpart /s {script}'.format(script=diskpart_script)) + with open(diskpart_script, 'w') as script: + for tmp in re.findall(r'Volume (\d+)\s+([A-Za-z]?)\s+', process_return.stdout.decode()): + if tmp[1] == '': + script.write('select volume {number}\n'.format(number=tmp[0])) + script.write('assign\n') + try: + run_program('diskpart /s {script}'.format(script=diskpart_script)) + except: + pass + +def convert_to_bytes(size): + """Convert human-readable size str to bytes and return an int.""" + size = str(size) + tmp = re.search(r'(\d+)\s+([KMGT]B)', size.upper()) + if tmp: + size = int(tmp.group(1)) + units = tmp.group(2) + if units == 'TB': + size *= 1099511627776 + elif units == 'GB': + size *= 1073741824 + elif units == 'MB': + size *= 1048576 + elif units == 'KB': + size *= 1024 + else: + return -1 + + return size + +def find_windows_image(filename=None): + """Search for an image file on local and network drives and return a dict.""" + image = {} + + # Bail early + if filename is None: + raise Exception('Filename not specified.') + + # Search local source + process_return = run_program('mountvol') + for tmp in re.findall(r'.*([A-Za-z]):\\', process_return.stdout.decode()): + for ext in ['esd', 'wim', 'swm']: + if os.path.isfile('{drive}:\\images\\{filename}.{ext}'.format(drive=tmp[0], ext=ext, filename=filename)): + image['Ext'] = ext + image['File'] = '{drive}:\\images\\{filename}'.format(drive=tmp[0], filename=filename) + image['Glob'] = '--ref="{File}*.swm"'.format(**image) if ext == 'swm' else '' + image['Source'] = tmp[0] + break + + # Check for network source (if necessary) + if not any(image): + if not WINDOWS_SERVER['Mounted']: + mount_windows_share() + for ext in ['esd', 'wim', 'swm']: + if os.path.isfile('\\\\{IP}\\{Share}\\images\\{filename}.{ext}'.format(ext=ext, filename=filename, **WINDOWS_SERVER)): + image['Ext'] = ext + image['File'] = '\\\\{IP}\\{Share}\\images\\{filename}'.format(filename=filename, **WINDOWS_SERVER) + image['Glob'] = '--ref="{File}*.swm"'.format(**image) if ext == 'swm' else '' + image['Source'] = None + break + + # Display image to be used (if any) and return + if any(image): + print_info('Using image: {File}.{Ext}'.format(**image)) + return image + +def format_gpt(disk=None, windows_family=None): + """Format disk for use as a Windows OS drive using the GPT (UEFI) layout.""" + + # Bail early + if disk is None: + raise Exception('No disk provided.') + if windows_family is None: + raise Exception('No Windows family provided.') + + # Format drive + print_info('Drive will use a GPT (UEFI) layout.') + with open(diskpart_script, 'w') as script: + # Partition table + script.write('select disk {number}\n'.format(number=disk['Number'])) + script.write('clean\n') + script.write('convert gpt\n') + + # Windows RE tools partitions (Windows 8+) + if re.search(r'^(8|10)', windows_family): + script.write('create partition primary size=300\n') + script.write('format quick fs=ntfs label="Windows RE tools"\n') + script.write('assign letter="T"\n') + script.write('set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"\n') + script.write('gpt attributes=0x8000000000000001\n') + + # System partition + script.write('create partition efi size=260\n') # NOTE: Allows for Advanced Format 4K drives + script.write('format quick fs=fat32 label="System"\n') + script.write('assign letter="S"\n') + + # Microsoft Reserved (MSR) partition + script.write('create partition msr size=128\n') + + # Windows partition + script.write('create partition primary\n') + script.write('format quick fs=ntfs label="Windows"\n') + script.write('assign letter="W"\n') + + # Run script + print(' Formatting drive...') + run_program('diskpart /s {script}'.format(script=diskpart_script)) + time.sleep(2) + +def format_mbr(disk=None): + """Format disk for use as a Windows OS drive using the MBR (legacy) layout.""" + + # Bail early + if disk is None: + raise Exception('No disk provided.') + + # Format drive + print_info('Drive will use a MBR (legacy) layout.') + with open(diskpart_script, 'w') as script: + # Partition table + script.write('select disk {number}\n'.format(number=disk['Number'])) + script.write('clean\n') + + # System partition + script.write('create partition primary size=100\n') + script.write('format fs=ntfs quick label="System Reserved"\n') + script.write('active\n') + script.write('assign letter=s\n') + + # Windows partition + script.write('create partition primary\n') + script.write('format fs=ntfs quick label="Windows"\n') + script.write('assign letter=w\n') + + # Run script + print(' Formatting drive...') + run_program('diskpart /s {script}'.format(script=diskpart_script)) + time.sleep(2) + +def get_attached_disk_info(): + """Get details about the attached disks and return a list of dicts.""" + disks = [] + print_info('Getting drive info...') + + # Assign all the letters + assign_volume_letters() + + # Get disk numbers + with open(diskpart_script, 'w') as script: + script.write('list disk\n') + process_return = run_program('diskpart /s {script}'.format(script=diskpart_script)) + for tmp in re.findall(r'Disk (\d+)\s+\w+\s+(\d+\s+\w+)', process_return.stdout.decode()): + disks.append({'Number': tmp[0], 'Size': human_readable_size(tmp[1])}) + + # Get disk details + for disk in disks: + # Get partition style + with open(diskpart_script, 'w') as script: + script.write('select disk {Number}\n'.format(**disk)) + script.write('uniqueid disk\n') + process_return = run_program('diskpart /s {script}'.format(script=diskpart_script)) + if re.findall(r'Disk ID: {[A-Z0-9]+-[A-Z0-9]+-[A-Z0-9]+-[A-Z0-9]+-[A-Z0-9]+}', process_return.stdout.decode()): + disk['Table'] = 'GPT' + elif re.findall(r'Disk ID: 00000000', process_return.stdout.decode()): + disk['Table'] = 'RAW' + elif re.findall(r'Disk ID: [A-Z0-9]+', process_return.stdout.decode()): + disk['Table'] = 'MBR' + else: + disk['Table'] = 'Unknown' + + # Get disk name/model and physical details + with open(diskpart_script, 'w') as script: + script.write('select disk {Number}\n'.format(**disk)) + script.write('detail disk\n') + process_return = run_program('diskpart /s {script}'.format(script=diskpart_script)) + tmp = process_return.stdout.decode().strip().splitlines() + # Remove empty lines and those without a ':' and split each remaining line at the ':' to form a key/value pair + tmp = [s.strip() for s in tmp if s.strip() != ''] + # Set disk name + disk['Name'] = tmp[4] + tmp = [s.split(':') for s in tmp if ':' in s] + # Add new key/value pairs to the disks variable + disk.update({key.strip(): value.strip() for (key, value) in tmp}) + + # Get partition info for disk + with open(diskpart_script, 'w') as script: + script.write('select disk {Number}\n'.format(**disk)) + script.write('list partition\n') + process_return = run_program('diskpart /s {script}'.format(script=diskpart_script)) + disk['Partitions'] = [] + for tmp in re.findall(r'Partition\s+(\d+)\s+\w+\s+(\d+\s+\w+)\s+', process_return.stdout.decode().strip()): + disk['Partitions'].append({'Number': tmp[0], 'Size': human_readable_size(tmp[1])}) + for par in disk['Partitions']: + # Get partition details + with open(diskpart_script, 'w') as script: + script.write('select disk {Number}\n'.format(**disk)) + script.write('select partition {Number}\n'.format(**par)) + script.write('detail partition\n') + process_return = run_program('diskpart /s {script}'.format(script=diskpart_script)) + for tmp in re.findall(r'Volume\s+\d+\s+(\w|RAW)\s+', process_return.stdout.decode().strip()): + if tmp == 'RAW': + par['FileSystem'] = 'RAW' + else: + par['Letter'] = tmp + try: + process_return2 = run_program('fsutil fsinfo volumeinfo {Letter}:'.format(**par)) + for line in process_return2.stdout.decode().splitlines(): + line = line.strip() + # Get partition name + match = re.search(r'Volume Name\s+:\s+(.*)$', line) + if match: + par['Name'] = match.group(1).strip() + # Get filesystem type + match = re.search(r'File System Name\s+:\s+(.*)$', line) + if match: + par['FileSystem'] = match.group(1).strip() + usage = shutil.disk_usage('{Letter}:\\'.format(Letter=tmp)) + par['Used Space'] = human_readable_size(usage.used) + except subprocess.CalledProcessError: + par['FileSystem'] = 'Unknown' + # Get MBR type / GPT GUID for extra details on "Unknown" partitions + for tmp in re.findall(r'Type\s+:\s+(\S+)', process_return.stdout.decode().strip()): + par['Type'] = tmp + uid = partition_uids.lookup_guid(tmp) + if uid is not None: + par.update({ + 'Description': uid.get('Description', ''), + 'OS': uid.get('OS', '')}) + # Ensure the Name has been set + if 'Name' not in par: + par['Name'] = '' + if 'FileSystem' not in par: + par['FileSystem'] = 'Unknown' + + # Done + return disks + +def human_readable_size(size, decimals=0): + """Convert size in bytes to a human-readable format and return a str.""" + # Prep string formatting + width = 3+decimals + if decimals > 0: + width += 1 + human_format = '>{width}.{decimals}f'.format(width=width, decimals=decimals) + tmp = '' + + # Convert size to int + try: + size = int(size) + except ValueError: + size = convert_to_bytes(size) + + # Verify we have a valid size + if size <= 0: + return '{size:>{width}} b'.format(size='???', width=width) + + # Format string + if size >= 1099511627776: + size /= 1099511627776 + tmp = '{size:{human_format}} Tb'.format(size=size, human_format=human_format) + elif size >= 1073741824: + size /= 1073741824 + tmp = '{size:{human_format}} Gb'.format(size=size, human_format=human_format) + elif size >= 1048576: + size /= 1048576 + tmp = '{size:{human_format}} Mb'.format(size=size, human_format=human_format) + elif size >= 1024: + size /= 1024 + tmp = '{size:{human_format}} Kb'.format(size=size, human_format=human_format) + else: + tmp = '{size:{human_format}} b'.format(size=size, human_format=human_format) + + # Return + return tmp + +def menu_select(title='~ Untitled Menu ~', main_entries=[], action_entries=[], prompt='Please make a selection', secret_exit=False): + """Display options in a menu for user and return selected option as a str.""" + # Bail early + if (len(main_entries) + len(action_entries) == 0): + raise Exception("MenuError: No items given") + + # Build menu + menu_splash = '{title}\n\n'.format(title=title) + valid_answers = [] + if (secret_exit): + valid_answers.append('Q') + + # Add main entries + if (len(main_entries) > 0): + for i in range(len(main_entries)): + entry = main_entries[i] + # Add Spacer + if ('CRLF' in entry): + menu_splash += '\n' + if ('Disabled' in entry): + menu_splash += '{YELLOW}{number:>{mwidth}}: {name} (DISABLED){CLEAR}\n'.format(number=i+1, mwidth=len(str(len(main_entries))), name=entry.get('Display Name', entry['Name']), **COLORS) + else: + valid_answers.append(str(i+1)) + menu_splash += '{number:>{mwidth}}: {name}\n'.format(number=i+1, mwidth=len(str(len(main_entries))), name=entry.get('Display Name', entry['Name'])) + menu_splash += '\n' + + # Add action entries + if (len(action_entries) > 0): + for entry in action_entries: + # Add Spacer + if ('CRLF' in entry): + menu_splash += '\n' + valid_answers.append(entry['Letter']) + menu_splash += '{letter:>{mwidth}}: {name}\n'.format(letter=entry['Letter'].upper(), mwidth=len(str(len(action_entries))), name=entry['Name']) + menu_splash += '\n' + + answer = '' + + while (answer.upper() not in valid_answers): + os.system('cls') + print(menu_splash) + answer = input('{prompt}: '.format(prompt=prompt)) + + return answer.upper() + +def mount_backup_shares(): + """Mount the backup shares unless labeled as already mounted.""" + for server in BACKUP_SERVERS: + # Blindly skip if we mounted earlier + if server['Mounted']: + continue + else: + try: + # Test connection + run_program('ping -w 800 -n 2 {IP}'.format(**server)) + + # Mount + run_program('net use \\\\{IP}\\{Share} /user:{User} {Pass}'.format(**server)) + print_info('Mounted {Name}'.format(**server)) + server['Mounted'] = True + except subprocess.CalledProcessError: + print_error('Failed to mount \\\\{Name}\\{Share}, {IP} unreachable.'.format(**server)) + time.sleep(1) + except: + print_warning('Failed to mount \\\\{Name}\\{Share} ({IP})'.format(**server)) + time.sleep(1) + +def mount_windows_share(): + """Mount the Windows images share unless labeled as already mounted.""" + # Blindly skip if we mounted earlier + if WINDOWS_SERVER['Mounted']: + return None + else: + try: + # Test connection + run_program('ping -w 800 -n 2 {IP}'.format(**WINDOWS_SERVER)) + # Mount + run_program('net use \\\\{IP}\\{Share} /user:{User} {Pass}'.format(**WINDOWS_SERVER)) + print_info('Mounted {Name}'.format(**WINDOWS_SERVER)) + WINDOWS_SERVER['Mounted'] = True + except subprocess.CalledProcessError: + print_error('Failed to mount \\\\{Name}\\{Share}, {IP} unreachable.'.format(**WINDOWS_SERVER)) + time.sleep(1) + except: + print_warning('Failed to mount \\\\{Name}\\{Share}'.format(**WINDOWS_SERVER)) + time.sleep(1) + +def pause(prompt='Press Enter to continue... '): + """Simple pause implementation.""" + input(prompt) + +def print_error(message='Generic error', log_file=None, **kwargs): + """Prints message to screen in RED and writes it to log_file if provided.""" + print('{RED}{message}{CLEAR}'.format(message=message, **COLORS, **kwargs)) + if log_file is not None: + with open(log_file, 'a') as f: + f.write(message + '\n') + +def print_info(message='Generic info', log_file=None, **kwargs): + """Prints message to screen in BLUE and writes it to log_file if provided.""" + print('{BLUE}{message}{CLEAR}'.format(message=message, **COLORS, **kwargs)) + if log_file is not None: + with open(log_file, 'a') as f: + f.write(message + '\n') + +def print_warning(message='Generic warning', log_file=None, **kwargs): + """Prints message to screen in YELLOW and writes it to log_file if provided.""" + print('{YELLOW}{message}{CLEAR}'.format(message=message, **COLORS, **kwargs)) + if log_file is not None: + with open(log_file, 'a') as f: + f.write(message + '\n') + +def print_standard(message='Generic info', log_file=None, **kwargs): + """Prints message to screen and writes it to log_file if provided.""" + print('{message}'.format(message=message, **COLORS, **kwargs)) + if log_file is not None: + with open(log_file, 'a') as f: + f.write(message + '\n') + +def print_success(message='Generic success', log_file=None, **kwargs): + """Prints message to screen in GREEN and writes it to log_file if provided.""" + print('{GREEN}{message}{CLEAR}'.format(message=message, **COLORS, **kwargs)) + if log_file is not None: + with open(log_file, 'a') as f: + f.write(message + '\n') + +def remove_volume_letters(keep=None): + """Remove the assigned drive letter for all attached volumes.""" + with open(diskpart_script, 'w') as script: + script.write('list volume\n') + process_return = run_program('diskpart /s {script}'.format(script=diskpart_script)) + with open(diskpart_script, 'w') as script: + for tmp in re.findall(r'Volume (\d+)\s+([A-Za-z]?)\s+', process_return.stdout.decode()): + if tmp[1] != '' and tmp[1] != keep: + script.write('select volume {number}\n'.format(number=tmp[0])) + script.write('remove\n') + try: + run_program('diskpart /s {script}'.format(script=diskpart_script)) + except: + pass + +def run_program(cmd=None, args=[], check=True, pipe=True, shell=False): + """Run program and return a subprocess.CompletedProcess instance.""" + if cmd is None: + raise Exception('No program passed.') + + _cmd = cmd + if len(args) > 0: + _cmd = [cmd] + args + + if pipe: + process_return = subprocess.run(_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=check, shell=shell) + else: + process_return = subprocess.run(_cmd, check=check, shell=shell) + + return process_return + +def select_backup(ticket): + """Find any backups for the ticket stored on one of the BACKUP_SERVERS. Returns path as a os.DirEntry.""" + _backups = [] + mount_backup_shares() + for server in BACKUP_SERVERS: + if server['Mounted']: + for d in os.scandir('\\\\{IP}\\{Share}'.format(**server)): + if d.is_dir() and re.match('^{}'.format(ticket), d.name): + _backups.append({'Name': '{s_name}: {backup}'.format(s_name=server['Name'], backup=d.name), 'Dir': d}) + actions = [{'Name': 'Quit', 'Letter': 'Q'}] + + # Select backup path + if len(_backups) > 0: + selection = menu_select('Which backup are we using?', _backups, actions) + if selection == 'Q': + return None + else: + return _backups[int(selection)-1]['Dir'] + else: + print_error('No backups found for ticket: {ticket}.'.format(ticket=ticket)) + return None + +def select_destination(): + """Select backup destination and return a dict.""" + # Build menu + dests = [] + for server in BACKUP_SERVERS: + if server['Mounted']: + dests.append(server) + actions = [ + {'Name': 'Main Menu', 'Letter': 'M'}, + ] + + # Size check + for dest in dests: + if 'IP' in dest: + dest['Usage'] = shutil.disk_usage('\\\\{IP}\\{Share}'.format(**dest)) + else: + dest['Usage'] = shutil.disk_usage('{Letter}:\\'.format(**dest)) + dest['Free Space'] = human_readable_size(dest['Usage'].free) + dest['Display Name'] = '{Name} ({Free Space} available)'.format(**dest) + + # Show menu or bail + if len(dests) > 0: + selection = menu_select('Where are we backing up to?', dests, actions) + if selection == 'M': + return None + else: + return dests[int(selection)-1] + else: + print_warning('No backup destinations found.') + return None + +def select_disk(prompt='Which disk?'): + """Select a disk from the attached disks and return the disk number as an int.""" + disks = get_attached_disk_info() + + # Build menu + disk_options = [] + for disk in disks: + display_name = '{Size}\t[{Table}] ({Type}) {Name}'.format(**disk) + if len(disk['Partitions']) > 0: + pwidth=len(str(len(disk['Partitions']))) + for par in disk['Partitions']: + # Show unsupported partition(s) in RED + par_skip = False + if 'Letter' not in par or re.search(r'(RAW|Unknown)', par['FileSystem']): + par_skip = True + if par_skip: + display_name += COLORS['YELLOW'] + + # Main text + display_name += '\n\t\t\tPartition {Number:>{pwidth}}: {Size} ({FileSystem})'.format(pwidth=pwidth, **par) + if par['Name'] != '': + display_name += '\t"{Name}"'.format(**par) + + # Clear color (if set above) + if par_skip: + display_name += COLORS['CLEAR'] + else: + display_name += '{YELLOW}\n\t\t\tNo partitions found.{CLEAR}'.format(**COLORS) + disk_options.append({'Name': display_name, 'Disk': disk}) + actions = [ + {'Name': 'Main Menu', 'Letter': 'M'}, + ] + + # Menu loop + selection = menu_select(prompt, disk_options, actions) + + if (selection.isnumeric()): + return disk_options[int(selection)-1]['Disk'] + elif (selection == 'M'): + # -1 here means cancel + return -1 + +def select_minidump_path(): + """Have the user select from all found MiniDump locations and return a dict.""" + dumps = [] + + # Assign volume letters first + assign_volume_letters() + + # Search for minidumps + tmp = run_program('mountvol') + tmp = [d for d in re.findall(r'.*([A-Za-z]):\\', tmp.stdout.decode())] + # Remove RAMDisk letter + if 'X' in tmp: + tmp.remove('X') + for drive in tmp: + if os.path.exists('{drive}:\\Windows\\MiniDump'.format(drive=drive)): + dumps.append({'Name': '{drive}:\\Windows\\MiniDump'.format(drive=drive)}) + + # Check results before showing menu + if len(dumps) == 0: + print_error(' No BSoD / MiniDump paths found') + time.sleep(2) + return None + + # Menu + selection = menu_select('Which BSoD / MiniDump path are we scanning?', dumps, []) + return dumps[int(selection) - 1]['Name'] + +def select_windows_version(): + """Select Windows version and return a dict.""" + versions = [ + {'Name': 'Windows 7 Home Basic', + 'ImageFile': 'Win7', + 'ImageName': 'Windows 7 HOMEBASIC', + 'Family': '7'}, + {'Name': 'Windows 7 Home Premium', + 'ImageFile': 'Win7', + 'ImageName': 'Windows 7 HOMEPREMIUM', + 'Family': '7'}, + {'Name': 'Windows 7 Professional', + 'ImageFile': 'Win7', + 'ImageName': 'Windows 7 PROFESSIONAL', + 'Family': '7'}, + {'Name': 'Windows 7 Ultimate', + 'ImageFile': 'Win7', + 'ImageName': 'Windows 7 ULTIMATE', + 'Family': '7'}, + + {'Name': 'Windows 8.1', + 'ImageFile': 'Win8', + 'ImageName': 'Windows 8.1', + 'Family': '8', + 'CRLF': True}, + {'Name': 'Windows 8.1 Pro', + 'ImageFile': 'Win8', + 'ImageName': 'Windows 8.1 Pro', + 'Family': '8'}, + + {'Name': 'Windows 10 Home', + 'ImageFile': 'Win10', + 'ImageName': 'Windows 10 Home', + 'Family': '10', + 'CRLF': True}, + {'Name': 'Windows 10 Pro', + 'ImageFile': 'Win10', + 'ImageName': 'Windows 10 Pro', + 'Family': '10'}, + ] + actions = [ + {'Name': 'Main Menu', 'Letter': 'M'}, + ] + + # Menu loop + selection = menu_select('Which version of Windows are we installing?', versions, actions) + + if selection.isnumeric(): + return versions[int(selection)-1] + elif selection == 'M': + return None + +def sleep(seconds=2): + time.sleep(seconds) + +def umount_backup_shares(): + """Unnount the backup shares regardless of current status.""" + for server in BACKUP_SERVERS: + try: + # Umount + run_program('net use \\\\{IP}\\{Share} /delete'.format(**server)) + print_info('Umounted {Name}'.format(**server)) + server['Mounted'] = False + except: + print_error('Failed to umount \\\\{Name}\\{Share}.'.format(**server)) + time.sleep(1) + +# Init functions +def init_vars(): + """Sets common variables and returns a dict.""" + print('Initializing...') + # Find base path + _wd = os.getcwd() + _base = None + while _base is None: + if os.path.exists('.bin'): + _base = os.getcwd() + break + if re.fullmatch(r'\w:\\', os.getcwd()): + break + os.chdir('..') + os.chdir(_wd) + if _base is None: + print_error('".bin" not found.') + pause('Press any key to exit...') + quit() + + # Set vars + _vars = { + 'BaseDir': _base, + 'Date': time.strftime("%Y-%m-%d"), + 'Date-Time': time.strftime("%Y-%m-%d_%H%M_%z"), + 'Env': os.environ.copy() + } + _vars['BinDir'] = '{BaseDir}\\.bin'.format(**_vars) + _vars['ClientDir'] = '{SYSTEMDRIVE}\\WK'.format(**_vars['Env']) + _vars['LogDir'] = '{ClientDir}\\Info\\{Date}'.format(**_vars) + _vars['TmpDir'] = '{BinDir}\\tmp'.format(**_vars) + + return _vars + +def init_vars_os(): + """Sets variables relating to the installed OS and returns a dict.""" + print('Checking OS...') + _vars_os = {} + _env = os.environ.copy() + + # Query registry + _reg_path = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion') + for key in ['CSDVersion', 'CurrentBuild', 'CurrentBuildNumber', 'CurrentVersion', 'ProductName']: + try: + _vars_os[key] = winreg.QueryValueEx(_reg_path, key)[0] + if key in ['CurrentBuild', 'CurrentBuildNumber']: + _vars_os[key] = int(_vars_os[key]) + except ValueError: + # Couldn't convert Build to int so this should return interesting results... + _vars_os[key] = 0 + except: + _vars_os[key] = 'Unknown' + + # Determine Windows version + if _vars_os['CurrentVersion'] == '6.0': + _vars_os['Version'] = 'Vista' + elif _vars_os['CurrentVersion'] == '6.1': + _vars_os['Version'] = '7' + elif _vars_os['CurrentVersion'] == '6.2': + _vars_os['Version'] = '8' + elif _vars_os['CurrentVersion'] == '6.3': + if int(_vars_os['CurrentBuildNumber']) <= 9600: + _vars_os['Version'] = '8' + elif int(_vars_os['CurrentBuildNumber']) >= 10240: + _vars_os['Version'] = '10' + + # Determine OS bit depth + _vars_os['Arch'] = 32 + if 'PROGRAMFILES(X86)' in _env: + _vars_os['Arch'] = 64 + + # Determine OS Name + _vars_os['Name'] = '{ProductName} {CSDVersion}'.format(**_vars_os) + if _vars_os['CurrentBuild'] == 9600: + _vars_os['Name'] += ' Update' + if _vars_os['CurrentBuild'] == 10240: + _vars_os['Name'] += ' Release 1507 "Threshold 1"' + if _vars_os['CurrentBuild'] == 10586: + _vars_os['Name'] += ' Release 1511 "Threshold 2"' + if _vars_os['CurrentBuild'] == 14393: + _vars_os['Name'] += ' Release 1607 "Redstone 1" / "Anniversary Update"' + _vars_os['Name'] = _vars_os['Name'].replace('Service Pack ', 'SP') + _vars_os['Name'] = re.sub(r'\s+', ' ', _vars_os['Name']) + # == vista == + # 6.0.6000 + # 6.0.6001 + # 6.0.6002 + # ==== 7 ==== + # 6.1.7600 + # 6.1.7601 + # 6.1.7602 + # ==== 8 ==== + # 6.2.9200 + # === 8.1 === + # 6.3.9200 + # === 8.1u == + # 6.3.9600 + # === 10 v1507 "Threshold 1" == + # 6.3.10240 + # === 10 v1511 "Threshold 2" == + # 6.3.10586 + # === 10 v1607 "Anniversary Update" "Redstone 1" == + # 6.3.14393 + # === 10 v???? "Redstone 2" == + # 6.3.????? + + # Determine bootup type + _vars_os['SafeMode'] = False + if 'SAFEBOOT_OPTION' in _env: + _vars_os['SafeMode'] = True + + # Determine activation status + if _vars_os['SafeMode']: + _vars_os['Activation'] = 'Activation status unavailable in safe mode' + else: + _out = run_program('cscript /nologo {WINDIR}\\System32\\slmgr.vbs /xpr'.format(**_env)) + _out = _out.stdout.decode().splitlines() + _out = [l for l in _out if re.match(r'^\s', l)] + if len(_out) > 0: + _vars_os['Activation'] = re.sub(r'^\s+', '', _out[0]) + else: + _vars_os['Activation'] = 'Activation status unknown' + + return _vars_os + +if __name__ == '__main__': + print("This file is not meant to be called directly.") diff --git a/.bin/Scripts/init.ps1 b/.bin/Scripts/init.ps1 index fdf15a38..6d8a1a08 100644 --- a/.bin/Scripts/init.ps1 +++ b/.bin/Scripts/init.ps1 @@ -1,6 +1,4 @@ -# WK-Init -# -# Some common settings and functions +# Wizard Kit: Common settings and functions $host.UI.RawUI.BackgroundColor = "black" $host.UI.RawUI.ForegroundColor = "green" @@ -20,10 +18,10 @@ $programfiles86 = $programfiles if (test-path env:"programfiles(x86)") { $programfiles86 = (gci env:"programfiles(x86)").value } -$WKPath = "$systemdrive\WK" +$ClientPath = "$systemdrive\WK" $date = get-date -uformat "%Y-%m-%d" $date_time = get-date -uformat "%Y-%m-%d_%H%M" -$logpath = "$WKPath\Info\$date" +$logpath = "$ClientPath\Info\$date" function ask { param([string]$text = "Kotaero", [string]$log = "WK.log") @@ -43,17 +41,17 @@ function ask { out-file -filepath $log -inputobject $text -append return $answer } -function wk-error { +function WK-error { param([string]$text = "ERROR", [string]$log = "WK.log") write-host ($text) -foreground "red" out-file -filepath $log -inputobject $text -append } -function wk-warn { +function WK-warn { param([string]$text = "WARNING", [string]$log = "WK.log") write-host ($text) -foreground "yellow" out-file -filepath $log -inputobject $text -append } -function wk-write { +function WK-write { param([string]$text = "", [string]$log = "WK.log") write-host ($text) out-file -filepath $log -inputobject $text -append diff --git a/.bin/Scripts/init_client_dir.cmd b/.bin/Scripts/init_client_dir.cmd new file mode 100644 index 00000000..461e95c8 --- /dev/null +++ b/.bin/Scripts/init_client_dir.cmd @@ -0,0 +1,53 @@ +:: Wizard Kit: Create Info folder using current date + +@echo off + +:Flags +set _backups= +set _info= +set _office= +set _quarantine= +set _transfer= +for %%f in (%*) do ( + if /i "%%f" == "/DEBUG" (@echo on) + if /i "%%f" == "/Backups" set _backups=True + if /i "%%f" == "/Info" set _info=True + if /i "%%f" == "/Office" set _office=True + if /i "%%f" == "/Quarantine" set _quarantine=True + if /i "%%f" == "/Transfer" set _transfer=True +) + +:GetDate +:: Credit to SS64.com Code taken from http://ss64.com/nt/syntax-getdate.html +:: Use WMIC to retrieve date and time in ISO 8601 format. +for /f "skip=1 tokens=1-6" %%G in ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year /Format:table') do ( + if "%%~L"=="" goto s_done + set _yyyy=%%L + set _mm=00%%J + set _dd=00%%G + set _hour=00%%H + set _minute=00%%I +) +:s_done +:: Pad digits with leading zeros +set _mm=%_mm:~-2% +set _dd=%_dd:~-2% +set _hour=%_hour:~-2% +set _minute=%_minute:~-2% +set iso_date=%_yyyy%-%_mm%-%_dd% + +:SetVariables +set "client_dir=%systemdrive%\WK" +set "log_dir=%client_dir%\Info\%iso_date%" + +:CreateDirs +if defined _backups mkdir "%client_dir%\Backups">nul 2>&1 +if defined _info mkdir "%client_dir%\Info">nul 2>&1 +if defined _office mkdir "%client_dir%\Office">nul 2>&1 +if defined _quarantine mkdir "%client_dir%\Quarantine">nul 2>&1 +if defined _transfer mkdir "%client_dir%\Transfer">nul 2>&1 + +:Done +goto Exit + +:Exit \ No newline at end of file diff --git a/.bin/Scripts/install_sw_bundle.py b/.bin/Scripts/install_sw_bundle.py new file mode 100644 index 00000000..0b8f552e --- /dev/null +++ b/.bin/Scripts/install_sw_bundle.py @@ -0,0 +1,79 @@ +# Wizard Kit: Install the standard SW bundle based on the OS version + +import os +import re + +# Init +os.chdir(os.path.dirname(os.path.realpath(__file__))) +os.system('title Wizard Kit: SW Bundle Tool') +from functions import * +vars = init_vars() +vars_os = init_vars_os() + +if __name__ == '__main__': + # Adobe Reader + if vars_os['Version'] != 'Vista': + print('Installing Adobe Reader DC...') + _prog = '{BaseDir}/Installers/Extras/Office/Adobe Reader DC.exe'.format(**vars) + _args = ['/sAll', '/msi', '/norestart', '/quiet', 'ALLUSERS=1', 'EULA_ACCEPT=YES'] + try: + run_program(_prog, _args) + except: + print_error('Failed to install Adobe Reader DC') + + # Visual C++ Redists + print('Installing Visual C++ Runtimes...') + os.chdir('{BinDir}/_vcredists'.format(**vars)) + _redists = [ + # 2005 + {'Prog': 'msiexec', + 'Args': ['/i', '2005sp1\\x86\\vcredist.msi', '/qb!', '/norestart']}, + {'Prog': 'msiexec', + 'Args': ['/i', '2005sp1\\x64\\vcredist.msi', '/qb!', '/norestart']}, + # 2008 + {'Prog': '2008sp1\\vcredist_x86.exe', + 'Args': ['/qb! /norestart']}, + {'Prog': '2008sp1\\vcredist_x64.exe', + 'Args': ['/qb! /norestart']}, + # 2010 + {'Prog': '2010\\vcredist_x86.exe', + 'Args': ['/passive', '/norestart']}, + {'Prog': '2010\\vcredist_x64.exe', + 'Args': ['/passive', '/norestart']}, + # 2012 + {'Prog': '2012u4\\vcredist_x86.exe', + 'Args': ['/passive', '/norestart']}, + {'Prog': '2012u4\\vcredist_x64.exe', + 'Args': ['/passive', '/norestart']}, + # 2013 + {'Prog': '2013\\vcredist_x86.exe', + 'Args': ['/install', '/passive', '/norestart']}, + {'Prog': '2013\\vcredist_x64.exe', + 'Args': ['/install', '/passive', '/norestart']}, + # 2015 + {'Prog': '2015u3\\vc_redist.x86.exe', + 'Args': ['/install', '/passive', '/norestart']}, + {'Prog': '2015u3\\vc_redist.x64.exe', + 'Args': ['/install', '/passive', '/norestart']}, + ] + for vcr in _redists: + try: + run_program(vcr['Prog'], vcr['Args'], check=False) + except: + print_error('Failed to install {}'.format(vcr['Prog'])) + + # Main Bundle + if vars_os['Version'] in ['Vista', '7']: + # Legacy selection + if ask('Install MSE?'): + _prog = '{BaseDir}/Installers/Extras/Security/Microsoft Security Essentials.exe'.format(**vars) + run_program(_prog, check=False) + _prog = '{BaseDir}/Installers/Extras/Bundles/Legacy.exe'.format(**vars) + run_program(_prog, check=False) + elif vars_os['Version'] in ['8', '10']: + # Modern selection + _prog = '{BaseDir}/Installers/Extras/Bundles/Modern.exe'.format(**vars) + run_program(_prog, check=False) + + pause("Press Enter to exit...") + quit() diff --git a/.bin/Scripts/installed_ram.ps1 b/.bin/Scripts/installed_ram.ps1 index 5567803a..cf7e9245 100644 --- a/.bin/Scripts/installed_ram.ps1 +++ b/.bin/Scripts/installed_ram.ps1 @@ -1,3 +1,5 @@ +# Wizard Kit: List installed RAM (and speed if possible) + param([string]$log) cd $(Split-Path $MyInvocation.MyCommand.Path) @@ -34,9 +36,9 @@ foreach ($dev in $mem) { $_size = $dev.Capacity/1gb $_loc = $dev.DeviceLocator $_type = $ram_speeds."$($dev.Speed)" - wk-write $(" {0:N2} Gb ({1}) {2}" -f $_size,$_loc,$_type) "$log" + WK-write $(" {0:N2} Gb ({1}) {2}" -f $_size,$_loc,$_type) "$log" $total += $dev.Capacity } -wk-write " -------" "$log" -wk-write $(" {0:N2} Gb Usable" -f $($cs.TotalPhysicalMemory/1gb)) "$log" -wk-write $(" {0:N2} Gb Installed" -f $($total/1gb)) "$log" +WK-write " -------" "$log" +WK-write $(" {0:N2} Gb Usable" -f $($cs.TotalPhysicalMemory/1gb)) "$log" +WK-write $(" {0:N2} Gb Installed" -f $($total/1gb)) "$log" diff --git a/.bin/Scripts/menu.py b/.bin/Scripts/menu.py new file mode 100644 index 00000000..ddb1066b --- /dev/null +++ b/.bin/Scripts/menu.py @@ -0,0 +1,368 @@ +# Wizard Kit: Menu + +import os +import re +import subprocess +import time +import traceback +import winreg + +from functions import * + +# Init +os.chdir(os.path.dirname(os.path.realpath(__file__))) +bin = os.path.abspath('..\\') +## Check bootup type +BOOT_TYPE = 'Legacy' +try: + reg_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, 'System\\CurrentControlSet\\Control') + reg_value = winreg.QueryValueEx(reg_key, 'PEFirmwareType')[0] + if reg_value == 2: + BOOT_TYPE = 'UEFI' +except: + BOOT_TYPE = 'Unknown' + +class AbortException(Exception): + pass + +def abort_to_main_menu(message='Returning to main menu...'): + print_warning(message) + pause('Press Enter to return to main menu... ') + raise AbortException + +def menu_backup_imaging(): + """Take backup images of partition(s) in the WIM format and save them to a backup share""" + + # Mount backup shares + os.system('cls') + mount_backup_shares() + + # Set ticket number + ticket = None + while ticket is None: + tmp = input('Enter ticket number: ') + if re.match(r'^([0-9]+([-_]?\w+|))$', tmp): + ticket = tmp + + # Select disk to backup + disk = select_disk('For which drive are we creating backups?') + if disk is None: + abort_to_main_menu() + + # Get list of partitions that can't be imaged + bad_parts = [p['Number'] for p in disk['Partitions'] if 'Letter' not in p or re.search(r'(RAW|Unknown)', p['FileSystem'])] + + # Bail if no partitions are found (that can be imaged) + num_parts = len(disk['Partitions']) + if num_parts == 0 or num_parts == len(bad_parts): + abort_to_main_menu(' No partitions can be imaged for the selected drive') + + # Select destination + dest = select_destination() + if dest is None: + abort_to_main_menu('Aborting Backup Creation') + + # List (and update) partition details for selected drive + os.system('cls') + print('Create Backup - Details:\n') + print(' Drive: {Size}\t[{Table}] ({Type}) {Name}\n'.format(**disk)) + clobber_risk = 0 + width=len(str(len(disk['Partitions']))) + for par in disk['Partitions']: + # Detail each partition + if par['Number'] in bad_parts: + print_warning(' * Partition {Number:>{width}}:\t{Size} {FileSystem}\t\t{q}{Name}{q}\t{Description} ({OS})'.format( + width=width, + q='"' if par['Name'] != '' else '', + **par)) + else: + # Update info for WIM capture + par['ImageName'] = str(par['Name']) + if par['ImageName'] == '': + par['ImageName'] = 'Unknown' + if 'IP' in dest: + par['ImagePath'] = '\\\\{IP}\\{Share}\\{ticket}'.format(ticket=ticket, **dest) + else: + par['ImagePath'] = '{Letter}:\\{ticket}'.format(ticket=ticket, **dest) + par['ImageFile'] = '{Number}_{ImageName}'.format(**par) + par['ImageFile'] = '{fixed_name}.wim'.format(fixed_name=re.sub(r'\W', '_', par['ImageFile'])) + + # Check for existing backups + par['ImageExists'] = False + if os.path.exists('{ImagePath}\\{ImageFile}'.format(**par)): + par['ImageExists'] = True + clobber_risk += 1 + print_info(' + Partition {Number:>{width}}:\t{Size} {FileSystem} (Used: {Used Space})\t{q}{Name}{q}'.format( + width=width, + q='"' if par['Name'] != '' else '', + **par)) + else: + print(' Partition {Number:>{width}}:\t{Size} {FileSystem} (Used: {Used Space})\t{q}{Name}{q}'.format( + width=width, + q='"' if par['Name'] != '' else '', + **par)) + print('') # Spacer + + # Add warning about partition(s) that will be skipped + if len(bad_parts) > 1: + print_warning(' * Unable to backup these partitions') + elif len(bad_parts) == 1: + print_warning(' * Unable to backup this partition') + if clobber_risk > 1: + print_info(' + These partitions already have backup images on {Display Name}:'.format(**dest)) + elif clobber_risk == 1: + print_info(' + This partition already has a backup image on {Display Name}:'.format(**dest)) + if clobber_risk + len(bad_parts) > 1: + print_warning('\nIf you continue the partitions marked above will NOT be backed up.\n') + if clobber_risk + len(bad_parts) == 1: + print_warning('\nIf you continue the partition marked above will NOT be backed up.\n') + + # (re)display the destination + print(' Destination:\t{name}\n'.format(name=dest.get('Display Name', dest['Name']))) + + # Ask to proceed + if (not ask('Proceed with backup?')): + abort_to_main_menu('Aborting Backup Creation') + + # Backup partition(s) + print('\n\nStarting task.\n') + errors = False + for par in disk['Partitions']: + print(' Partition {Number} Backup...\t\t'.format(**par), end='', flush=True) + if par['Number'] in bad_parts: + print_warning('Skipped.') + else: + cmd = '{bin}\\wimlib\\wimlib-imagex capture {Letter}:\\ "{ImagePath}\\{ImageFile}" "{ImageName}" "{ImageName}" --compress=fast'.format(bin=bin, **par) + if par['ImageExists']: + print_warning('Skipped.') + else: + try: + os.makedirs('{ImagePath}'.format(**par), exist_ok=True) + run_program(cmd) + print_success('Complete.') + except subprocess.CalledProcessError as err: + print_error('Failed.') + errors = True + par['Error'] = err.stderr.decode().splitlines() + + # Verify backup(s) + if len(par) - len(bad_parts) > 1: + print('\n\n Verifying backups\n') + else: + print('\n\n Verifying backup\n') + for par in disk['Partitions']: + if par['Number'] not in bad_parts: + print(' Partition {Number} Image...\t\t'.format(**par), end='', flush=True) + cmd = '{bin}\\wimlib\\wimlib-imagex verify "{ImagePath}\\{ImageFile}" --nocheck'.format(bin=bin, **par) + if not os.path.exists('{ImagePath}\\{ImageFile}'.format(**par)): + print_error('Missing.') + else: + try: + run_program(cmd) + print_success('OK.') + except subprocess.CalledProcessError as err: + print_error('Damaged.') + errors = True + par['Error'] = par.get('Error', []) + err.stderr.decode().splitlines() + + # Print summary + if errors: + print_warning('\nErrors were encountered and are detailed below.') + for par in [p for p in disk['Partitions'] if 'Error' in p]: + print(' Partition {Number} Error:'.format(**par)) + for line in par['Error']: + line = line.strip() + if line != '': + print_error('\t{line}'.format(line=line)) + time.sleep(300) + else: + print_success('\nNo errors were encountered during imaging.') + time.sleep(10) + pause('\nPress Enter to return to main menu... ') + +def menu_windows_setup(): + """Format a drive, partition for MBR or GPT, apply a Windows image, and rebuild the boot files""" + + # Select the version of Windows to apply + os.system('cls') + selected_windows_version = select_windows_version() + if selected_windows_version is None: + abort_to_main_menu('Aborting Windows setup') + + # Find Windows image + image = find_windows_image(selected_windows_version['ImageFile']) + if not any(image): + print_error('Failed to find Windows source image for {winver}'.format(winver=selected_windows_version['Name'])) + abort_to_main_menu('Aborting Windows setup') + + # Select drive to use as the OS drive + dest_drive = select_disk('To which drive are we installing Windows?') + if dest_drive is None: + abort_to_main_menu('Aborting Windows setup') + + # Confirm drive format + print_warning('All data will be deleted from the following drive:') + print_warning('\t{Size}\t({Table}) {Name}'.format(**dest_drive)) + if (not ask('Is this correct?')): + abort_to_main_menu('Aborting Windows setup') + + # MBR/Legacy or GPT/UEFI? + use_gpt = True + if (BOOT_TYPE == 'UEFI'): + if (not ask("Setup drive using GPT (UEFI) layout?")): + use_gpt = False + else: + if (ask("Setup drive using MBR (legacy) layout?")): + use_gpt = False + + # Safety check + print_warning('SAFETY CHECK\n') + print_error(' FORMATTING:\tDrive: {Size}\t[{Table}] ({Type}) {Name}'.format(**dest_drive)) + if len(dest_drive['Partitions']) > 0: + width=len(str(len(dest_drive['Partitions']))) + for par in dest_drive['Partitions']: + if 'Letter' not in par or re.search(r'(RAW)', par['FileSystem']): + print_error('\t\tPartition {Number:>{width}}:\t{Size} {q}{Name}{q} ({FileSystem})\t\t{Description} ({OS})'.format( + width=width, + q='"' if par['Name'] != '' else '', + **par)) + else: + print_error('\t\tPartition {Number:>{width}}:\t{Size} {q}{Name}{q} ({FileSystem})\t\t(Used space: {Used Space})'.format( + width=width, + q='"' if par['Name'] != '' else '', + **par)) + else: + print_warning('\t\tNo partitions found') + if (use_gpt): + print(' Using: \tGPT (UEFI) layout') + else: + print(' Using: \tMBR (legacy) layout') + print_info(' Installing:\t{winver}'.format(winver=selected_windows_version['Name'])) + if (not ask('\nIs this correct?')): + abort_to_main_menu('Aborting Windows setup') + + # Release currently used volume letters (ensures that the drives will get S, T, & W as needed below) + remove_volume_letters(keep=image['Source']) + + # Format and partition drive + if (use_gpt): + format_gpt(dest_drive, selected_windows_version['Family']) + else: + format_mbr(dest_drive) + + # Apply Windows image + errors = False + print(' Applying image...') + cmd = '{bin}\\wimlib\\wimlib-imagex apply "{File}.{Ext}" "{ImageName}" W:\\ {Glob}'.format(bin=bin, **image, **selected_windows_version) + try: + run_program(cmd) + except subprocess.CalledProcessError: + errors = True + print_error('Failed to apply Windows image.') + + # Create boot files + if not errors: + print(' Creating boot files...'.format(**selected_windows_version)) + try: + run_program('bcdboot W:\\Windows /s S: /f ALL') + except subprocess.CalledProcessError: + errors = True + print_error('Failed to create boot files.') + if re.search(r'^(8|10)', selected_windows_version['Family']): + try: + run_program('W:\\Windows\\System32\\reagentc /setreimage /path T:\\Recovery\\WindowsRE /target W:\\Windows') + except subprocess.CalledProcessError: + # errors = True # Changed to warning. + print_warning('Failed to setup WindowsRE files.') + + # Print summary + if errors: + print_warning('\nErrors were encountered during setup.') + time.sleep(300) + else: + print_success('\nNo errors were encountered during setup.') + time.sleep(10) + pause('\nPress Enter to return to main menu... ') + +def menu_tools(): + tools = [ + {'Name': 'Blue Screen View', 'Folder': 'BlueScreenView', 'File': 'BlueScreenView.exe'}, + {'Name': 'CPU-Z', 'Folder': 'CPU-Z', 'File': 'cpuz.exe'}, + {'Name': 'Explorer++', 'Folder': 'Explorer++', 'File': 'Explorer++.exe'}, + {'Name': 'Fast Copy', 'Folder': 'FastCopy', 'File': 'FastCopy.exe', 'Args': ['/log', '/logfile=X:\WK\Info\FastCopy.log', '/cmd=noexist_only', '/utf8', '/skip_empty_dir', '/linkdest', '/open_window', '/balloon=FALSE', r'/exclude=$RECYCLE.BIN;$Recycle.Bin;.AppleDB;.AppleDesktop;.AppleDouble;.com.apple.timemachine.supported;.dbfseventsd;.DocumentRevisions-V100*;.DS_Store;.fseventsd;.PKInstallSandboxManager;.Spotlight*;.SymAV*;.symSchedScanLockxz;.TemporaryItems;.Trash*;.vol;.VolumeIcon.icns;desktop.ini;Desktop?DB;Desktop?DF;hiberfil.sys;lost+found;Network?Trash?Folder;pagefile.sys;Recycled;RECYCLER;System?Volume?Information;Temporary?Items;Thumbs.db']}, + {'Name': 'HWiNFO', 'Folder': 'HWiNFO', 'File': 'HWiNFO.exe'}, + {'Name': 'HW Monitor', 'Folder': 'HWMonitor', 'File': 'HWMonitor.exe'}, + {'Name': 'NT Password Editor', 'Folder': 'NT Password Editor', 'File': 'ntpwedit.exe'}, + {'Name': 'Notepad2', 'Folder': 'Notepad2', 'File': 'Notepad2-Mod.exe'}, + {'Name': 'PhotoRec', 'Folder': 'TestDisk', 'File': 'photorec_win.exe', 'Args': ['-new_console:n']}, + {'Name': 'Prime95', 'Folder': 'Prime95', 'File': 'prime95.exe'}, + {'Name': 'ProduKey', 'Folder': 'ProduKey', 'File': 'ProduKey.exe', 'Args': ['/external', '/ExtractEdition:1']}, + {'Name': 'Q-Dir', 'Folder': 'Q-Dir', 'File': 'Q-Dir.exe'}, + {'Name': 'TestDisk', 'Folder': 'TestDisk', 'File': 'testdisk_win.exe', 'Args': ['-new_console:n']}, + ] + actions = [ + {'Name': 'Main Menu', 'Letter': 'M'}, + ] + + # Menu loop + while True: + selection = menu_select('Tools Menu', tools, actions) + + if (selection.isnumeric()): + tool = tools[int(selection)-1] + cmd = ['{bin}\\{folder}\\{file}'.format(bin=bin, folder=tool['Folder'], file=tool['File'])] + if tool['Name'] == 'Blue Screen View': + # Select path to scan + minidump_path = select_minidump_path() + if minidump_path is not None: + tool['Args'] = ['/MiniDumpFolder', minidump_path] + if 'Args' in tool: + cmd += tool['Args'] + try: + subprocess.Popen(cmd) + except: + print_error('Failed to run {prog}'.format(prog=tool['Name'])) + time.sleep(2) + elif (selection == 'M'): + break + +def menu_main(): + menus = [ + {'Name': 'Create Backups', 'Menu': menu_backup_imaging}, + {'Name': 'Install Windows', 'Menu': menu_windows_setup}, + {'Name': 'Misc Tools', 'Menu': menu_tools}, + ] + actions = [ + {'Name': 'Command Prompt', 'Letter': 'C'}, + {'Name': 'Reboot', 'Letter': 'R'}, + {'Name': 'Shutdown', 'Letter': 'S'}, + ] + + # Main loop + while True: + selection = menu_select('Main Menu', menus, actions, secret_exit=True) + + if (selection.isnumeric()): + try: + menus[int(selection)-1]['Menu']() + except AbortException: + pass + except: + print_error('Major exception in: {menu}'.format(menu=menus[int(selection)-1]['Name'])) + print_warning(' Please let The Wizard know and he\'ll look into it (Please include the details below).') + print(traceback.print_exc()) + print_info(' You can reboot and try again but if this crashes again an alternative approach is required.') + time.sleep(300) + pause('Press Enter to shutdown...') + run_program(['wpeutil', 'shutdown']) + elif (selection == 'C'): + run_program(['cmd', '-new_console:n'], check=False) + elif (selection == 'R'): + run_program(['wpeutil', 'reboot']) + elif (selection == 'S'): + run_program(['wpeutil', 'shutdown']) + else: + quit() + +if __name__ == '__main__': + menu_main() \ No newline at end of file diff --git a/.bin/Scripts/partition_uids.py b/.bin/Scripts/partition_uids.py new file mode 100644 index 00000000..a536a010 --- /dev/null +++ b/.bin/Scripts/partition_uids.py @@ -0,0 +1,325 @@ +# Wizard Kit: - PARTITION UIDs +# sources: https://en.wikipedia.org/wiki/GUID_Partition_Table +# https://en.wikipedia.org/wiki/Partition_type + +PARTITION_UIDS = { + '00': {'OS': 'All', 'Description': 'Empty partition entry'}, + '01': {'OS': 'DOS 2.0+', 'Description': 'FAT12 as primary partition in first physical 32 MB of disk or as logical drive anywhere on disk (else use 06hinstead)'}, + '02': {'OS': 'XENIX', 'Description': 'XENIX root'}, + '03': {'OS': 'XENIX', 'Description': 'XENIX usr'}, + '04': {'OS': 'DOS 3.0+', 'Description': 'FAT16 with less than 65536 sectors (32 MB). As primary partition it must reside in first physical 32 MB of disk, or as logical drive anywhere on disk (else use 06h instead).'}, + '05': {'OS': 'DOS (3.2) 3.3+ / SpeedStor', 'Description': 'Extended partition with CHS addressing. It must reside in first physical 8 GB of disk, else use 0Fh instead / can occur in SpeedStor MBRs'}, + '06': {'OS': 'DOS 3.31+', 'Description': 'FAT16B with 65536 or more sectors. It must reside in first physical 8 GB of disk, unless used for logical drives in an 0Fh extended partition (else use 0Eh instead). Also used for FAT12 and FAT16 volumes in primary partitions if they are not residing in first physical 32 MB of disk.'}, + '07': {'OS': 'OS/2 1.2+ / OS/2 1.2+, Windows NT / Windows NT / Windows Embedded CE / QNX 2', 'Description': 'IFS / HPFS / NTFS / exFAT / QNX "qnx" (7) (pre-1988 only)'}, + '08': {'OS': 'Commodore MS-DOS 3.x / OS/2 1.0-1.3 / AIX / QNX 1.x/2.x', 'Description': 'Logical sectored FAT12 or FAT16 / OS/2 (FAT?) / AIX boot/split / SplitDrive / QNX "qny" (8) / partition spanning multiple drives'}, + '09': {'OS': 'AIX / QNX 1.x/2.x / Coherent / OS-9', 'Description': 'AIX data/boot / QNX "qnz" (9) / Coherent file system / OS-9 RBF'}, + '0A': {'OS': 'OS/2 / Coherent', 'Description': 'OS/2 Boot Manager / Coherent swap partition'}, + '0B': {'OS': 'DOS 7.1+', 'Description': 'FAT32 with CHS addressing'}, + '0C': {'OS': 'DOS 7.1+', 'Description': 'FAT32 with LBA'}, + '0D': {'OS': 'Silicon Safe', 'Description': 'Reserved'}, + '0E': {'OS': 'DOS 7.0+', 'Description': 'FAT16B with LBA'}, + '0F': {'OS': 'DOS 7.0+', 'Description': 'Extended partition with LBA'}, + '10': {'OS': 'OPUS', 'Description': 'Unknown'}, + '11': {'OS': 'Leading Edge MS-DOS 3.x / OS/2 Boot Manager', 'Description': 'Logical sectored FAT12 or FAT16 / Hidden FAT12 '}, + '12': {'OS': 'Compaq Contura', 'Description': 'configuration partition (bootable FAT) / configuration partition / hibernation partition / diagnostics and firmware partition (bootable FAT) / service partition (bootable FAT) / Rescue and Recovery partition'}, + '14': {'OS': 'AST MS-DOS 3.x / OS/2 Boot Manager / Maverick OS', 'Description': 'Logical sectored FAT12 or FAT16 / Hidden FAT16 / Omega file system'}, + '15': {'OS': 'OS/2 Boot Manager / Maverick OS', 'Description': 'Hidden extended partition with CHS addressing / swap'}, + '16': {'OS': 'OS/2 Boot Manager', 'Description': 'Hidden FAT16B '}, + '17': {'OS': 'OS/2 Boot Manager', 'Description': 'Hidden IFS / Hidden HPFS / Hidden NTFS / Hidden exFAT '}, + '18': {'OS': 'AST Windows', 'Description': 'AST Zero Volt Suspend or SmartSleep partition'}, + '19': {'OS': 'Willowtech Photon coS', 'Description': 'Willowtech Photon coS'}, + '1B': {'OS': 'OS/2 Boot Manager', 'Description': 'Hidden FAT32 '}, + '1C': {'OS': 'OS/2 Boot Manager', 'Description': 'Hidden FAT32 with LBA '}, + '1E': {'OS': 'OS/2 Boot Manager', 'Description': 'Hidden FAT16 with LBA '}, + '1F': {'OS': 'OS/2 Boot Manager', 'Description': 'Hidden extended partition with LBA addressing '}, + '20': {'OS': 'Windows Mobile', 'Description': 'Windows Mobile update XIP / Willowsoft Overture File System (OFS1)'}, + '21': {'OS': 'Oxygen', 'Description': 'HP Volume Expansion (SpeedStor) / FSo2 (Oxygen File System)'}, + '22': {'OS': 'Oxygen', 'Description': 'Oxygen Extended Partition Table'}, + '23': {'OS': 'Windows Mobile', 'Description': 'Reserved / Windows Mobile boot XIP'}, + '24': {'OS': 'NEC MS-DOS 3.30', 'Description': 'Logical sectored FAT12 or FAT16 '}, + '25': {'OS': 'Windows Mobile', 'Description': 'Windows Mobile IMGFS[citation needed]'}, + '26': {'OS': 'Microsoft, IBM', 'Description': 'Reserved'}, + '27': {'OS': 'Windows / PQservice / MirOS BSD / RooterBOOT', 'Description': 'Windows Recovery Environment (RE) partition (hidden NTFS partition type 07h) / FAT32 or NTFS rescue partition / MirOS partition / RooterBOOT kernel partition (contains a raw ELF Linux kernel, no file system)'}, + '2A': {'OS': 'AtheOS', 'Description': 'AtheOS file system (AthFS, AFS) (an extension of BFS, see 2Bh and EBh) / Reserved'}, + '2B': {'OS': 'SyllableOS', 'Description': 'SyllableSecure (SylStor), a variant of AthFS (an extension of BFS, see 2Ah and EBh)'}, + '31': {'OS': 'Microsoft, IBM', 'Description': 'Reserved'}, + '32': {'OS': 'NOS', 'Description': 'Unknown'}, + '33': {'OS': 'Microsoft, IBM', 'Description': 'Reserved'}, + '34': {'OS': 'Microsoft, IBM', 'Description': 'Reserved'}, + '35': {'OS': 'OS/2 Warp Server /eComStation', 'Description': 'JFS (OS/2 implementation of AIX Journaling File system)'}, + '36': {'OS': 'Microsoft, IBM', 'Description': 'Reserved'}, + '38': {'OS': 'THEOS', 'Description': 'THEOS version 3.2, 2 GB partition'}, + '39': {'OS': 'Plan 9 / THEOS', 'Description': 'Plan 9 edition 3 partition (sub-partitions described in second sector of partition) / THEOS version 4 spanned partition'}, + '3A': {'OS': 'THEOS', 'Description': 'THEOS version 4, 4 GB partition'}, + '3B': {'OS': 'THEOS', 'Description': 'THEOS version 4 extended partition'}, + '3C': {'OS': 'PartitionMagic', 'Description': 'PqRP (PartitionMagic or DriveImage in progress)'}, + '3D': {'OS': 'PartitionMagic', 'Description': 'Hidden NetWare'}, + '3F': {'OS': 'OS/32', 'Description': 'Unknown'}, + '40': {'OS': 'PICK / Venix', 'Description': 'PICK R83 / Venix 80286'}, + '41': {'OS': 'Personal RISC / Linux / PowerPC', 'Description': 'Personal RISC Boot / Old Linux/Minix (disk shared with DR DOS 6.0) / PPC PReP (Power PC Reference Platform) Boot'}, + '42': {'OS': 'SFS / Linux / Windows 2000, XP, etc.', 'Description': 'Secure File system (SFS) / Old Linux swap (disk shared with DR DOS 6.0) / Dynamic extended partition marker'}, + '43': {'OS': 'Linux', 'Description': 'Old Linux native (disk shared with DR DOS 6.0) '}, + '44': {'OS': 'GoBack', 'Description': 'Norton GoBack, WildFile GoBack, Adaptec GoBack, Roxio GoBack'}, + '45': {'OS': 'Boot-US / EUMEL/ELAN', 'Description': 'Priam / Boot-US boot manager (1 cylinder) / EUMEL/ELAN (L2)'}, + '46': {'OS': 'EUMEL/ELAN', 'Description': 'EUMEL/ELAN (L2)'}, + '47': {'OS': 'EUMEL/ELAN', 'Description': 'EUMEL/ELAN (L2)'}, + '48': {'OS': 'EUMEL/ELAN', 'Description': 'EUMEL/ELAN (L2), ERGOS L3'}, + '4A': {'OS': 'AdaOS / ALFS/THIN', 'Description': 'Aquila / ALFS/THIN advanced lightweight file system for DOS'}, + '4C': {'OS': 'ETH Oberon', 'Description': 'Aos (A2) file system (76)'}, + '4D': {'OS': 'QNX 4.x, Neutrino', 'Description': 'Primary QNX POSIX volume on disk (77)'}, + '4E': {'OS': 'QNX 4.x, Neutrino', 'Description': 'Secondary QNX POSIX volume on disk (78)'}, + '4F': {'OS': 'QNX 4.x, Neutrino / ETH Oberon', 'Description': 'Tertiary QNX POSIX volume on disk (79) / boot / native file system (79)'}, + '50': {'OS': 'ETH Oberon / Disk Manager 4 / LynxOS / Novell', 'Description': 'Alternative native file system (80) / Read-only partition (old) / Lynx RTOS'}, + '51': {'OS': 'Disk Manager 4-6', 'Description': 'Read-write partition (Aux 1)'}, + '52': {'OS': 'CP/M-80 / System V/AT, V/386', 'Description': 'CP/M-80'}, + '53': {'OS': 'Disk Manager 6', 'Description': 'Auxiliary 3 (WO)'}, + '54': {'OS': 'Disk Manager 6', 'Description': 'Dynamic Drive Overlay (DDO)'}, + '55': {'OS': 'EZ-Drive', 'Description': 'EZ-Drive, Maxtor, MaxBlast, or DriveGuide INT 13h redirector volume'}, + '56': {'OS': 'AT&T MS-DOS 3.x / EZ-Drive / VFeature', 'Description': 'Logical sectored FAT12 or FAT16 / Disk Manager partition converted to EZ-BIOS / VFeature partitionned volume'}, + '57': {'OS': 'DrivePro', 'Description': 'VNDI partition'}, + '5C': {'OS': 'EDISK', 'Description': 'Priam EDisk Partitioned Volume '}, + '61': {'OS': 'SpeedStor', 'Description': 'Unknown'}, + '63': {'OS': 'Unix', 'Description': 'SCO Unix, ISC, UnixWare, AT&T System V/386, ix, MtXinu BSD 4.3 on Mach, GNU HURD'}, + '64': {'OS': 'SpeedStor / NetWare', 'Description': 'NetWare File System 286/2 / PC-ARMOUR'}, + '65': {'OS': 'NetWare', 'Description': 'NetWare File System 386'}, + '66': {'OS': 'NetWare / NetWare', 'Description': 'NetWare File System 386 / Storage Management Services (SMS)'}, + '67': {'OS': 'NetWare', 'Description': 'Wolf Mountain'}, + '68': {'OS': 'NetWare', 'Description': 'Unknown'}, + '69': {'OS': 'NetWare 5 / NetWare', 'Description': 'Novell Storage Services (NSS)'}, + '6E': {'Description': 'Unknown'}, + '70': {'OS': 'DiskSecure', 'Description': 'DiskSecure multiboot'}, + '71': {'OS': 'Microsoft, IBM', 'Description': 'Reserved'}, + '72': {'OS': 'APTI conformant systems / Unix V7/x86', 'Description': 'APTI alternative FAT12 (CHS, SFN) / V7/x86'}, + '73': {'OS': 'Microsoft, IBM', 'Description': 'Reserved'}, + '74': {'OS': 'Microsoft, IBM', 'Description': 'Reserved / Scramdisk'}, + '75': {'OS': 'PC/IX', 'Description': 'Unknown'}, + '76': {'OS': 'Microsoft, IBM', 'Description': 'Reserved'}, + '77': {'OS': 'Novell', 'Description': 'VNDI, M2FS, M2CS'}, + '78': {'OS': 'Geurt Vos', 'Description': 'XOSL bootloader file system'}, + '79': {'OS': 'APTI conformant systems', 'Description': 'APTI alternative FAT16 (CHS, SFN) '}, + '7A': {'OS': 'APTI conformant systems', 'Description': 'APTI alternative FAT16 (LBA, SFN) '}, + '7B': {'OS': 'APTI conformant systems', 'Description': 'APTI alternative FAT16B (CHS, SFN) '}, + '7C': {'OS': 'APTI conformant systems', 'Description': 'APTI alternative FAT32 (LBA, SFN) '}, + '7D': {'OS': 'APTI conformant systems', 'Description': 'APTI alternative FAT32 (CHS, SFN) '}, + '7E': {'OS': 'F.I.X. (claim) / PrimoCache', 'Description': 'Level 2 cache'}, + '7F': {'OS': 'Varies', 'Description': 'Alternative OS Development Partition Standard - reserved for individual or local use and temporary or experimental projects'}, + '80': {'OS': 'Minix 1.1-1.4a', 'Description': 'Minix file system (old)'}, + '81': {'OS': 'Minix 1.4b+ / Linux', 'Description': 'MINIX file system / Mitac Advanced Disk Manager'}, + '82': {'OS': 'Linux / Sun Microsystems', 'Description': 'Linux swap space / Solaris x86 (for Sun disklabels up to 2005) / Prime'}, + '83': {'OS': 'GNU/Linux', 'Description': 'Any native Linux file system '}, + '84': {'OS': 'OS/2 / Windows 7', 'Description': 'APM hibernation (suspend to disk, S2D) / Hidden C: (FAT16) / Rapid Start technology'}, + '85': {'OS': 'GNU/Linux', 'Description': 'Linux extended '}, + '86': {'OS': 'Windows NT 4 Server / Linux', 'Description': 'Fault-tolerant FAT16B mirrored volume set / Linux RAID superblock with auto-detect (old)'}, + '87': {'OS': 'Windows NT 4 Server', 'Description': 'Fault-tolerant HPFS/NTFS mirrored volume set '}, + '88': {'OS': 'GNU/Linux', 'Description': 'Linux plaintext partition table'}, + '8A': {'OS': 'AiR-BOOT', 'Description': 'Linux kernel image'}, + '8B': {'OS': 'Windows NT 4 Server', 'Description': 'Legacy fault-tolerant FAT32 mirrored volume set '}, + '8C': {'OS': 'Windows NT 4 Server', 'Description': 'Legacy fault-tolerant FAT32 mirrored volume set '}, + '8D': {'OS': 'Free FDISK', 'Description': 'Hidden FAT12 '}, + '8E': {'OS': 'Linux', 'Description': 'Linux LVM'}, + '90': {'OS': 'Free FDISK', 'Description': 'Hidden FAT16 '}, + '91': {'OS': 'Free FDISK', 'Description': 'Hidden extended partition with CHS addressing '}, + '92': {'OS': 'Free FDISK', 'Description': 'Hidden FAT16B '}, + '93': {'OS': 'Amoeba / Linux', 'Description': 'Amoeba native file system / Hidden Linux file system'}, + '94': {'OS': 'Amoeba', 'Description': 'Amoeba bad block table'}, + '95': {'OS': 'EXOPC', 'Description': 'EXOPC native'}, + '96': {'OS': 'CHRP', 'Description': 'ISO-9660 file system'}, + '97': {'OS': 'Free FDISK', 'Description': 'Hidden FAT32 '}, + '98': {'OS': 'Free FDISK / ROM-DOS', 'Description': 'Hidden FAT32 / service partition (bootable FAT) ROM-DOS SuperBoot / service partition (bootable FAT)'}, + '99': {'OS': 'early Unix', 'Description': 'Unknown'}, + '9A': {'OS': 'Free FDISK', 'Description': 'Hidden FAT16 '}, + '9B': {'OS': 'Free FDISK', 'Description': 'Hidden extended partition with LBA '}, + '9E': {'OS': 'VSTA / ForthOS', 'Description': 'ForthOS (eForth port)'}, + '9F': {'OS': 'BSD/OS 3.0+, BSDI', 'Description': 'Unknown'}, + 'A0': {'OS': 'Hewlett Packard / Phoenix, IBM, Toshiba, Sony', 'Description': 'Diagnostic partition for HP laptops / Hibernate partition'}, + 'A1': {'OS': 'Hewlett Packard / Phoenix, NEC', 'Description': 'HP Volume Expansion (SpeedStor) / Hibernate partition'}, + 'A2': {'OS': 'Cyclone V', 'Description': 'Hard Processor System (HPS) ARM preloader'}, + 'A3': {'OS': 'Hewlett Packard', 'Description': 'HP Volume Expansion (SpeedStor)'}, + 'A4': {'OS': 'Hewlett Packard', 'Description': 'HP Volume Expansion (SpeedStor)'}, + 'A5': {'OS': 'BSD', 'Description': 'BSD slice (BSD/386, 386BSD, NetBSD (old), FreeBSD)'}, + 'A6': {'OS': 'OpenBSD', 'Description': 'HP Volume Expansion (SpeedStor) / OpenBSD slice'}, + 'A7': {'OS': 'NeXT', 'Description': 'NeXTSTEP'}, + 'A8': {'OS': 'Darwin, Mac OS X', 'Description': 'Apple Darwin, Mac OS X UFS'}, + 'A9': {'OS': 'NetBSD', 'Description': 'NetBSD slice'}, + 'AA': {'OS': 'MS-DOS', 'Description': 'Olivetti MS-DOS FAT12 (1.44 MB) '}, + 'AB': {'OS': 'Darwin, Mac OS X / GO! OS', 'Description': 'Apple Darwin, Mac OS X boot / GO!'}, + 'AD': {'OS': 'RISC OS', 'Description': 'ADFS / FileCore format'}, + 'AE': {'OS': 'ShagOS', 'Description': 'ShagOS file system'}, + 'AF': {'OS': 'ShagOS', 'Description': 'Apple Mac OS X HFS and HFS+ / ShagOS swap'}, + 'B0': {'OS': 'Boot-Star', 'Description': 'Boot-Star dummy partition'}, + 'B1': {'OS': 'QNX 6.x', 'Description': 'HP Volume Expansion (SpeedStor) / QNX Neutrino power-safe file system'}, + 'B2': {'OS': 'QNX 6.x', 'Description': 'QNX Neutrino power-safe file system'}, + 'B3': {'OS': 'QNX 6.x', 'Description': 'HP Volume Expansion (SpeedStor) / QNX Neutrino power-safe file system'}, + 'B4': {'OS': 'Hewlett Packard', 'Description': 'HP Volume Expansion (SpeedStor)'}, + 'B6': {'OS': 'Windows NT 4 Server', 'Description': 'HP Volume Expansion (SpeedStor) / Corrupted fault-tolerant FAT16B mirrored master volume '}, + 'B7': {'OS': 'BSDI (before 3.0) / Windows NT 4 Server', 'Description': 'BSDI native file system / swap / Corrupted fault-tolerant HPFS/NTFS mirrored master volume '}, + 'B8': {'OS': 'BSDI (before 3.0)', 'Description': 'BSDI swap / native file system'}, + 'BB': {'OS': 'BootWizard, OS Selector / Acronis True Image / Windows NT 4 Server', 'Description': 'PTS BootWizard 4 / OS Selector 5 for hidden partitions other than 01h, 04h, 06h, 07h, 0Bh, 0Ch, 0Eh and unformatted partitions / OEM Secure Zone (corresponds to BCh) / Corrupted fault-tolerant FAT32 mirrored master volume '}, + 'BC': {'OS': 'Windows NT 4 Server / Acronis True Image / Backup Capsule', 'Description': 'Corrupted fault-tolerant FAT32 mirrored master volume / Acronis Secure Zone / Backup Capsule'}, + 'BD': {'OS': 'BonnyDOS/286', 'Description': 'Unknown'}, + 'BE': {'OS': 'Solaris 8', 'Description': 'Solaris 8 boot'}, + 'BF': {'OS': 'Solaris', 'Description': 'Solaris x86 (for Sun disklabels, since 2005)'}, + 'C0': {'OS': 'DR-DOS, Multiuser DOS,REAL/32', 'Description': 'Secured FAT partition (smaller than 32 MB)'}, + 'C1': {'OS': 'DR DOS 6.0+', 'Description': 'Secured FAT12 '}, + 'C2': {'OS': 'Power Boot', 'Description': 'Hidden Linux native file system'}, + 'C3': {'OS': 'Power Boot', 'Description': 'Hidden Linux swap'}, + 'C4': {'OS': 'DR DOS 6.0+', 'Description': 'Secured FAT16 '}, + 'C5': {'OS': 'DR DOS 6.0+', 'Description': 'Secured extended partition with CHS addressing '}, + 'C6': {'OS': 'DR DOS 6.0+ / Windows NT 4 Server', 'Description': 'Secured FAT16B / Corrupted fault-tolerant FAT16B mirrored slave volume '}, + 'C7': {'OS': 'Syrinx / Windows NT 4 Server', 'Description': 'Syrinx boot / Corrupted fault-tolerant HPFS/NTFS mirrored slave volume '}, + 'C8': {'Description': 'Reserved for DR-DOS since 1997'}, + 'C9': {'Description': 'Reserved for DR-DOS since 1997'}, + 'CA': {'Description': 'Reserved for DR-DOS since 1997'}, + 'CB': {'OS': 'DR-DOS 7.0x / Windows NT 4 Server', 'Description': 'Secured FAT32 / Corrupted fault-tolerant FAT32 mirrored slave volume '}, + 'CC': {'OS': 'DR-DOS 7.0x / Windows NT 4 Server', 'Description': 'Secured FAT32 / Corrupted fault-tolerant FAT32 mirrored slave volume '}, + 'CD': {'OS': 'CTOS', 'Description': 'Memory dump'}, + 'CE': {'OS': 'DR-DOS 7.0x', 'Description': 'Secured FAT16B '}, + 'CF': {'OS': 'DR-DOS 7.0x', 'Description': 'Secured extended partition with LBA '}, + 'D0': {'OS': 'Multiuser DOS, REAL/32', 'Description': 'Secured FAT partition (larger than 32 MB)'}, + 'D1': {'OS': 'Multiuser DOS', 'Description': 'Secured FAT12 '}, + 'D4': {'OS': 'Multiuser DOS', 'Description': 'Secured FAT16 '}, + 'D5': {'OS': 'Multiuser DOS', 'Description': 'Secured extended partition with CHS addressing '}, + 'D6': {'OS': 'Multiuser DOS', 'Description': 'Secured FAT16B '}, + 'D8': {'OS': 'Digital Research', 'Description': 'CP/M-86 [citation needed]'}, + 'DA': {'OS': 'Powercopy Backup', 'Description': 'Non-file system data / Shielded disk'}, + 'DB': {'OS': 'CP/M-86,Concurrent CP/M-86,Concurrent DOS / CTOS / D800 / DRMK', 'Description': 'CP/M-86, Concurrent CP/M-86, Concurrent DOS / boot image for x86 supervisor CPU (SCPU) module / FAT32 system restore partition (DSR)'}, + 'DD': {'OS': 'CTOS', 'Description': 'Hidden memory dump'}, + 'DE': {'OS': 'Dell', 'Description': 'FAT16 utility/diagnostic partition'}, + 'DF': {'OS': 'DG/UX / BootIt / Aviion', 'Description': 'DG/UX virtual disk manager / EMBRM'}, + 'E0': {'OS': 'STMicroelectronics', 'Description': 'ST AVFS'}, + 'E1': {'OS': 'SpeedStor', 'Description': 'Extended FAT12 (> 1023 cylinder)'}, + 'E2': {'Description': 'DOS read-only (XFDISK)'}, + 'E3': {'OS': 'SpeedStor', 'Description': 'DOS read-only'}, + 'E4': {'OS': 'SpeedStor', 'Description': 'Extended FAT16 (< 1024 cylinder)'}, + 'E5': {'OS': 'Tandy MS-DOS', 'Description': 'Logical sectored FAT12 or FAT16'}, + 'E6': {'OS': 'SpeedStor', 'Description': 'Unknown'}, + 'E8': {'OS': 'LUKS', 'Description': 'Linux Unified Key Setup'}, + 'EB': {'OS': 'BeOS, Haiku', 'Description': 'BFS'}, + 'EC': {'OS': 'SkyOS', 'Description': 'SkyFS'}, + 'ED': {'OS': 'Sprytix / EDD 4', 'Description': 'EDC loader / GPT hybrid MBR'}, + 'EE': {'OS': 'EFI', 'Description': 'GPT protective MBR'}, + 'EF': {'OS': 'EFI', 'Description': 'EFI system partition can be a FAT12, FAT16, FAT32 (or other) file system'}, + 'F0': {'OS': 'Linux / OS/32', 'Description': 'PA-RISC Linux boot loader. It must reside in first physical 2 GB. / floppy'}, + 'F1': {'OS': 'SpeedStor', 'Description': 'Unknown'}, + 'F2': {'OS': 'Sperry IT MS-DOS 3.x, Unisys MS-DOS 3.3, Digital ResearchDOS Plus 2.1', 'Description': 'Logical sectored FAT12 or FAT16 secondary partition'}, + 'F3': {'OS': 'SpeedStor', 'Description': 'Unknown'}, + 'F4': {'OS': 'SpeedStor / Prologue', 'Description': '"large" DOS partition / single volume partition for NGF or TwinFS'}, + 'F5': {'OS': 'Prologue', 'Description': 'MD0-MD9 multi volume partition for NGF or TwinFS'}, + 'F6': {'OS': 'SpeedStor', 'Description': 'Unknown'}, + 'F7': {'OS': 'O.S.G. / X1', 'Description': 'EFAT / Solid State file system'}, + 'F9': {'OS': 'Linux', 'Description': 'pCache ext2/ext3 persistent cache'}, + 'FA': {'OS': 'Bochs', 'Description': 'x86 emulator'}, + 'FB': {'OS': 'VMware', 'Description': 'VMware VMFS file system partition'}, + 'FC': {'OS': 'VMware', 'Description': 'VMware swap / VMKCORE kernel dump partition'}, + 'FD': {'OS': 'Linux / FreeDOS', 'Description': 'Linux RAID superblock with auto-detect / Reserved for FreeDOS'}, + 'FE': {'OS': 'SpeedStor / LANstep / Windows NT / Linux', 'Description': 'partition > 1024 cylinder / PS/2 IML partition / PS/2 recovery partition (FAT12 reference disk floppy image), / Disk Administration hidden partition / old Linux LVM'}, + 'FF': {'OS': 'XENIX', 'Description': 'XENIX bad block table'}, + '00000000-0000-0000-0000-000000000000': {'Description': 'Unused entry'}, + '024DEE41-33E7-11D3-9D69-0008C781F39F': {'Description': 'MBR partition scheme'}, + 'C12A7328-F81F-11D2-BA4B-00A0C93EC93B': {'Description': 'EFI System partition'}, + '21686148-6449-6E6F-744E-656564454649': {'Description': 'BIOS Boot partition'}, + 'D3BFE2DE-3DAF-11DF-BA40-E3A556D89593': {'Description': 'Intel Fast Flash (iFFS) partition (for Intel Rapid Start technology)'}, + 'F4019732-066E-4E12-8273-346C5641494F': {'Description': 'Sony boot partition'}, + 'BFBFAFE7-A34F-448A-9A5B-6213EB736C22': {'Description': 'Lenovo boot partition'}, + 'E3C9E316-0B5C-4DB8-817D-F92DF00215AE': {'OS': 'Windows', 'Description': 'Microsoft Reserved Partition (MSR)'}, + 'EBD0A0A2-B9E5-4433-87C0-68B6B72699C7': {'OS': 'Windows', 'Description': 'Basic data partition'}, + '5808C8AA-7E8F-42E0-85D2-E1E90434CFB3': {'OS': 'Windows', 'Description': 'Logical Disk Manager (LDM) metadata partition'}, + 'AF9B60A0-1431-4F62-BC68-3311714A69AD': {'OS': 'Windows', 'Description': 'Logical Disk Manager data partition'}, + 'DE94BBA4-06D1-4D40-A16A-BFD50179D6AC': {'OS': 'Windows', 'Description': 'Windows Recovery Environment'}, + '37AFFC90-EF7D-4E96-91C3-2D7AE055B174': {'OS': 'Windows', 'Description': 'IBM General Parallel File System (GPFS) partition'}, + 'E75CAF8F-F680-4CEE-AFA3-B001E56EFC2D': {'OS': 'Windows', 'Description': 'Storage Spaces partition'}, + '75894C1E-3AEB-11D3-B7C1-7B03A0000000': {'OS': 'HP-UX', 'Description': 'Data partition'}, + 'E2A1E728-32E3-11D6-A682-7B03A0000000': {'OS': 'HP-UX', 'Description': 'Service Partition'}, + '0FC63DAF-8483-4772-8E79-3D69D8477DE4': {'OS': 'Linux', 'Description': 'Linux filesystem data'}, + 'A19D880F-05FC-4D3B-A006-743F0F84911E': {'OS': 'Linux', 'Description': 'RAID partition'}, + '44479540-F297-41B2-9AF7-D131D5F0458A': {'OS': 'Linux', 'Description': 'Root partition (x86)'}, + '4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709': {'OS': 'Linux', 'Description': 'Root partition (x86-64)'}, + '69DAD710-2CE4-4E3C-B16C-21A1D49ABED3': {'OS': 'Linux', 'Description': 'Root partition (32-bit ARM)'}, + 'B921B045-1DF0-41C3-AF44-4C6F280D3FAE': {'OS': 'Linux', 'Description': 'Root partition (64-bit ARM/AArch64)'}, + '0657FD6D-A4AB-43C4-84E5-0933C84B4F4F': {'OS': 'Linux', 'Description': 'Swap partition'}, + 'E6D6D379-F507-44C2-A23C-238F2A3DF928': {'OS': 'Linux', 'Description': 'Logical Volume Manager (LVM) partition'}, + '933AC7E1-2EB4-4F13-B844-0E14E2AEF915': {'OS': 'Linux', 'Description': '/home partition'}, + '3B8F8425-20E0-4F3B-907F-1A25A76F98E8': {'OS': 'Linux', 'Description': '/srv (server data) partition'}, + '7FFEC5C9-2D00-49B7-8941-3EA10A5586B7': {'OS': 'Linux', 'Description': 'Plain dm-crypt partition'}, + 'CA7D7CCB-63ED-4C53-861C-1742536059CC': {'OS': 'Linux', 'Description': 'LUKS partition'}, + '8DA63339-0007-60C0-C436-083AC8230908': {'OS': 'Linux', 'Description': 'Reserved'}, + '83BD6B9D-7F41-11DC-BE0B-001560B84F0F': {'OS': 'FreeBSD', 'Description': 'Boot partition'}, + '516E7CB4-6ECF-11D6-8FF8-00022D09712B': {'OS': 'FreeBSD', 'Description': 'Data partition'}, + '516E7CB5-6ECF-11D6-8FF8-00022D09712B': {'OS': 'FreeBSD', 'Description': 'Swap partition'}, + '516E7CB6-6ECF-11D6-8FF8-00022D09712B': {'OS': 'FreeBSD', 'Description': 'Unix File System (UFS) partition'}, + '516E7CB8-6ECF-11D6-8FF8-00022D09712B': {'OS': 'FreeBSD', 'Description': 'Vinum volume manager partition'}, + '516E7CBA-6ECF-11D6-8FF8-00022D09712B': {'OS': 'FreeBSD', 'Description': 'ZFS partition'}, + '48465300-0000-11AA-AA11-00306543ECAC': {'OS': 'OS X Darwin', 'Description': 'Hierarchical File System Plus (HFS+) partition'}, + '55465300-0000-11AA-AA11-00306543ECAC': {'OS': 'OS X Darwin', 'Description': 'Apple UFS'}, + '6A898CC3-1DD2-11B2-99A6-080020736631': {'OS': 'OS X Darwin', 'Description': 'ZFS'}, + '52414944-0000-11AA-AA11-00306543ECAC': {'OS': 'OS X Darwin', 'Description': 'Apple RAID partition'}, + '52414944-5F4F-11AA-AA11-00306543ECAC': {'OS': 'OS X Darwin', 'Description': 'Apple RAID partition, offline'}, + '426F6F74-0000-11AA-AA11-00306543ECAC': {'OS': 'OS X Darwin', 'Description': 'Apple Boot partition (Recovery HD)'}, + '4C616265-6C00-11AA-AA11-00306543ECAC': {'OS': 'OS X Darwin', 'Description': 'Apple Label'}, + '5265636F-7665-11AA-AA11-00306543ECAC': {'OS': 'OS X Darwin', 'Description': 'Apple TV Recovery partition'}, + '53746F72-6167-11AA-AA11-00306543ECAC': {'OS': 'OS X Darwin', 'Description': 'Apple Core Storage (i.e. Lion FileVault) partition'}, + '6A82CB45-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos', 'Description': 'Boot partition'}, + '6A85CF4D-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos', 'Description': 'Root partition'}, + '6A87C46F-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos', 'Description': 'Swap partition'}, + '6A8B642B-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos', 'Description': 'Backup partition'}, + '6A898CC3-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos', 'Description': '/usr partition'}, + '6A8EF2E9-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos', 'Description': '/var partition'}, + '6A90BA39-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos', 'Description': '/home partition'}, + '6A9283A5-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos', 'Description': 'Alternate sector'}, + '6A945A3B-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos', 'Description': 'Reserved partition'}, + '6A9630D1-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos'}, + '6A980767-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos'}, + '6A96237F-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos'}, + '6A8D2AC7-1DD2-11B2-99A6-080020736631': {'OS': 'Solaris illumos'}, + '49F48D32-B10E-11DC-B99B-0019D1879648': {'OS': 'NetBSD', 'Description': 'Swap partition'}, + '49F48D5A-B10E-11DC-B99B-0019D1879648': {'OS': 'NetBSD', 'Description': 'FFS partition'}, + '49F48D82-B10E-11DC-B99B-0019D1879648': {'OS': 'NetBSD', 'Description': 'LFS partition'}, + '49F48DAA-B10E-11DC-B99B-0019D1879648': {'OS': 'NetBSD', 'Description': 'RAID partition'}, + '2DB519C4-B10F-11DC-B99B-0019D1879648': {'OS': 'NetBSD', 'Description': 'Concatenated partition'}, + '2DB519EC-B10F-11DC-B99B-0019D1879648': {'OS': 'NetBSD', 'Description': 'Encrypted partition'}, + 'FE3A2A5D-4F32-41A7-B725-ACCC3285A309': {'OS': 'ChromeOS', 'Description': 'ChromeOS kernel'}, + '3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC': {'OS': 'ChromeOS', 'Description': 'ChromeOS rootfs'}, + '2E0A753D-9E48-43B0-8337-B15192CB1B5E': {'OS': 'ChromeOS', 'Description': 'ChromeOS future use'}, + '42465331-3BA3-10F1-802A-4861696B7521': {'OS': 'Haiku', 'Description': 'Haiku BFS'}, + '85D5E45E-237C-11E1-B4B3-E89A8F7FC3A7': {'OS': 'MidnightBSD', 'Description': 'Boot partition'}, + '85D5E45A-237C-11E1-B4B3-E89A8F7FC3A7': {'OS': 'MidnightBSD', 'Description': 'Data partition'}, + '85D5E45B-237C-11E1-B4B3-E89A8F7FC3A7': {'OS': 'MidnightBSD', 'Description': 'Swap partition'}, + '0394EF8B-237E-11E1-B4B3-E89A8F7FC3A7': {'OS': 'MidnightBSD', 'Description': 'Unix File System (UFS) partition'}, + '85D5E45C-237C-11E1-B4B3-E89A8F7FC3A7': {'OS': 'MidnightBSD', 'Description': 'Vinum volume manager partition'}, + '85D5E45D-237C-11E1-B4B3-E89A8F7FC3A7': {'OS': 'MidnightBSD', 'Description': 'ZFS partition'}, + '45B0969E-9B03-4F30-B4C6-B4B80CEFF106': {'OS': 'Ceph', 'Description': 'Ceph Journal'}, + '45B0969E-9B03-4F30-B4C6-5EC00CEFF106': {'OS': 'Ceph', 'Description': 'Ceph dm-crypt Encrypted Journal'}, + '4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D': {'OS': 'Ceph', 'Description': 'Ceph OSD'}, + '4FBD7E29-9D25-41B8-AFD0-5EC00CEFF05D': {'OS': 'Ceph', 'Description': 'Ceph dm-crypt OSD'}, + '89C57F98-2FE5-4DC0-89C1-F3AD0CEFF2BE': {'OS': 'Ceph', 'Description': 'Ceph disk in creation'}, + '89C57F98-2FE5-4DC0-89C1-5EC00CEFF2BE': {'OS': 'Ceph', 'Description': 'Ceph dm-crypt disk in creation'}, + '824CC7A0-36A8-11E3-890A-952519AD3F61': {'OS': 'OpenBSD', 'Description': 'Data partition'}, + 'CEF5A9AD-73BC-4601-89F3-CDEEEEE321A1': {'OS': 'QNX', 'Description': 'Power-safe (QNX6) file system'}, + 'C91818F9-8025-47AF-89D2-F030D7000C2C': {'OS': 'Plan 9', 'Description': 'Plan 9 partition'}, + '9D275380-40AD-11DB-BF97-000C2911D1B8': {'OS': 'VMware ESX', 'Description': 'vmkcore (coredump partition)'}, + 'AA31E02A-400F-11DB-9590-000C2911D1B8': {'OS': 'VMware ESX', 'Description': 'VMFS filesystem partition'}, + '9198EFFC-31C0-11DB-8F78-000C2911D1B8': {'OS': 'VMware ESX', 'Description': 'VMware Reserved'}, + '2568845D-2332-4675-BC39-8FA5A4748D15': {'OS': 'Android-IA', 'Description': 'Bootloader'}, + '114EAFFE-1552-4022-B26E-9B053604CF84': {'OS': 'Android-IA', 'Description': 'Bootloader2'}, + '49A4D17F-93A3-45C1-A0DE-F50B2EBE2599': {'OS': 'Android-IA', 'Description': 'Boot'}, + '4177C722-9E92-4AAB-8644-43502BFD5506': {'OS': 'Android-IA', 'Description': 'Recovery'}, + 'EF32A33B-A409-486C-9141-9FFB711F6266': {'OS': 'Android-IA', 'Description': 'Misc'}, + '20AC26BE-20B7-11E3-84C5-6CFDB94711E9': {'OS': 'Android-IA', 'Description': 'Metadata'}, + '38F428E6-D326-425D-9140-6E0EA133647C': {'OS': 'Android-IA', 'Description': 'System'}, + 'A893EF21-E428-470A-9E55-0668FD91A2D9': {'OS': 'Android-IA', 'Description': 'Cache'}, + 'DC76DDA9-5AC1-491C-AF42-A82591580C0D': {'OS': 'Android-IA', 'Description': 'Data'}, + 'EBC597D0-2053-4B15-8B64-E0AAC75F4DB1': {'OS': 'Android-IA', 'Description': 'Persistent'}, + '8F68CC74-C5E5-48DA-BE91-A0C8C15E9C80': {'OS': 'Android-IA', 'Description': 'Factory'}, + '767941D0-2085-11E3-AD3B-6CFDB94711E9': {'OS': 'Android-IA', 'Description': 'Fastboot / Tertiary'}, + 'AC6D7924-EB71-4DF8-B48D-E267B27148FF': {'OS': 'Android-IA', 'Description': 'OEM'}, + '7412F7D5-A156-4B13-81DC-867174929325': {'OS': 'ONIE', 'Description': 'Boot'}, + 'D4E6E2CD-4469-46F3-B5CB-1BFF57AFC149': {'OS': 'ONIE', 'Description': 'Config'}, + '9E1A2D38-C612-4316-AA26-8B49521E5A8B': {'OS': 'PowerPC', 'Description': 'PReP boot'}, + 'BC13C2FF-59E6-4262-A352-B275FD6F7172': {'OS': 'Freedesktop', 'Description': 'Extended Boot Partition ($BOOT)'}, +} + +def lookup_guid(guid): + return PARTITION_UIDS.get(guid.upper(), None) + +if __name__ == '__main__': + print("This file is not meant to be called directly.") diff --git a/.bin/Scripts/reset_browsers.ps1 b/.bin/Scripts/reset_browsers.ps1 index bacab45e..9e6ccfca 100644 --- a/.bin/Scripts/reset_browsers.ps1 +++ b/.bin/Scripts/reset_browsers.ps1 @@ -1,13 +1,13 @@ -# WK-BrowserReset +# Wizard Kit: Reset web browsers to safe default while saving user data ## Init ## $wd = $(Split-Path $MyInvocation.MyCommand.Path) pushd "$wd" . .\init.ps1 clear -$host.UI.RawUI.WindowTitle = "WK Browser Reset Tool" -$backup_path = "$WKPath\Backups\$username\$date" -$logpath = "$WKPath\Info\$date" +$host.UI.RawUI.WindowTitle = "Wizard Kit: Browser Reset Tool" +$backup_path = "$ClientPath\Backups\$username\$date" +$logpath = "$ClientPath\Info\$date" md "$backup_path" 2>&1 | out-null md "$logpath" 2>&1 | out-null $log = "$logpath\Browsers.log" @@ -22,15 +22,15 @@ if (test-path "$programfiles\Mozilla Firefox\firefox.exe") { $ff_exe = "$programfiles\Mozilla Firefox\firefox.exe" } $ff_profile_list = @(gci "$ff_appdata\Profiles" 2> $null | ?{ $_.PSIsContainer }) -$ff_profile_list = $ff_profile_list -inotmatch '\.wkbak' +$ff_profile_list = $ff_profile_list -inotmatch '\.WKBak' $chrome_appdata = "$localappdata\Google\Chrome" $chrome_clean = $false $chrome_exe = "$programfiles86\Google\Chrome\Application\chrome.exe" $chrome_profile_list = @(gci "$chrome_appdata\User Data" 2> $null | ?{ $_.PSIsContainer }) -$chrome_profile_list = $chrome_profile_list -inotmatch '\.wkbak' -imatch '^(Default|Profile)' +$chrome_profile_list = $chrome_profile_list -inotmatch '\.WKBak' -imatch '^(Default|Profile)' # OS Check -. .\os_check.ps1 +. .\check_os.ps1 if ($arch -eq 64) { $sz = "$bin\7-Zip\7za64.exe" } @@ -39,27 +39,27 @@ if ($arch -eq 64) { function gen-backup-name { param ([String]$name) - # Add .wkbak to name - $newname = "$name.wkbak" + # Add .WKBak to name + $newname = "$name.WKBak" # Check if the new name exists if (test-path "$newname") { # Change name to avoid overwriting any backups $x = 2 - $newname = "$name.wkbak$x" + $newname = "$name.WKBak$x" while (test-path "$newname") { $x += 1 - $newname = "$name.wkbak$x" + $newname = "$name.WKBak$x" } } return $newname } function ff-create-default-profile { - wk-write " Creating new default profile" "$log" + WK-write " Creating new default profile" "$log" # Check for existing profiles if ($ff_profile_list.length -gt 0) { - wk-error " Firefox profile folders found. Possibly corrupt?" "$log" + WK-error " Firefox profile folders found. Possibly corrupt?" "$log" return $false } @@ -78,7 +78,7 @@ function ff-create-default-profile { "default") start -wait "$ff_exe" -argumentlist $ff_args -windowstyle minimized } else { - wk-error " firefox.exe not found. Please verify installation." "$log" + WK-error " firefox.exe not found. Please verify installation." "$log" return $false } return $true @@ -86,11 +86,11 @@ function ff-create-default-profile { ## Internet Explorer ## -wk-write "==== Internet Explorer ====" "$log" +WK-write "==== Internet Explorer ====" "$log" # Cleanup if (test-path ".bin\Bleachbit") { - wk-write " Removing temporary files" "$log" + WK-write " Removing temporary files" "$log" pushd ".bin\Bleachbit" start -wait "bleachbit_console.exe" -argumentlist @("-c", "internet_explorer.forms", "internet_explorer.temporary_files", "winapp2_internet.internet_explorer_10_11") -verb runas -windowstyle minimized popd @@ -98,7 +98,7 @@ if (test-path ".bin\Bleachbit") { # Backup Favorites if (test-path "$userprofile\Favorites") { - wk-write " Backing up Favorites" "$log" + WK-write " Backing up Favorites" "$log" pushd "$userprofile" $sz_args = @( "a", @@ -123,10 +123,10 @@ if (ask " Reset to default settings?" "$log") { $_current_homepage = $ie_settings."Start Page" if ($_current_homepage -ne $null -and $_current_homepage.Length -ne 0) { $_secondary_homepages = @($ie_settings."Secondary Start Pages") - wk-write " Current homepage: $_current_homepage" "$log" + WK-write " Current homepage: $_current_homepage" "$log" foreach ($p in $_secondary_homepages) { if ($p -ne $null -and $p.Length -ne 0) { - wk-write " $p" "$log" + WK-write " $p" "$log" } } if ($_current_homepage -inotmatch '^https://www\.google\.com/$' -or $_secondary_homepages -imatch '^.+') { @@ -135,7 +135,7 @@ if ($_current_homepage -ne $null -and $_current_homepage.Length -ne 0) { } # Set homepage(s) -wk-write " Setting homepage" "$log" +WK-write " Setting homepage" "$log" if ($reset_homepage) { sp -path hkcu:"Software\Microsoft\Internet Explorer\Main" -name "Start Page" -Value "https://www.google.com/" 2>&1 | out-null rp -path hkcu:"Software\Microsoft\Internet Explorer\Main" -name "Secondary Start Pages" 2>&1 | out-null @@ -153,19 +153,18 @@ if (test-path "$programfiles86\Internet Explorer\iexplore.exe") { # start -wait "$programfiles86\Internet Explorer\iexplore.exe" -argumentlist "https://adblockplus.org" #} } else { - wk-error " $programfiles86\Internet Explorer\iexplore.exe not found" "$log" + WK-error " $programfiles86\Internet Explorer\iexplore.exe not found" "$log" } -wk-write "" "$log" -pause +WK-write "" "$log" ## Mozilla Firefox ## -wk-write "==== Mozilla Firefox ====" "$log" +WK-write "==== Mozilla Firefox ====" "$log" $ff_errors = 0 # Reduce size of AppData folder if (test-path ".bin\Bleachbit") { - wk-write " Removing temporary files" "$log" + WK-write " Removing temporary files" "$log" pushd ".bin\Bleachbit" start -wait "bleachbit_console.exe" -argumentlist @("-c", "firefox.cache", "firefox.forms", "firefox.session_restore", "firefox.vacuum", "winapp2_mozilla.corrupt_sqlites") -verb runas -nonewwindow popd @@ -173,7 +172,7 @@ if (test-path ".bin\Bleachbit") { # Backup AppData if (test-path "$ff_appdata") { - wk-write " Backing up AppData" "$log" + WK-write " Backing up AppData" "$log" pushd "$ff_appdata" $sz_args = @( "a", @@ -192,20 +191,20 @@ if ($ff_profile_list.length -eq 0) { # Update profile list to catch newly created profiles sleep -s 1 $ff_profile_list = @(gci "$ff_appdata\Profiles" 2> $null | ?{ $_.PSIsContainer }) - $ff_profile_list = $ff_profile_list -inotmatch '\.wkbak\d*$' + $ff_profile_list = $ff_profile_list -inotmatch '\.WKBak\d*$' if ($ff_profile_list.length -eq 0) { - wk-warn " Failed to create default profile." "$log" + WK-warn " Failed to create default profile." "$log" $ff_errors += 1 } else { # Configure new profile $ff_clean = $true } } else { - wk-error " Failed to create default profile." "$log" + WK-error " Failed to create default profile." "$log" $ff_errors += 1 } } else { - wk-write " Profiles found: $($ff_profile_list.length)" "$log" + WK-write " Profiles found: $($ff_profile_list.length)" "$log" $ff_clean = (ask " Reset profile(s) to safe settings?" "$log") } @@ -213,7 +212,7 @@ if ($ff_profile_list.length -eq 0) { if ($ff_clean -and $ff_errors -eq 0) { pushd "$ff_appdata\Profiles" foreach ($ff_profile in $ff_profile_list) { - wk-write " Resetting profile: $ff_profile" "$log" + WK-write " Resetting profile: $ff_profile" "$log" # Backup old settings and only preserve essential settings $ff_profile_bak = (gen-backup-name "$ff_profile") @@ -249,7 +248,7 @@ if ($ff_clean -and $ff_errors -eq 0) { } # Set homepage and search settings - wk-write " Setting homepage and default search" "$log" + WK-write " Setting homepage and default search" "$log" out-file -encoding 'ascii' -filepath "$ff_profile\prefs.js" -inputobject 'user_pref("browser.search.geoSpecificDefaults", false);' out-file -encoding 'ascii' -filepath "$ff_profile\prefs.js" -inputobject 'user_pref("browser.search.defaultenginename", "Google");' -append out-file -encoding 'ascii' -filepath "$ff_profile\prefs.js" -inputobject 'user_pref("browser.search.defaultenginename.US", "Google");' -append @@ -261,7 +260,7 @@ if ($ff_clean -and $ff_errors -eq 0) { $_current_homepage = $_current_homepage -ireplace 'user_pref\("browser.startup.homepage", "(.*)"\);', '$1' $_header = " Current homepage:" foreach ($url in @("$_current_homepage".split("|"))) { - wk-write "$_header $_current_homepage" "$log" + WK-write "$_header $_current_homepage" "$log" $_header = " " } if ($_current_homepage -inotmatch '^https://www\.google\.com/$') { @@ -273,7 +272,7 @@ if ($ff_clean -and $ff_errors -eq 0) { } $homepage = 'user_pref("browser.startup.homepage", "' + $homepage + '");' out-file -encoding 'ascii' -filepath "$ff_profile\prefs.js" -inputobject $homepage -append - wk-write "" "$log" + WK-write "" "$log" } popd } @@ -284,20 +283,19 @@ if (test-path "$ff_exe") { start -wait "$ff_exe" -argumentlist "https://addons.mozilla.org/en-us/firefox/addon/ublock-origin/" } } else { - wk-error " firefox.exe not found. Please verify installation." "$log" + WK-error " firefox.exe not found. Please verify installation." "$log" } -wk-write "" "$log" -pause +WK-write "" "$log" ## Google Chrome ## -wk-write "==== Google Chrome ====" "$log" +WK-write "==== Google Chrome ====" "$log" $chrome_errors = 0 # Reduce size of AppData folder if (test-path ".bin\Bleachbit") { - wk-write " Removing temporary files" "$log" + WK-write " Removing temporary files" "$log" pushd ".bin\Bleachbit" start -wait "bleachbit_console.exe" -argumentlist @("-c", "google_chrome.cache", "google_chrome.form_history", "google_chrome.search_engines", "google_chrome.session", "google_chrome.vacuum") -verb runas -nonewwindow popd @@ -305,7 +303,7 @@ if (test-path ".bin\Bleachbit") { # Backup AppData if (test-path "$chrome_appdata") { - wk-write " Backing up AppData" "$log" + WK-write " Backing up AppData" "$log" pushd "$chrome_appdata" $sz_args = @( "a", @@ -319,17 +317,17 @@ if (test-path "$chrome_appdata") { # Check for profiles if ($chrome_profile_list.length -gt 0) { - wk-write " Profiles found: $($chrome_profile_list.length)" "$log" + WK-write " Profiles found: $($chrome_profile_list.length)" "$log" $chrome_clean = (ask " Reset profile(s) to safe settings?" "$log") } else { - wk-warn " No profiles found" "$log" + WK-warn " No profiles found" "$log" } # Reset profile(s) to safe defaults if ($chrome_clean -and $chrome_errors -eq 0) { pushd "$chrome_appdata\User Data" foreach ($chrome_profile in $chrome_profile_list) { - wk-write " Cleaning profile: $chrome_profile" "$log" + WK-write " Cleaning profile: $chrome_profile" "$log" $chrome_profile_bak = (gen-backup-name "$chrome_profile") mv "$chrome_profile" "$chrome_profile_bak" md "$chrome_profile" 2>&1 | out-null @@ -349,7 +347,7 @@ if ($chrome_clean -and $chrome_errors -eq 0) { '"Visited Links"', '"Web Data"') start "robocopy" -argumentlist $robocopy_args -wait -windowstyle minimized - wk-write "" "$log" + WK-write "" "$log" } popd } @@ -357,7 +355,7 @@ if ($chrome_clean -and $chrome_errors -eq 0) { # Test for single-user installation if (test-path "$chrome_appdata\Application\chrome.exe") { if (test-path "$chrome_exe") { - wk-warn " Single-user and multi-user installations present. Please reinstall Chrome." "$log" + WK-warn " Single-user and multi-user installations present. Please reinstall Chrome." "$log" } else { $chrome_exe = "$chrome_appdata\Application\chrome.exe" } @@ -372,9 +370,9 @@ if (test-path "$chrome_exe") { start -wait "$chrome_exe" -argumentlist "https://chrome.google.com/webstore/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm?hl=en" } } else { - wk-error " chrome.exe not found. Please verify installation." "$log" + WK-error " chrome.exe not found. Please verify installation." "$log" } -wk-write "" "$log" +WK-write "" "$log" ## Done ## diff --git a/.bin/Scripts/sfc_scan.cmd b/.bin/Scripts/sfc_scan.cmd index a934cb96..6d8b599d 100644 --- a/.bin/Scripts/sfc_scan.cmd +++ b/.bin/Scripts/sfc_scan.cmd @@ -8,7 +8,7 @@ for %%f in (%*) do ( ) :Init -title WK System File Checker +title Wizard Kit: System File Checker color 1b :ScheduleCheck diff --git a/.bin/Scripts/sw_diagnostics.ps1 b/.bin/Scripts/sw_diagnostics.ps1 new file mode 100644 index 00000000..c8bff9a8 --- /dev/null +++ b/.bin/Scripts/sw_diagnostics.ps1 @@ -0,0 +1,354 @@ +# Wizard Kit: Software Diagnostics + +## Init ## +$wd = $(Split-Path $MyInvocation.MyCommand.Path) +pushd "$wd" +. .\init.ps1 +clear +$host.UI.RawUI.WindowTitle = "Wizard Kit: Diagnostics Tool" +$backup_path = "$ClientPath\Backups\$username\$date" +$logpath = "$ClientPath\Info\$date" +md "$backup_path" 2>&1 | out-null +md "$logpath" 2>&1 | out-null +$log = "$logpath\Diagnostics.log" +$bin = (Get-Item $wd).Parent.FullName +$diag_dest = "/srv/Diagnostics" +$diag_server = "10.0.0.10" +$diag_user = "wkdiag" +$conemu = "$bin\ConEmu\ConEmu.exe" +$sz = "$bin\7-Zip\7za.exe" +$produkey = "$bin\tmp\ProduKey.exe" +$siv = "$bin\SIV\SIV.exe" + +# OS Check +. .\check_os.ps1 +if ($arch -eq 64) { + $conemu = "$bin\ConEmu\ConEmu64.exe" + $sz = "$bin\7-Zip\7za64.exe" + $produkey = "$bin\tmp\ProduKey64.exe" + $siv = "$bin\SIV\SIV64.exe" +} + +# Set Service Order +while ($service_order -notmatch '^\d+') { + $service_order = read-host "Please enter the service order number" + if ($service_order -notmatch '^\d+') { + write-host "ERROR: Invalid SO`r`n" -foreground "red" + } +} +clear +out-file -filepath "$logpath\TicketNumber" -inputobject $service_order -append +WK-write "Starting SW diagnostics for Ticket #$service_order" "$log" +WK-write "" "$log" + +## Sanitize Environment ## +#~# BROKEN #~# +#~# # ProcessKiller +#~# # adapted from TronScript (reddit.com/r/TronScript) and credit to /u/cuddlychops06 +#~# #WK-write "* Stopping all processes" "$log" +#~# taskkill.exe /F /FI "USERNAME eq Demo" /FI "IMAGENAME ne ClassicShellService.exe" /FI "IMAGENAME ne explorer.exe" /FI "IMAGENAME ne dwm.exe" /FI "IMAGENAME ne cmd.exe" /FI "IMAGENAME ne Taskmgr.exe" /FI "IMAGENAME ne MsMpEng.exe" /FI "IMAGENAME ne powershell.exe" /FI "IMAGENAME ne rkill.exe" /FI "IMAGENAME ne rkill64.exe" /FI "IMAGENAME ne rkill.com" /FI "IMAGENAME ne rkill64.com" /FI "IMAGENAME ne conhost.exe" /FI "IMAGENAME ne dashost.exe" /FI "IMAGENAME ne vmtoolsd.exe" /FI "IMAGENAME ne conhost.exe" 2>&1 | out-null + +# RKill +WK-write "* Running RKill" "$log" +start -wait "$conemu" -argumentlist @("/cmd", "$bin\RKill\RKill.exe", "-l", "$logpath\rkill.log") +if (!(ask "Did RKill run correctly?" "$log")) { + start -wait "$conemu" -argumentlist @("/cmd", "$bin\RKill\explorer.exe", "-l", "$logpath\rkill.log") + if (!(ask "Did RKill run correctly?" "$log")) { + WK-warn "Since RKill has failed to run, please try an alternative version." "$log" + WK-warn "Opening RKill folder..." "$log" + WK-write "" "$log" + sleep -s 2 + ii "$bin\RKill\" + pause + } +} + +# TDSSKiller Rootkit scan +WK-write "* Running Rootkit scan" "$log" +if (test-path "$bin\TDSSKiller.exe") { + md "$ClientPath\Quarantine\TDSSKiller" 2>&1 | out-null + start -wait "$bin\TDSSKiller.exe" -argumentlist @("-l", "$logpath\TDSSKiller.log", "-qpath", "$ClientPath\Quarantine\TDSSKiller", "-accepteula", "-accepteulaksn", "-dcexact", "-tdlfs") +} else { + WK-error " TDSSKiller.exe missing. Please verify Wizard-Kit was copied correctly." +} + +## Network Check ## +WK-write "* Testing Internet Connection" "$log" +while (!(test-connection "google.com" -count 2 -quiet)) { + WK-warn "System appears offline. Please connect to the internet." "$log" + if (!(ask "Try again?" "$log")) { + WK-error "System still appears offline; aborting script." "$log" + exit 1 + } +} + +## Misc Configuration ## +# Export current power plans +$pow_backup_path = "$ClientPath\Backups\$date\Power Plans" +md "$pow_backup_path" > $null 2>&1 | out-null +foreach ($plan in (powercfg /L)) { + if ($plan -imatch '^Power Scheme.*') { + $guid = $plan -replace 'Power Scheme GUID:\s+([0-9a-f\-]+).*', '$1' + $name = $plan -replace 'Power Scheme GUID:\s+[0-9a-f\-]+\s+\(([^\)]+)\).*', '$1' + $set = ($plan -imatch '.*\*$') + if (!(test-path "$pow_backup_path\$name.pow")) { + powercfg /export "$pow_backup_path\$name.pow" $guid + } + } +} + +# Change Power Plan +WK-write "* Changing power plan to 'High Performance'" "$log" +start "powercfg.exe" -argumentlist @("-restoredefaultschemes") -nonewwindow -redirectstandardoutput out-null +start -wait "powercfg" -argumentlist @("-setactive", "8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c") -nonewwindow -redirectstandardoutput out-null + +## Begin Diagnostics ## +# Infection Scan +WK-write "* Starting background infection scan" "$log" +if ($arch -eq 64) { + $prog = "$bin\HitmanPro\HitmanPro64.exe" +} else { + $prog = "$bin\HitmanPro\HitmanPro.exe" +} +start $prog -argumentlist @("/quiet", "/noinstall", "/noupload", "/log=$logpath\hitman.xml") -workingdirectory "$bin\HitmanPro" + +#~# BROKEN #~# +#~# # OS Health Checks +#~# ## DISM +#~# if ($win_version -match '^8|10$') { +#~# start "$conemu" -argumentlist @("/cmd", "$windir\System32\dism.exe", "/online", "/cleanup-image", "/checkhealth", "/logpath:$logpath\DISM.log", "-new_console:c") +#~# } +#~# ## SFC +#~# start "$conemu" -argumentlist @("/cmd", "$windir\System32\sfc.exe", "/scannow", "-new_console:c") +#~# ## CHKDSK +#~# start "$conemu" -argumentlist @("/cmd", "$windir\System32\chkdsk.exe", "$systemdrive", "-new_console:c") + +# Backup Registry +if (!(test-path "$logpath\Registry")) { + WK-write "* Backing up registry" "$log" + start -wait "$bin\Erunt\ERUNT.EXE" -argumentlist @("$logpath\Registry", "sysreg", "curuser", "otherusers", "/noprogresswindow") -workingdirectory "$bin\Erunt" +} + +# Backup Browsers +if (test-path "$localappdata\Google\Chrome") { + WK-write "* Backing up Google Chrome" "$log" + pushd "$localappdata\Google\Chrome" + $sz_args = @( + "a", "-t7z", "-mx=1", + "$backup_path\Chrome.7z", + '"User Data"') + start $sz -argumentlist $sz_args -wait -windowstyle minimized + popd +} +if (test-path "$appdata\Mozilla\Firefox") { + WK-write "* Backing up Mozilla Firefox" "$log" + pushd "$appdata\Mozilla\Firefox" + $sz_args = @( + "a", "-t7z", "-mx=1", + "$backup_path\Firefox.7z", + "Profiles", + "profiles.ini") + start $sz -argumentlist $sz_args -wait -windowstyle minimized + popd +} +if (test-path "$userprofile\Favorites") { + WK-write "* Backing up Internet Explorer" "$log" + pushd "$userprofile" + $sz_args = @( + "a", "-t7z", "-mx=1", + "$backup_path\IE Favorites.7z", + "Favorites") + start $sz -argumentlist $sz_args -wait -windowstyle minimized + popd +} + +# Get total size of temporary files +if (!(test-path "$logpath\bleachbit.log")) { + WK-write "* Checking for temporary files" "$log" + start -wait "$bin\BleachBit\bleachbit_console.exe" -argumentlist @("--preview", "--preset") -nonewwindow -workingdirectory "$bin\BleachBit" -redirectstandarderror "$logpath\bleachbit.err" -redirectstandardoutput "$logpath\bleachbit.log" +} + +# Autoruns +if (!(test-path "$logpath\autoruns.arn")) { + WK-write "* Starting background autoruns scan" "$log" + New-Item -Path "HKCU:\Software\Sysinternals\AutoRuns" -Force 2>&1 | out-null + Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns" -Name "checkvirustotal" -Value 1 -Type "DWord" | out-null + Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns" -Name "EulaAccepted" -Value 1 -Type "DWord" | out-null + Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns" -Name "shownomicrosoft" -Value 1 -Type "DWord" | out-null + Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns" -Name "shownowindows" -Value 1 -Type "DWord" | out-null + Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns" -Name "showonlyvirustotal" -Value 1 -Type "DWord" | out-null + Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns" -Name "submitvirustotal" -Value 0 -Type "DWord" | out-null + Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns" -Name "verifysignatures" -Value 1 -Type "DWord" | out-null + New-Item "HKCU:\Software\Sysinternals\AutoRuns\SigCheck" 2>&1 | out-null + Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns\SigCheck" -Name "EulaAccepted" -Value 1 -Type "DWord" | out-null + New-Item "HKCU:\Software\Sysinternals\AutoRuns\Streams" 2>&1 | out-null + Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns\Streams" -Name "EulaAccepted" -Value 1 -Type "DWord" | out-null + New-Item "HKCU:\Software\Sysinternals\AutoRuns\VirusTotal" 2>&1 | out-null + Set-ItemProperty -Path "HKCU:\Software\Sysinternals\AutoRuns\VirusTotal" -Name "VirusTotalTermsAccepted" -Value 1 -Type "DWord" | out-null + start "$bin\SysinternalsSuite\autoruns.exe" -workingdirectory "$bin\SysinternalsSuite" -windowstyle "minimized" +} + +# AIDA64 +if (!(test-path "$logpath\keys-aida64.txt")) { + WK-write "* Running AIDA64 (Product Keys)" "$log" + start -wait "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\keys-aida64.txt", "/CUSTOM", "$bin\AIDA64\licenses.rpf", "/TEXT", "/SILENT", "/SAFEST") -workingdirectory "$bin\AIDA64" +} + +if (!(test-path "$logpath\program_list-aida64.txt")) { + WK-write "* Running AIDA64 (SW listing)" "$log" + start -wait "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\program_list-aida64.txt", "/CUSTOM", "$bin\AIDA64\installed_programs.rpf", "/TEXT", "/SILENT", "/SAFEST") -workingdirectory "$bin\AIDA64" +} + +if (!(test-path "$logpath\aida64.htm")) { + WK-write "* Running AIDA64 (Full listing) in background" "$log" + start "$bin\AIDA64\aida64.exe" -argumentlist @("/R", "$logpath\aida64.html", "/CUSTOM", "$bin\AIDA64\full.rpf", "/HTML", "/SILENT") -workingdirectory "$bin\AIDA64" +} + +# SIV +if (!(test-path "$logpath\keys-siv.txt")) { + WK-write "* Running SIV (Product Keys)" "$log" + start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=[product-ids]=$logpath\keys-siv.txt") -workingdirectory "$bin\SIV" +} + +if (!(test-path "$logpath\program_list-siv.txt")) { + WK-write "* Running SIV (SW listing)" "$log" + start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=[software]=$logpath\program_list-siv.txt") -workingdirectory "$bin\SIV" +} + +if (!(test-path "$logpath\aida64.htm")) { + WK-write "* Running SIV (Full listing) in background" "$log" + start -wait "$siv" -argumentlist @("-KEYS", "-LOCAL", "-UNICODE", "-SAVE=$logpath\siv.txt") -workingdirectory "$bin\SIV" +} + +# Product Keys +## Extract +md "$bin\tmp" 2>&1 | out-null +start -wait $sz -argumentlist @("e", "$bin\ProduKey.7z", "-otmp", "-aoa", "-pAbracadabra", "-bsp0", "-bso0") -workingdirectory "$bin" -nonewwindow +rm "$bin\tmp\ProduKey*.cfg" +sleep -s 1 + +## Run +if (!(test-path "$logpath\keys-produkey.txt")) { + WK-write "* Saving Product Keys" "$log" + start -wait $produkey -argumentlist @("/nosavereg", "/stext", "$logpath\keys-produkey.txt") -workingdirectory "$bin\tmp" +} + +## Summary ## +WK-write "" "$log" + +# Removed temp file size +WK-write "==== Temp Files ====" "$log" +$bb = (gc "$logpath\bleachbit.log") -imatch '^(disk space.*recovered|files.*deleted)' +foreach ($_ in $bb) { + $_ = " " + $_ + WK-write $_ "$log" +} +WK-write "" "$log" + +# Free Space +WK-write "==== Free Space ====" "$log" +& "$wd\free_space.ps1" "$log" +WK-write "" "$log" + +# RAM +WK-write "==== RAM ====" "$log" +& "$wd\installed_ram.ps1" "$log" +WK-write "" "$log" + +# List installed Office programs +WK-write "==== Installed Office Programs ====" "$log" +$installed_office = (gc "$logpath\program_list-aida64.txt") -imatch 'Office' | sort +foreach ($_ in $installed_office) { + $_ = $_ -ireplace '^\s+(.*?)\s\s+.*', '$1' + WK-write " $_" "$log" +} +WK-write "" "$log" + +# Saved keys +WK-write "==== Found Product Keys ====" "$log" +$keys = (gc "$logpath\keys-produkey.txt") -imatch '(product.name)' +foreach ($_ in $keys) { + $_ = $_ -ireplace '^product name\s+: ', ' ' + WK-write $_ "$log" +} +WK-write "" "$log" + + +# OS Info +WK-write "==== Operating System ====" "$log" +if ($arch -eq 32) { + WK-error " $os_name x$arch" "$log" +} elseif ($win_info.CurrentVersion -match "6.0") { + if ($win_info.CurrentBuildNumber -match "6002") { + WK-warn " $os_name x$arch" "$log" + } elseif ($win_info.CurrentBuildNumber -match "6001") { + WK-error " $os_name x$arch (very out of date)" "$log" + } elseif ($win_info.CurrentBuildNumber -match "6000") { + WK-error " $os_name x$arch (very out of date)" "$log" + } +} elseif ($win_info.CurrentVersion -match "6.2") { + WK-error " $os_name x$arch (very out of date)" "$log" +} elseif ($win_info.CurrentBuildNumber -match "10240") { + WK-error " $os_name x$arch (Release 1511 not installed)" "$log" +} else { + WK-write " $os_name x$arch" "$log" +} +if ($win_act -imatch 'unavailable') { + WK-warn "$win_act" "$log" +} elseif ($win_act -notmatch "permanent") { + WK-error "$win_act" "$log" +} else { + WK-write "$win_act" "$log" +} +WK-write "" "$log" + +# Updates Check +# TODO: Finish and test this +#WK-write "==== Windows Updates ====" "$log" +#import-module "$bin\Scripts\PSWindowsUpdate" +# Check last install date +#get-wuhistory | sort-object date -descending | select-object -first 1 +# Check if installs CS +# TODO +# Return avail updates +#get-wulist +#WK-write "" "$log" + +# Battery Check +WK-write "==== Battery Check ====" "$log" +& "$wd\check_battery.ps1" "$log" +WK-write "" "$log" + +# User Data +WK-write "==== User Data ====" "$log" +& "$wd\user_data.ps1" "$log" +WK-write "" "$log" + +# Upload info +write-host "Uploading info to NAS..." + +## Write batch +$batch = "lcd `"{0}`"`r`n" -f $ClientPath +$batch += "cd `"{0}`"`r`n" -f $diag_dest +$batch += "put -r Info `"{0}`"`r`n" -f $service_order +out-file -encoding "ASCII" -filepath "$wd\psftp_batch" -inputobject $batch + +## Upload files +$psftp_args = @( + "-noagent", + "-i", "$bin\PuTTY\WK.ppk", + "$diag_user@$diag_server", + "-b", "$wd\psftp_batch") +start "$bin\PuTTY\PSFTP.exe" -argumentlist $psftp_args -wait -windowstyle minimized + +## Done ## +popd +pause "Press Enter to exit..." + +# Open log +$notepad2 = "$bin\Notepad2\Notepad2-Mod.exe" +if (test-path $notepad2) { + start "$notepad2" -argumentlist $log +} else { + start "notepad" -argumentlist $log +} diff --git a/.bin/Scripts/transferred_keys.cmd b/.bin/Scripts/transferred_keys.cmd index 56726f4f..ee1d419d 100644 --- a/.bin/Scripts/transferred_keys.cmd +++ b/.bin/Scripts/transferred_keys.cmd @@ -1,93 +1,88 @@ -@echo off +:: Wizard Kit: Scan all transferred software hive for product keys -rem This script assumes it is running as admin, as such it is not meant to be run directly. +@echo off :Flags for %%f in (%*) do ( if /i "%%f" == "/DEBUG" (@echo on) ) +:FindBin +set bin= & pushd "%~dp0" +:FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner +:FindBinDone +set "bin=%cd%\.bin" & popd + :Init setlocal EnableDelayedExpansion color 1b -title WK Key Finder -set "bin=.." +title Wizard Kit: Key Finder +rem Create %client_dir%\Info\YYYY-MM-DD and set path as %log_dir% +call "%bin%\Scripts\init_client_dir.cmd" /Info +set "transfer_dir=%client_dir%\Transfer" -:WKInfo -rem Create WK\Info\YYYY-MM-DD and set path as !log_dir! -call "wk_info.cmd" +:ClearConfigs +if not exist "%bin%\tmp" goto Extract +pushd "%bin%\tmp" +if exist "ProduKey.cfg" del "ProduKey.cfg" +if exist "ProduKey64.cfg" del "ProduKey64.cfg" +popd + +:Extract +mkdir "%bin%\tmp" >nul 2>&1 +"%bin%\7-Zip\7za.exe" e "%bin%\ProduKey.7z" -o"%bin%\tmp" -aoa -pAbracadabra -bsp0 -bso0 +ping -n 2 127.0.0.1>nul +set "prog=%bin%\tmp\ProduKey.exe" +if /i "!PROCESSOR_ARCHITECTURE!" == "AMD64" ( + if exist "!prog:.=64.!" set "prog=!prog:.=64.!" +) :FindHives +cls echo Scanning for transferred software hive(s)... -set "found_hive=" -rem Transferred (Main) -set "sw_hive=%systemdrive%\WK\Transfer\Software" -if exist "!sw_hive!" ( - set "found_hive=true" - echo. !sw_hive! - echo ==== !sw_hive! ====>> "!log_dir!\transferred_keys.txt" - call "Launch.cmd" Program "!bin!\tmp" "ProduKey.exe" "/IEKeys 0 /ExtractEdition 1 /nosavereg /regfile !sw_hive! /stext !log_dir!\transferred_keys.tmp" /wait /admin - type "!log_dir!\transferred_keys.tmp">> "!log_dir!\transferred_keys.txt" - del "!log_dir!\transferred_keys.tmp" -) -set "sw_hive=%systemdrive%\WK\Transfer\Windows\System32\config\Software" -if exist "!sw_hive!" ( - set "found_hive=true" - echo. !sw_hive! - echo ==== !sw_hive! ====>> "!log_dir!\transferred_keys.txt" - call "Launch.cmd" Program "!bin!\tmp" "ProduKey.exe" "/IEKeys 0 /ExtractEdition 1 /nosavereg /regfile !sw_hive! /stext !log_dir!\transferred_keys.tmp" /wait /admin - type "!log_dir!\transferred_keys.tmp">> "!log_dir!\transferred_keys.txt" - del "!log_dir!\transferred_keys.tmp" -) -set "sw_hive=%systemdrive%\WK\Transfer\Windows\System32\config\RegBack\Software" -if exist "!sw_hive!" ( - set "found_hive=true" - echo. !sw_hive! - echo ==== !sw_hive! ====>> "!log_dir!\transferred_keys.txt" - call "Launch.cmd" Program "!bin!\tmp" "ProduKey.exe" "/IEKeys 0 /ExtractEdition 1 /nosavereg /regfile !sw_hive! /stext !log_dir!\transferred_keys.tmp" /wait /admin - type "!log_dir!\transferred_keys.tmp">> "!log_dir!\transferred_keys.txt" - del "!log_dir!\transferred_keys.tmp" -) - -rem Transferred (Win.old) -set "sw_hive=%systemdrive%\WK\Transfer\Win.old\Software" -if exist "!sw_hive!" ( - set "found_hive=true" - echo. !sw_hive! - echo ==== !sw_hive! ====>> "!log_dir!\transferred_keys.txt" - call "Launch.cmd" Program "!bin!\tmp" "ProduKey.exe" "/IEKeys 0 /ExtractEdition 1 /nosavereg /regfile !sw_hive! /stext !log_dir!\transferred_keys.tmp" /wait /admin - type "!log_dir!\transferred_keys.tmp">> "!log_dir!\transferred_keys.txt" - del "!log_dir!\transferred_keys.tmp" -) -set "sw_hive=%systemdrive%\WK\Transfer\Windows.old\Windows\System32\config\Software" -if exist "!sw_hive!" ( - set "found_hive=true" - echo. !sw_hive! - echo ==== !sw_hive! ====>> "!log_dir!\transferred_keys.txt" - call "Launch.cmd" Program "!bin!\tmp" "ProduKey.exe" "/IEKeys 0 /ExtractEdition 1 /nosavereg /regfile !sw_hive! /stext !log_dir!\transferred_keys.tmp" /wait /admin - type "!log_dir!\transferred_keys.tmp">> "!log_dir!\transferred_keys.txt" - del "!log_dir!\transferred_keys.tmp" -) -set "sw_hive=%systemdrive%\WK\Transfer\Windows.old\Windows\System32\config\RegBack\Software" -if exist "!sw_hive!" ( - set "found_hive=true" - echo. !sw_hive! - echo ==== !sw_hive! ====>> "!log_dir!\transferred_keys.txt" - call "Launch.cmd" Program "!bin!\tmp" "ProduKey.exe" "/IEKeys 0 /ExtractEdition 1 /nosavereg /regfile !sw_hive! /stext !log_dir!\transferred_keys.tmp" /wait /admin - type "!log_dir!\transferred_keys.tmp">> "!log_dir!\transferred_keys.txt" - del "!log_dir!\transferred_keys.tmp" -) +call :ScanHive "%transfer_dir%\Software" +call :ScanHive "%transfer_dir%\config\Software" +call :ScanHive "%transfer_dir%\config\RegBack\Software" +call :ScanHive "%transfer_dir%\Windows\System32\config\Software" +call :ScanHive "%transfer_dir%\Windows\System32\config\RegBack\Software" +call :ScanHive "%transfer_dir%\Windows.old\Software" +call :ScanHive "%transfer_dir%\Windows.old\config\Software" +call :ScanHive "%transfer_dir%\Windows.old\config\RegBack\Software" +call :ScanHive "%transfer_dir%\Windows.old\Windows\System32\config\Software" +call :ScanHive "%transfer_dir%\Windows.old\Windows\System32\config\RegBack\Software" +call :ScanHive "%transfer_dir%\Win.old\Software" +call :ScanHive "%transfer_dir%\Win.old\config\Software" +call :ScanHive "%transfer_dir%\Win.old\config\RegBack\Software" +call :ScanHive "%transfer_dir%\Win.old\Windows\System32\config\Software" +call :ScanHive "%transfer_dir%\Win.old\Windows\System32\config\RegBack\Software" :ShowResults -if not defined found_hive (goto NoResults) -call "Launch.cmd" Program "%bin%\Notepad2" "Notepad2-Mod.exe" "%log_dir%\transferred_keys.txt" +if not exist "%log_dir%\transferred_keys.txt" (goto NoResults) +call "%bin%\Scripts\Launch.cmd" Program "%bin%\Notepad2" "Notepad2-Mod.exe" "%log_dir%\transferred_keys.txt" goto Done +:ScanHive +if exist "%~1" ( + echo. %~1 + echo ==== %~1 ====>> "%log_dir%\transferred_keys.txt" + "%prog%" /IEKeys 0 /WindowsKeys 1 /OfficeKeys 1 /ExtractEdition 1 /nosavereg /regfile "%~1" /stext "" >> %log_dir%\transferred_keys.txt +) +goto :EOF + :NoResults echo. echo No keys found. goto Error +:ErrorNoBin +popd +echo ".bin" folder not found, aborting script. +echo. +goto Error + :Error color 4e echo. @@ -99,7 +94,8 @@ goto Exit goto Exit :Exit -rem pause popd color -endlocal \ No newline at end of file +endlocal + +:EOF diff --git a/.bin/Scripts/update_kit.ps1 b/.bin/Scripts/update_kit.ps1 new file mode 100644 index 00000000..f4f57736 --- /dev/null +++ b/.bin/Scripts/update_kit.ps1 @@ -0,0 +1,312 @@ +# Wizard Kit: Download the latest versions of the programs in the kit + +## Init ## +$wd = $(Split-Path $MyInvocation.MyCommand.Path) +pushd "$wd" +. .\init.ps1 +clear +$host.UI.RawUI.WindowTitle = "Wizard Kit: Kit Update Tool" +$bin = (Get-Item $wd).Parent.FullName +$curl = "$bin\curl\curl.exe" +$sz = "$bin\7-Zip\7za.exe" + +# OS Check +. .\check_os.ps1 +if ($arch -eq 64) { + $sz = "$bin\7-Zip\7za64.exe" +} + +## Functions ## +function download-file { + param ([String]$path, [String]$name, [String]$url) + $output = "{0}\{1}" -f $path, $name + + write-host ("Downloading {0}" -f $name) + New-Item -Type Directory $path 2>&1 | Out-Null + start "$curl" -argumentlist @("-#LSfo", "`"$output`"", "`"$url`"") -nonewwindow -wait +} +function find-dynamic-url { + param ([String]$source_page, [String]$regex) + $d_url = "" + + # Get source page + start "$curl" -argumentlist @("-Lfso", "tmp_page", "`"$source_page`"") -nonewwindow -wait + + # Search for real url + $d_url = Get-Content "tmp_page" | Where-Object {$_ -imatch $regex} + $d_url = $d_url -ireplace '.*(a |)href="([^"]+)".*', '$2' + $d_url = $d_url -ireplace ".*(a |)href='([^']+)'.*", '$2' + + # Remove tmp_page + Remove-Item "tmp_page" + + return $d_url +} + +## Diagnostics ## +# HitmanPro +$path = "$bin\HitmanPro" +$name = "HitmanPro.exe" +$url = "http://dl.surfright.nl/HitmanPro.exe" +download-file $path $name $url +$name = "HitmanPro64.exe" +$url = "http://dl.surfright.nl/HitmanPro_x64.exe" +download-file $path $name $url + +## VR-OSR ## +# AdwCleaner +$path = "$bin" +$name = "AdwCleaner.exe" +$dl_page = "http://www.bleepingcomputer.com/download/adwcleaner/dl/125/" +$regex = "href=.*http(s|)://download\.bleepingcomputer\.com/dl/[a-zA-Z0-9]+/[a-zA-Z0-9]+/windows/security/security-utilities/a/adwcleaner/AdwCleaner\.exe" +$url = find-dynamic-url $dl_page $regex +download-file $path $name $url + +# ESET Online Scanner +$path = "$bin" +$name = "ESET.exe" +$url = "http://download.eset.com/special/eos/esetsmartinstaller_enu.exe" +download-file $path $name $url + +# Junkware Removal Tool +$path = "$bin" +$name = "JRT.exe" +$url = "http://downloads.malwarebytes.org/file/jrt" +download-file $path $name $url + +# Kaspersky Virus Removal Tool +$path = "$bin" +$name = "KVRT.exe" +$url = "http://devbuilds.kaspersky-labs.com/devbuilds/KVRT/latest/full/KVRT.exe" +download-file $path $name $url + +# RKill +$path = "$bin\RKill" +$name = "RKill.exe" +$dl_page = "http://www.bleepingcomputer.com/download/rkill/dl/10/" +$regex = "href=.*http(s|)://download\.bleepingcomputer\.com/dl/[a-zA-Z0-9]+/[a-zA-Z0-9]+/windows/security/security-utilities/r/rkill/rkill\.exe" +$url = find-dynamic-url $dl_page $regex +download-file $path $name $url + +# TDSSKiller +$path = "$bin" +$name = "TDSSKiller.exe" +$url = "http://media.kaspersky.com/utilities/VirusUtilities/EN/tdsskiller.exe" +download-file $path $name $url + +## Driver Tools ## +# Acer Serial Number Detect Tool +$path = "$bin\_Drivers" +$name = "Acer Serial Number Detect Tool.exe" +$url = "http://global-download.acer.com/SupportFiles/Files/SNID/APP/SerialNumberDetectionTool.exe" +download-file $path $name $url + +# AMD Autodetect +$path = "$bin\_Drivers" +$name = "AMD Autodetect.exe" +$url = "http://www2.ati.com/drivers/auto/autodetectutility.exe" +download-file $path $name $url + +# AMD Gaming Evolved +$path = "$bin\_Drivers" +$name = "AMD Gaming Evolved.exe" +$url = "http://clientupdater.raptr.com/client/pc/amd/raptr_installer.exe" +download-file $path $name $url + +# Dell System Detect +$path = "$bin\_Drivers" +$name = "Dell System Detect.exe" +$url = "https://downloads.dell.com/tools/dellsystemdetect/dellsystemdetectlauncher.exe" +download-file $path $name $url + +# GeForce Experience +$path = "$bin\_Drivers" +$name = "GeForce Experience.exe" +$dl_page = "http://www.geforce.com/geforce-experience/download" +$regex = "href=.*http(s|)://us\.download\.nvidia\.com/GFE/GFEClient/[0-9\.]+/GeForce_Experience_v[0-9\.]+\.exe" +$url = find-dynamic-url $dl_page $regex +download-file $path $name $url + +# HP Support Solutions Framework +$path = "$bin\_Drivers" +$name = "HP Support Solutions Framework.exe" +$url = "http://h20614.www2.hp.com/ediags/filehosting/api/installer" +download-file $path $name $url + +# Intel Driver Update Utility +$path = "$bin\_Drivers" +$name = "Intel Driver Update Utility.exe" +$dl_page = "http://www.intel.com/content/www/us/en/support/detect.html" +$regex = "a href.*http(s|)://downloadmirror\.intel\.com/[a-zA-Z0-9]+/[a-zA-Z0-9]+/Intel%20Driver%20Update%20Utility%20Installer.exe" +$url = find-dynamic-url $dl_page $regex +$url = find-dynamic-url $dl_page $regex +download-file $path $name $url + +# Intel SSD Toolbox +$path = "$bin\_Drivers" +$name = "Intel SSD Toolbox.exe" +$dl_page = "https://downloadcenter.intel.com/download/26085/Intel-Solid-State-Drive-Toolbox" +$regex = "href=./downloads/eula/[0-9]+/Intel-Solid-State-Drive-Toolbox.httpDown=https\%3A\%2F\%2Fdownloadmirror\.intel\.com\%2F[0-9]+\%2Feng\%2FIntel\%20SSD\%20Toolbox\%20-\%20v[0-9\.]+.exe" +$url = find-dynamic-url $dl_page $regex +$url = $url -ireplace '.*httpDown=(.*)', '$1' +$url = $url -ireplace '%3A', ':' +$url = $url -ireplace '%2F', '/' +download-file $path $name $url + +# Lenovo Service Bridge +$path = "$bin\_Drivers" +$name = "Lenovo Service Bridge.exe" +$url = "https://download.lenovo.com/lsb/LSBsetup.exe" +download-file $path $name $url + +# Samsung Magician +$path = "$bin\_Drivers" +$name = "Samsung Magician.zip" +$dl_page = "http://www.samsung.com/semiconductor/minisite/ssd/download/tools.html" +$regex = "href=./semiconductor/minisite/ssd/downloads/software/Samsung_Magician_Setup_v[0-9]+.zip" +$url = "http://www.samsung.com{0}" -f (find-dynamic-url $dl_page $regex) +download-file $path $name $url +start $sz -argumentlist @("e", "`"$bin\_Drivers\Samsung Magician.zip`"", "-aoa", "-bso0", "-bsp0", "-o$bin\_Drivers") -nonewwindow -wait +Remove-Item "$bin\_Drivers\Samsung Magician.exe" $path 2>&1 | Out-Null +Remove-Item "$bin\_Drivers\Samsung Magician.zip" $path 2>&1 | Out-Null +Move-Item "$bin\_Drivers\Samsung*exe" "$bin\_Drivers\Samsung Magician.exe" $path 2>&1 | Out-Null + +# SanDisk Express Cache +$path = "$bin\_Drivers" +$name = "SanDisk Express Cache.exe" +$url = "http://mp3support.sandisk.com/ReadyCache/ExpressCacheSetup.exe" +download-file $path $name $url + +# Toshiba System Detect +$path = "$bin\_Drivers" +$name = "Toshiba System Detect.exe" +$url = "http://cdgenp01.csd.toshiba.com/content/support/downloads/GetProductInfo.exe" +download-file $path $name $url + +## Installers ## +$path = (Get-Item $wd).Parent.Parent.FullName +$path = "$path\Installers" + +# Ninite - Main +download-file "$path" "MSE.exe" "https://ninite.com/essentials/ninite.exe" +download-file "$path" "Runtimes.exe" "https://ninite.com/.net4.6.2-air-java8-silverlight/ninite.exe" +download-file "$path" "Win7.exe" "https://ninite.com/.net4.6.2-7zip-air-chrome-firefox-java8-silverlight-vlc/ninite.exe" +download-file "$path" "Win8.exe" "https://ninite.com/.net4.6.2-7zip-air-chrome-classicstart-firefox-java8-silverlight-vlc/ninite.exe" +download-file "$path" "Win10.exe" "https://ninite.com/.net4.6.2-7zip-air-chrome-classicstart-firefox-java8-silverlight-vlc/ninite.exe" + +# Ninite - Audio-Video +download-file "$path\Extras\Audio-Video" "AIMP.exe" "https://ninite.com/aimp/ninite.exe" +download-file "$path\Extras\Audio-Video" "Audacity.exe" "https://ninite.com/audacity/ninite.exe" +download-file "$path\Extras\Audio-Video" "CCCP.exe" "https://ninite.com/cccp/ninite.exe" +download-file "$path\Extras\Audio-Video" "Foobar2000.exe" "https://ninite.com/foobar/ninite.exe" +download-file "$path\Extras\Audio-Video" "GOM.exe" "https://ninite.com/gom/ninite.exe" +download-file "$path\Extras\Audio-Video" "iTunes.exe" "https://ninite.com/itunes/ninite.exe" +download-file "$path\Extras\Audio-Video" "K-Lite Codecs.exe" "https://ninite.com/klitecodecs/ninite.exe" +download-file "$path\Extras\Audio-Video" "KMPlayer.exe" "https://ninite.com/kmplayer/ninite.exe" +download-file "$path\Extras\Audio-Video" "MediaMonkey.exe" "https://ninite.com/mediamonkey/ninite.exe" +download-file "$path\Extras\Audio-Video" "MusicBee.exe" "https://ninite.com/musicbee/ninite.exe" +download-file "$path\Extras\Audio-Video" "Spotify.exe" "https://ninite.com/spotify/ninite.exe" +download-file "$path\Extras\Audio-Video" "VLC.exe" "https://ninite.com/vlc/ninite.exe" +download-file "$path\Extras\Audio-Video" "Winamp.exe" "https://ninite.com/winamp/ninite.exe" + +# Ninite - Cloud Storage +download-file "$path\Extras\Cloud Storage" "BitTorrent Sync.exe" "https://ninite.com/bittorrentsync/ninite.exe" +download-file "$path\Extras\Cloud Storage" "Dropbox.exe" "https://ninite.com/dropbox/ninite.exe" +download-file "$path\Extras\Cloud Storage" "Google Drive.exe" "https://ninite.com/googledrive/ninite.exe" +download-file "$path\Extras\Cloud Storage" "Mozy.exe" "https://ninite.com/mozy/ninite.exe" +download-file "$path\Extras\Cloud Storage" "OneDrive.exe" "https://ninite.com/onedrive/ninite.exe" +download-file "$path\Extras\Cloud Storage" "SugarSync.exe" "https://ninite.com/sugarsync/ninite.exe" + +# Ninite - Communication +download-file "$path\Extras\Communication" "AIM.exe" "https://ninite.com/aim/ninite.exe" +download-file "$path\Extras\Communication" "Pidgin.exe" "https://ninite.com/pidgin/ninite.exe" +download-file "$path\Extras\Communication" "Skype.exe" "https://ninite.com/skype/ninite.exe" +download-file "$path\Extras\Communication" "Trillian.exe" "https://ninite.com/trillian/ninite.exe" + +# Ninite - Compression +download-file "$path\Extras\Compression" "7-Zip.exe" "https://ninite.com/7zip/ninite.exe" +download-file "$path\Extras\Compression" "PeaZip.exe" "https://ninite.com/peazip/ninite.exe" +download-file "$path\Extras\Compression" "WinRAR.exe" "https://ninite.com/winrar/ninite.exe" + +# Ninite - Developer +download-file "$path\Extras\Developer" "Eclipse.exe" "https://ninite.com/eclipse/ninite.exe" +download-file "$path\Extras\Developer" "FileZilla.exe" "https://ninite.com/filezilla/ninite.exe" +download-file "$path\Extras\Developer" "JDK 8.exe" "https://ninite.com/jdk8/ninite.exe" +download-file "$path\Extras\Developer" "JDK 8 (x64).exe" "https://ninite.com/jdkx8/ninite.exe" +download-file "$path\Extras\Developer" "Notepad++.exe" "https://ninite.com/notepadplusplus/ninite.exe" +download-file "$path\Extras\Developer" "PuTTY.exe" "https://ninite.com/putty/ninite.exe" +download-file "$path\Extras\Developer" "Python 2.exe" "https://ninite.com/python/ninite.exe" +download-file "$path\Extras\Developer" "Visual Studio Code.exe" "https://ninite.com/vscode/ninite.exe" +download-file "$path\Extras\Developer" "WinMerge.exe" "https://ninite.com/winmerge/ninite.exe" +download-file "$path\Extras\Developer" "WinSCP.exe" "https://ninite.com/winscp/ninite.exe" + +# Ninite - File Sharing +download-file "$path\Extras\File Sharing" "eMule.exe" "https://ninite.com/emule/ninite.exe" +download-file "$path\Extras\File Sharing" "qBittorrent.exe" "https://ninite.com/qbittorrent/ninite.exe" + +# Ninite - Image-Photo +download-file "$path\Extras\Image-Photo" "FastStone.exe" "https://ninite.com/faststone/ninite.exe" +download-file "$path\Extras\Image-Photo" "GIMP.exe" "https://ninite.com/gimp/ninite.exe" +download-file "$path\Extras\Image-Photo" "Greenshot.exe" "https://ninite.com/greenshot/ninite.exe" +download-file "$path\Extras\Image-Photo" "Inkscape.exe" "https://ninite.com/inkscape/ninite.exe" +download-file "$path\Extras\Image-Photo" "IrfanView.exe" "https://ninite.com/irfanview/ninite.exe" +download-file "$path\Extras\Image-Photo" "Paint.NET.exe" "https://ninite.com/paint.net/ninite.exe" +download-file "$path\Extras\Image-Photo" "ShareX.exe" "https://ninite.com/sharex/ninite.exe" +download-file "$path\Extras\Image-Photo" "XnView.exe" "https://ninite.com/xnview/ninite.exe" + +# Ninite - Misc +download-file "$path\Extras\Misc" "Classic Start.exe" "https://ninite.com/classicstart/ninite.exe" +download-file "$path\Extras\Misc" "Evernote.exe" "https://ninite.com/evernote/ninite.exe" +download-file "$path\Extras\Misc" "Everything.exe" "https://ninite.com/everything/ninite.exe" +download-file "$path\Extras\Misc" "Google Earth.exe" "https://ninite.com/googleearth/ninite.exe" +download-file "$path\Extras\Misc" "NV Access.exe" "https://ninite.com/nvda/ninite.exe" +download-file "$path\Extras\Misc" "Steam.exe" "https://ninite.com/steam/ninite.exe" + +# Ninite - Office +download-file "$path\Extras\Office" "CutePDF.exe" "https://ninite.com/cutepdf/ninite.exe" +download-file "$path\Extras\Office" "Foxit Reader.exe" "https://ninite.com/foxit/ninite.exe" +download-file "$path\Extras\Office" "LibreOffice.exe" "https://ninite.com/libreoffice/ninite.exe" +download-file "$path\Extras\Office" "OpenOffice.exe" "https://ninite.com/openoffice/ninite.exe" +download-file "$path\Extras\Office" "PDFCreator.exe" "https://ninite.com/pdfcreator/ninite.exe" +download-file "$path\Extras\Office" "SumatraPDF.exe" "https://ninite.com/sumatrapdf/ninite.exe" +download-file "$path\Extras\Office" "Thunderbird.exe" "https://ninite.com/thunderbird/ninite.exe" + +# Ninite - Runtimes +download-file "$path\Extras\Runtimes" "dotNET.exe" "https://ninite.com/.net4.6.2/ninite.exe" +download-file "$path\Extras\Runtimes" "Adobe Air.exe" "https://ninite.com/air/ninite.exe" +download-file "$path\Extras\Runtimes" "Java 8.exe" "https://ninite.com/java8/ninite.exe" +download-file "$path\Extras\Runtimes" "Shockwave.exe" "https://ninite.com/shockwave/ninite.exe" +download-file "$path\Extras\Runtimes" "Silverlight.exe" "https://ninite.com/silverlight/ninite.exe" + +# Ninite - Security +download-file "$path\Extras\Security" "Ad-Aware.exe" "https://ninite.com/adaware/ninite.exe" +download-file "$path\Extras\Security" "Avast.exe" "https://ninite.com/avast/ninite.exe" +download-file "$path\Extras\Security" "AVG.exe" "https://ninite.com/avg/ninite.exe" +download-file "$path\Extras\Security" "Avira.exe" "https://ninite.com/avira/ninite.exe" +download-file "$path\Extras\Security" "Microsoft Security Essentials.exe" "https://ninite.com/essentials/ninite.exe" +download-file "$path\Extras\Security" "Malwarebytes Anti-Malware.exe" "https://ninite.com/malwarebytes/ninite.exe" +download-file "$path\Extras\Security" "Spybot 2.exe" "https://ninite.com/spybot2/ninite.exe" +download-file "$path\Extras\Security" "SUPERAntiSpyware.exe" "https://ninite.com/super/ninite.exe" + +# Ninite - Utilities +download-file "$path\Extras\Utilities" "Auslogics DiskDefrag.exe" "https://ninite.com/auslogics/ninite.exe" +download-file "$path\Extras\Utilities" "CDBurnerXP.exe" "https://ninite.com/cdburnerxp/ninite.exe" +download-file "$path\Extras\Utilities" "Glary Utilities.exe" "https://ninite.com/glary/ninite.exe" +download-file "$path\Extras\Utilities" "ImgBurn.exe" "https://ninite.com/imgburn/ninite.exe" +download-file "$path\Extras\Utilities" "InfraRecorder.exe" "https://ninite.com/infrarecorder/ninite.exe" +download-file "$path\Extras\Utilities" "KeePass 2.exe" "https://ninite.com/keepass2/ninite.exe" +download-file "$path\Extras\Utilities" "Launchy.exe" "https://ninite.com/launchy/ninite.exe" +download-file "$path\Extras\Utilities" "RealVNC.exe" "https://ninite.com/realvnc/ninite.exe" +download-file "$path\Extras\Utilities" "Revo Uninstaller.exe" "https://ninite.com/revo/ninite.exe" +download-file "$path\Extras\Utilities" "TeamViewer 11.exe" "https://ninite.com/teamviewer11/ninite.exe" +download-file "$path\Extras\Utilities" "TeraCopy.exe" "https://ninite.com/teracopy/ninite.exe" +download-file "$path\Extras\Utilities" "WinDirStat.exe" "https://ninite.com/windirstat/ninite.exe" + +# Ninite - Web Browsers +download-file "$path\Extras\Web Browsers" "Google Chrome.exe" "https://ninite.com/chrome/ninite.exe" +download-file "$path\Extras\Web Browsers" "Firefox.exe" "https://ninite.com/firefox/ninite.exe" +download-file "$path\Extras\Web Browsers" "Opera.exe" "https://ninite.com/operaChromium/ninite.exe" + +## Done ## +popd +pause "Press Enter to exit..." diff --git a/.bin/Scripts/update_kit.py b/.bin/Scripts/update_kit.py new file mode 100644 index 00000000..3d99ee51 --- /dev/null +++ b/.bin/Scripts/update_kit.py @@ -0,0 +1,453 @@ +# Wizard Kit: Download the latest versions of the programs in the kit + +import os +import re + +# Init +os.chdir(os.path.dirname(os.path.realpath(__file__))) +os.system('title Wizard Kit: Kit Update Tool') +from functions import * +vars = init_vars() +vars_os = init_vars_os() +curl = '{BinDir}/curl/curl.exe'.format(**vars) +seven_zip = '{BinDir}/7-Zip/7za.exe'.format(**vars) +if vars_os['Arch'] == 64: + seven_zip = seven_zip.replace('7za', '7za64') + +def download_file(out_dir, out_name, source_url): + """Downloads a file using curl.""" + print('Downloading: {out_name}'.format(out_name=out_name)) + _args = [ + '-#LSfo', + '{out_dir}/{out_name}'.format(out_dir=out_dir, out_name=out_name), + source_url + ] + try: + os.makedirs(out_dir, exist_ok=True) + run_program(curl, _args, pipe=False) + except: + print_error('Falied to download file.') + +def resolve_dynamic_url(source_url, regex): + """Download the "download page" and scan for a url using the regex provided; returns str.""" + # Download the file + _tmp_file = '{TmpDir}/webpage.tmp'.format(**vars) + _args = ['-#LSfo', _tmp_file, source_url] + try: +<<<<<<< HEAD + run_program(cmd) + except subprocess.CalledProcessError: + errors = True + print_error('Failed to apply Windows image.') + + # Create boot files + if not errors: + print(' Creating boot files...'.format(**selected_windows_version)) + try: + run_program('bcdboot W:\\Windows /s S: /f ALL') + except subprocess.CalledProcessError: + errors = True + print_error('Failed to create boot files.') + if re.search(r'^(8|10)', selected_windows_version['Family']): + try: + run_program('W:\\Windows\\System32\\reagentc /setreimage /path T:\\Recovery\\WindowsRE /target W:\\Windows') + except subprocess.CalledProcessError: + # errors = True # Changed to warning. + print_warning('Failed to setup WindowsRE files.') + + # Print summary + if errors: + print_warning('\nErrors were encountered during setup.') + time.sleep(300) + else: + print_success('\nNo errors were encountered during setup.') + time.sleep(10) + pause('\nPress Enter to return to main menu... ') + +def menu_tools(): + tools = [ + {'Name': 'Blue Screen View', 'Folder': 'BlueScreenView', 'File': 'BlueScreenView.exe'}, + {'Name': 'CPU-Z', 'Folder': 'CPU-Z', 'File': 'cpuz.exe'}, + {'Name': 'Explorer++', 'Folder': 'Explorer++', 'File': 'Explorer++.exe'}, + {'Name': 'Fast Copy', 'Folder': 'FastCopy', 'File': 'FastCopy.exe', 'Args': ['/log', '/logfile=X:\WK\Info\FastCopy.log', '/cmd=noexist_only', '/utf8', '/skip_empty_dir', '/linkdest', '/open_window', '/balloon=FALSE', r'/exclude=$RECYCLE.BIN;$Recycle.Bin;.AppleDB;.AppleDesktop;.AppleDouble;.com.apple.timemachine.supported;.dbfseventsd;.DocumentRevisions-V100*;.DS_Store;.fseventsd;.PKInstallSandboxManager;.Spotlight*;.SymAV*;.symSchedScanLockxz;.TemporaryItems;.Trash*;.vol;.VolumeIcon.icns;desktop.ini;Desktop?DB;Desktop?DF;hiberfil.sys;lost+found;Network?Trash?Folder;pagefile.sys;Recycled;RECYCLER;System?Volume?Information;Temporary?Items;Thumbs.db']}, + {'Name': 'HWiNFO', 'Folder': 'HWiNFO', 'File': 'HWiNFO.exe'}, + {'Name': 'HW Monitor', 'Folder': 'HWMonitor', 'File': 'HWMonitor.exe'}, + {'Name': 'NT Password Editor', 'Folder': 'NT Password Editor', 'File': 'ntpwedit.exe'}, + {'Name': 'Notepad2', 'Folder': 'Notepad2', 'File': 'Notepad2-Mod.exe'}, + {'Name': 'PhotoRec', 'Folder': 'TestDisk', 'File': 'photorec_win.exe', 'Args': ['-new_console:n']}, + {'Name': 'Prime95', 'Folder': 'Prime95', 'File': 'prime95.exe'}, + {'Name': 'ProduKey', 'Folder': 'ProduKey', 'File': 'ProduKey.exe', 'Args': ['/external', '/ExtractEdition:1']}, + {'Name': 'Q-Dir', 'Folder': 'Q-Dir', 'File': 'Q-Dir.exe'}, + {'Name': 'TestDisk', 'Folder': 'TestDisk', 'File': 'testdisk_win.exe', 'Args': ['-new_console:n']}, + ] + actions = [ + {'Name': 'Main Menu', 'Letter': 'M'}, + ] + + # Menu loop + while True: + selection = menu_select('Tools Menu', tools, actions) + + if (selection.isnumeric()): + tool = tools[int(selection)-1] + cmd = ['{bin}\\{folder}\\{file}'.format(bin=bin, folder=tool['Folder'], file=tool['File'])] + if tool['Name'] == 'Blue Screen View': + # Select path to scan + minidump_path = select_minidump_path() + if minidump_path is not None: + tool['Args'] = ['/MiniDumpFolder', minidump_path] + if 'Args' in tool: + cmd += tool['Args'] + try: + subprocess.Popen(cmd) + except: + print_error('Failed to run {prog}'.format(prog=tool['Name'])) + time.sleep(2) + elif (selection == 'M'): + break + +def menu_main(): + menus = [ + {'Name': 'Create Backups', 'Menu': menu_backup_imaging}, + {'Name': 'Install Windows', 'Menu': menu_windows_setup}, + {'Name': 'Misc Tools', 'Menu': menu_tools}, + ] + actions = [ + {'Name': 'Command Prompt', 'Letter': 'C'}, + {'Name': 'Reboot', 'Letter': 'R'}, + {'Name': 'Shutdown', 'Letter': 'S'}, + ] + + # Main loop + while True: + selection = menu_select('Main Menu', menus, actions, secret_exit=True) + + if (selection.isnumeric()): + try: + menus[int(selection)-1]['Menu']() + except AbortException: + pass + except: + print_error('Major exception in: {menu}'.format(menu=menus[int(selection)-1]['Name'])) + print_warning(' Please let The Wizard know and he\'ll look into it (Please include the details below).') + print(traceback.print_exc()) + print_info(' You can reboot and try again but if this crashes again an alternative approach is required.') + time.sleep(300) + pause('Press Enter to shutdown...') + run_program(['wpeutil', 'shutdown']) + elif (selection == 'C'): + run_program(['cmd', '-new_console:n'], check=False) + elif (selection == 'R'): + run_program(['wpeutil', 'reboot']) + elif (selection == 'S'): + run_program(['wpeutil', 'shutdown']) + else: + quit() +======= + os.makedirs(vars['TmpDir'], exist_ok=True) + run_program(curl, _args) + except: + print_error('Falied to resolve dynamic url') + + # Scan the file for the regex + with open(_tmp_file, 'r') as file: + for line in file: + if re.search(regex, line): + _url = line.strip() + _url = re.sub(r'.*(a |)href="([^"]+)".*', r'\2', _url) + _url = re.sub(r".*(a |)href='([^']+)'.*", r'\2', _url) + break + + # Cleanup and return + os.remove(_tmp_file) + return _url +>>>>>>> d9a6f8abf55c460cf0adeea19aded1786b3bc5d0 + +if __name__ == '__main__': + ## Diagnostics ## + # HitmanPro + _path = '{BinDir}/HitmanPro'.format(**vars) + _name = 'HitmanPro.exe' + _url = 'http://dl.surfright.nl/HitmanPro.exe' + download_file(_path, _name, _url) + _name = 'HitmanPro64.exe' + _url = 'http://dl.surfright.nl/HitmanPro_x64.exe' + download_file(_path, _name, _url) + + ## VR-OSR ## + # AdwCleaner + _path = vars['BinDir'] + _name = 'AdwCleaner.exe' + _dl_page = 'http://www.bleepingcomputer.com/download/adwcleaner/dl/125/' + _regex = r'href=.*http(s|)://download\.bleepingcomputer\.com/dl/[a-zA-Z0-9]+/[a-zA-Z0-9]+/windows/security/security-utilities/a/adwcleaner/AdwCleaner\.exe' + _url = resolve_dynamic_url(_dl_page, _regex) + download_file(_path, _name, _url) + + # ESET Online Scanner + _path = vars['BinDir'] + _name = 'ESET.exe' + _url = 'http://download.eset.com/special/eos/esetsmartinstaller_enu.exe' + download_file(_path, _name, _url) + + # Junkware Removal Tool + _path = vars['BinDir'] + _name = 'JRT.exe' + _url = 'http://downloads.malwarebytes.org/file/jrt' + download_file(_path, _name, _url) + + # Kaspersky Virus Removal Tool + _path = vars['BinDir'] + _name = 'KVRT.exe' + _url = 'http://devbuilds.kaspersky-labs.com/devbuilds/KVRT/latest/full/KVRT.exe' + download_file(_path, _name, _url) + + # RKill + _path = '{BinDir}/RKill'.format(**vars) + _name = 'RKill.exe' + _dl_page = 'http://www.bleepingcomputer.com/download/rkill/dl/10/' + _regex = r'href=.*http(s|)://download\.bleepingcomputer\.com/dl/[a-zA-Z0-9]+/[a-zA-Z0-9]+/windows/security/security-utilities/r/rkill/rkill\.exe' + _url = resolve_dynamic_url(_dl_page, _regex) + download_file(_path, _name, _url) + + # TDSSKiller + _path = vars['BinDir'] + _name = 'TDSSKiller.exe' + _url = 'http://media.kaspersky.com/utilities/VirusUtilities/EN/tdsskiller.exe' + download_file(_path, _name, _url) + + ## Driver Tools ## + # Acer Serial Number Detect Tool + _path = '{BinDir}/_Drivers'.format(**vars) + _name = 'Acer Serial Number Detect Tool.exe' + _url = 'http://global-download.acer.com/SupportFiles/Files/SNID/APP/SerialNumberDetectionTool.exe' + download_file(_path, _name, _url) + + # AMD Autodetect + _path = '{BinDir}/_Drivers'.format(**vars) + _name = 'AMD Autodetect.exe' + _url = 'http://www2.ati.com/drivers/auto/autodetectutility.exe' + download_file(_path, _name, _url) + + # AMD Gaming Evolved + _path = '{BinDir}/_Drivers'.format(**vars) + _name = 'AMD Gaming Evolved.exe' + _url = 'http://clientupdater.raptr.com/client/pc/amd/raptr_installer.exe' + download_file(_path, _name, _url) + + # Dell System Detect + _path = '{BinDir}/_Drivers'.format(**vars) + _name = 'Dell System Detect.exe' + _url = 'https://downloads.dell.com/tools/dellsystemdetect/dellsystemdetectlauncher.exe' + download_file(_path, _name, _url) + + #~Broken~# # GeForce Experience + #~Broken~# _path = '{BinDir}/_Drivers'.format(**vars) + #~Broken~# _name = 'GeForce Experience.exe' + #~Broken~# _dl_page = 'http://www.geforce.com/geforce-experience/download' + #~Broken~# _regex = r'href=.*http(s|)://us\.download\.nvidia\.com/GFE/GFEClient/[0-9\.]+/GeForce_Experience_v[0-9\.]+\.exe' + #~Broken~# _url = resolve_dynamic_url(_dl_page, _regex) + #~Broken~# download_file(_path, _name, _url) + + # HP Support Solutions Framework + _path = '{BinDir}/_Drivers'.format(**vars) + _name = 'HP Support Solutions Framework.exe' + _url = 'http://h20614.www2.hp.com/ediags/filehosting/api/installer' + download_file(_path, _name, _url) + + # Intel Driver Update Utility + _path = '{BinDir}/_Drivers'.format(**vars) + _name = 'Intel Driver Update Utility.exe' + _dl_page = 'http://www.intel.com/content/www/us/en/support/detect.html' + _regex = r'a href.*http(s|)://downloadmirror\.intel\.com/[a-zA-Z0-9]+/[a-zA-Z0-9]+/Intel%20Driver%20Update%20Utility%20Installer.exe' + _url = resolve_dynamic_url(_dl_page, _regex) + _url = resolve_dynamic_url(_dl_page, _regex) + download_file(_path, _name, _url) + + # Intel SSD Toolbox + _path = '{BinDir}/_Drivers'.format(**vars) + _name = 'Intel SSD Toolbox.exe' + _dl_page = 'https://downloadcenter.intel.com/download/26085/Intel-Solid-State-Drive-Toolbox' + _regex = r'href=./downloads/eula/[0-9]+/Intel-Solid-State-Drive-Toolbox.httpDown=https\%3A\%2F\%2Fdownloadmirror\.intel\.com\%2F[0-9]+\%2Feng\%2FIntel\%20SSD\%20Toolbox\%20-\%20v[0-9\.]+.exe' + _url = resolve_dynamic_url(_dl_page, _regex) + _url = re.sub(r'.*httpDown=(.*)', r'\1', _url, flags=re.IGNORECASE) + _url = _url.replace('%3A', ':') + _url = _url.replace('%2F', '/') + download_file(_path, _name, _url) + + # Lenovo Service Bridge + _path = '{BinDir}/_Drivers'.format(**vars) + _name = 'Lenovo Service Bridge.exe' + _url = 'https://download.lenovo.com/lsb/LSBsetup.exe' + download_file(_path, _name, _url) + + #~Broken~# # Samsung Magician + print_warning('Samsung Magician section is broken.') + print('Please manually put "Samsung Magician.exe" into "{BinDir}\\_Drivers\\"') + #~Broken~# _path = '{BinDir}/_Drivers'.format(**vars) + #~Broken~# _name = 'Samsung Magician.zip' + #~Broken~# _dl_page = 'http://www.samsung.com/semiconductor/minisite/ssd/download/tools.html' + #~Broken~# _regex = r'href=./semiconductor/minisite/ssd/downloads/software/Samsung_Magician_Setup_v[0-9]+.zip' + #~Broken~# _url = resolve_dynamic_url(_dl_page, _regex) + #~Broken~# # Convert relative url to absolute + #~Broken~# _url = 'http://www.samsung.com' + _url + #~Broken~# download_file(_path, _name, _url) + #~Broken~# # Extract and replace old copy + #~Broken~# _args = [ + #~Broken~# 'e', '"{BinDir}/_Drivers/Samsung Magician.zip"'.format(**vars), + #~Broken~# '-aoa', '-bso0', '-bsp0', + #~Broken~# '-o"{BinDir}/_Drivers"'.format(**vars) + #~Broken~# ] + #~Broken~# run_program(seven_zip, _args) + #~Broken~# try: + #~Broken~# os.remove('{BinDir}/_Drivers/Samsung Magician.zip'.format(**vars)) + #~Broken~# #~PoSH~# Move-Item "$bin\_Drivers\Samsung*exe" "$bin\_Drivers\Samsung Magician.exe" $path 2>&1 | Out-Null + #~Broken~# except: + #~Broken~# pass + + # SanDisk Express Cache + _path = '{BinDir}/_Drivers'.format(**vars) + _name = 'SanDisk Express Cache.exe' + _url = 'http://mp3support.sandisk.com/ReadyCache/ExpressCacheSetup.exe' + download_file(_path, _name, _url) + + # Toshiba System Detect + _path = '{BinDir}/_Drivers'.format(**vars) + _name = 'Toshiba System Detect.exe' + _url = 'http://cdgenp01.csd.toshiba.com/content/support/downloads/GetProductInfo.exe' + download_file(_path, _name, _url) + + ## Installers ## + # Ninite - Bundles + _path = '{BaseDir}/Installers/Extras/Bundles'.format(**vars) + download_file(_path, 'Runtimes.exe', 'https://ninite.com/.net4.6.2-air-java8-silverlight/ninite.exe') + download_file(_path, 'Legacy.exe', 'https://ninite.com/.net4.6.2-7zip-air-chrome-firefox-java8-silverlight-vlc/ninite.exe') + download_file(_path, 'Modern.exe', 'https://ninite.com/.net4.6.2-7zip-air-chrome-classicstart-firefox-java8-silverlight-vlc/ninite.exe') + + # Ninite - Audio-Video + _path = '{BaseDir}/Installers/Extras/Audio-Video'.format(**vars) + download_file(_path, 'AIMP.exe', 'https://ninite.com/aimp/ninite.exe') + download_file(_path, 'Audacity.exe', 'https://ninite.com/audacity/ninite.exe') + download_file(_path, 'CCCP.exe', 'https://ninite.com/cccp/ninite.exe') + download_file(_path, 'Foobar2000.exe', 'https://ninite.com/foobar/ninite.exe') + download_file(_path, 'GOM.exe', 'https://ninite.com/gom/ninite.exe') + download_file(_path, 'iTunes.exe', 'https://ninite.com/itunes/ninite.exe') + download_file(_path, 'K-Lite Codecs.exe', 'https://ninite.com/klitecodecs/ninite.exe') + download_file(_path, 'KMPlayer.exe', 'https://ninite.com/kmplayer/ninite.exe') + download_file(_path, 'MediaMonkey.exe', 'https://ninite.com/mediamonkey/ninite.exe') + download_file(_path, 'MusicBee.exe', 'https://ninite.com/musicbee/ninite.exe') + download_file(_path, 'Spotify.exe', 'https://ninite.com/spotify/ninite.exe') + download_file(_path, 'VLC.exe', 'https://ninite.com/vlc/ninite.exe') + download_file(_path, 'Winamp.exe', 'https://ninite.com/winamp/ninite.exe') + + # Ninite - Cloud Storage + _path = '{BaseDir}/Installers/Extras/Cloud Storage'.format(**vars) + download_file(_path, 'BitTorrent Sync.exe', 'https://ninite.com/bittorrentsync/ninite.exe') + download_file(_path, 'Dropbox.exe', 'https://ninite.com/dropbox/ninite.exe') + download_file(_path, 'Google Drive.exe', 'https://ninite.com/googledrive/ninite.exe') + download_file(_path, 'Mozy.exe', 'https://ninite.com/mozy/ninite.exe') + download_file(_path, 'OneDrive.exe', 'https://ninite.com/onedrive/ninite.exe') + download_file(_path, 'SugarSync.exe', 'https://ninite.com/sugarsync/ninite.exe') + + # Ninite - Communication + _path = '{BaseDir}/Installers/Extras/Communication'.format(**vars) + download_file(_path, 'AIM.exe', 'https://ninite.com/aim/ninite.exe') + download_file(_path, 'Pidgin.exe', 'https://ninite.com/pidgin/ninite.exe') + download_file(_path, 'Skype.exe', 'https://ninite.com/skype/ninite.exe') + download_file(_path, 'Trillian.exe', 'https://ninite.com/trillian/ninite.exe') + + # Ninite - Compression + _path = '{BaseDir}/Installers/Extras/Compression'.format(**vars) + download_file(_path, '7-Zip.exe', 'https://ninite.com/7zip/ninite.exe') + download_file(_path, 'PeaZip.exe', 'https://ninite.com/peazip/ninite.exe') + download_file(_path, 'WinRAR.exe', 'https://ninite.com/winrar/ninite.exe') + + # Ninite - Developer + _path = '{BaseDir}/Installers/Extras/Developer'.format(**vars) + download_file(_path, 'Eclipse.exe', 'https://ninite.com/eclipse/ninite.exe') + download_file(_path, 'FileZilla.exe', 'https://ninite.com/filezilla/ninite.exe') + download_file(_path, 'JDK 8.exe', 'https://ninite.com/jdk8/ninite.exe') + download_file(_path, 'JDK 8 (x64).exe', 'https://ninite.com/jdkx8/ninite.exe') + download_file(_path, 'Notepad++.exe', 'https://ninite.com/notepadplusplus/ninite.exe') + download_file(_path, 'PuTTY.exe', 'https://ninite.com/putty/ninite.exe') + download_file(_path, 'Python 2.exe', 'https://ninite.com/python/ninite.exe') + download_file(_path, 'Visual Studio Code.exe', 'https://ninite.com/vscode/ninite.exe') + download_file(_path, 'WinMerge.exe', 'https://ninite.com/winmerge/ninite.exe') + download_file(_path, 'WinSCP.exe', 'https://ninite.com/winscp/ninite.exe') + + # Ninite - File Sharing + _path = '{BaseDir}/Installers/Extras/File Sharing'.format(**vars) + download_file(_path, 'eMule.exe', 'https://ninite.com/emule/ninite.exe') + download_file(_path, 'qBittorrent.exe', 'https://ninite.com/qbittorrent/ninite.exe') + + # Ninite - Image-Photo + _path = '{BaseDir}/Installers/Extras/Image-Photo'.format(**vars) + download_file(_path, 'FastStone.exe', 'https://ninite.com/faststone/ninite.exe') + download_file(_path, 'GIMP.exe', 'https://ninite.com/gimp/ninite.exe') + download_file(_path, 'Greenshot.exe', 'https://ninite.com/greenshot/ninite.exe') + download_file(_path, 'Inkscape.exe', 'https://ninite.com/inkscape/ninite.exe') + download_file(_path, 'IrfanView.exe', 'https://ninite.com/irfanview/ninite.exe') + download_file(_path, 'Paint.NET.exe', 'https://ninite.com/paint.net/ninite.exe') + download_file(_path, 'ShareX.exe', 'https://ninite.com/sharex/ninite.exe') + download_file(_path, 'XnView.exe', 'https://ninite.com/xnview/ninite.exe') + + # Ninite - Misc + _path = '{BaseDir}/Installers/Extras/Misc'.format(**vars) + download_file(_path, 'Classic Start.exe', 'https://ninite.com/classicstart/ninite.exe') + download_file(_path, 'Evernote.exe', 'https://ninite.com/evernote/ninite.exe') + download_file(_path, 'Everything.exe', 'https://ninite.com/everything/ninite.exe') + download_file(_path, 'Google Earth.exe', 'https://ninite.com/googleearth/ninite.exe') + download_file(_path, 'NV Access.exe', 'https://ninite.com/nvda/ninite.exe') + download_file(_path, 'Steam.exe', 'https://ninite.com/steam/ninite.exe') + + # Ninite - Office + _path = '{BaseDir}/Installers/Extras/Office'.format(**vars) + download_file(_path, 'CutePDF.exe', 'https://ninite.com/cutepdf/ninite.exe') + download_file(_path, 'Foxit Reader.exe', 'https://ninite.com/foxit/ninite.exe') + download_file(_path, 'LibreOffice.exe', 'https://ninite.com/libreoffice/ninite.exe') + download_file(_path, 'OpenOffice.exe', 'https://ninite.com/openoffice/ninite.exe') + download_file(_path, 'PDFCreator.exe', 'https://ninite.com/pdfcreator/ninite.exe') + download_file(_path, 'SumatraPDF.exe', 'https://ninite.com/sumatrapdf/ninite.exe') + download_file(_path, 'Thunderbird.exe', 'https://ninite.com/thunderbird/ninite.exe') + + # Ninite - Runtimes + _path = '{BaseDir}/Installers/Extras/Runtimes'.format(**vars) + download_file(_path, 'Adobe Air.exe', 'https://ninite.com/air/ninite.exe') + download_file(_path, 'dotNET.exe', 'https://ninite.com/.net4.6.2/ninite.exe') + download_file(_path, 'Java 8.exe', 'https://ninite.com/java8/ninite.exe') + download_file(_path, 'Shockwave.exe', 'https://ninite.com/shockwave/ninite.exe') + download_file(_path, 'Silverlight.exe', 'https://ninite.com/silverlight/ninite.exe') + + # Ninite - Security + _path = '{BaseDir}/Installers/Extras/Security'.format(**vars) + download_file(_path, 'Ad-Aware.exe', 'https://ninite.com/adaware/ninite.exe') + download_file(_path, 'Avast.exe', 'https://ninite.com/avast/ninite.exe') + download_file(_path, 'AVG.exe', 'https://ninite.com/avg/ninite.exe') + download_file(_path, 'Avira.exe', 'https://ninite.com/avira/ninite.exe') + download_file(_path, 'Microsoft Security Essentials.exe', 'https://ninite.com/essentials/ninite.exe') + download_file(_path, 'Malwarebytes Anti-Malware.exe', 'https://ninite.com/malwarebytes/ninite.exe') + download_file(_path, 'Spybot 2.exe', 'https://ninite.com/spybot2/ninite.exe') + download_file(_path, 'SUPERAntiSpyware.exe', 'https://ninite.com/super/ninite.exe') + + # Ninite - Utilities + _path = '{BaseDir}/Installers/Extras/Utilities'.format(**vars) + download_file(_path, 'Auslogics DiskDefrag.exe', 'https://ninite.com/auslogics/ninite.exe') + download_file(_path, 'CDBurnerXP.exe', 'https://ninite.com/cdburnerxp/ninite.exe') + download_file(_path, 'Glary Utilities.exe', 'https://ninite.com/glary/ninite.exe') + download_file(_path, 'ImgBurn.exe', 'https://ninite.com/imgburn/ninite.exe') + download_file(_path, 'InfraRecorder.exe', 'https://ninite.com/infrarecorder/ninite.exe') + download_file(_path, 'KeePass 2.exe', 'https://ninite.com/keepass2/ninite.exe') + download_file(_path, 'Launchy.exe', 'https://ninite.com/launchy/ninite.exe') + download_file(_path, 'RealVNC.exe', 'https://ninite.com/realvnc/ninite.exe') + download_file(_path, 'Revo Uninstaller.exe', 'https://ninite.com/revo/ninite.exe') + download_file(_path, 'TeamViewer 11.exe', 'https://ninite.com/teamviewer11/ninite.exe') + download_file(_path, 'TeraCopy.exe', 'https://ninite.com/teracopy/ninite.exe') + download_file(_path, 'WinDirStat.exe', 'https://ninite.com/windirstat/ninite.exe') + + # Ninite - Web Browsers + _path = '{BaseDir}/Installers/Extras/Web Browsers'.format(**vars) + download_file(_path, 'Google Chrome.exe', 'https://ninite.com/chrome/ninite.exe') + download_file(_path, 'Mozilla Firefox.exe', 'https://ninite.com/firefox/ninite.exe') + download_file(_path, 'Opera Chromium.exe', 'https://ninite.com/operaChromium/ninite.exe') + + pause("Press Enter to exit...") + quit() diff --git a/.bin/Scripts/update_tools.ps1 b/.bin/Scripts/update_tools.ps1 deleted file mode 100644 index f14b162e..00000000 --- a/.bin/Scripts/update_tools.ps1 +++ /dev/null @@ -1,188 +0,0 @@ -# Wizard-Kit-Updater - -## Init ## -$wd = $(Split-Path $MyInvocation.MyCommand.Path) -pushd "$wd" -. .\init.ps1 -clear -$host.UI.RawUI.WindowTitle = "Wizard Kit Update Tool" -$bin = (Get-Item $wd).Parent.FullName -$curl = "$bin\curl\curl.exe" -$sz = "$bin\7-Zip\7za.exe" - -# OS Check -. .\os_check.ps1 -if ($arch -eq 64) { - $sz = "$bin\7-Zip\7za64.exe" -} - -## Functions ## -function download-file { - param ([String]$path, [String]$name, [String]$url) - $output = "{0}\{1}" -f $path, $name - - write-host ("Downloading {0}" -f $name) - New-Item -Type Directory $path 2>&1 | Out-Null - start "$curl" -argumentlist @("-#LSfo", "`"$output`"", "`"$url`"") -nonewwindow -wait -} -function find-dynamic-url { - param ([String]$source_page, [String]$regex) - $d_url = "" - - # Get source page - start "$curl" -argumentlist @("-Lfso", "tmp_page", "`"$source_page`"") -nonewwindow -wait - - # Search for real url - $d_url = Get-Content "tmp_page" | Where-Object {$_ -imatch $regex} - $d_url = $d_url -ireplace '.*(a |)href="([^"]+)".*', '$2' - $d_url = $d_url -ireplace ".*(a |)href='([^']+)'.*", '$2' - - # Remove tmp_page - Remove-Item "tmp_page" - - return $d_url -} - -## Diagnostics ## -# HitmanPro -$path = "$bin\HitmanPro" -$name = "HitmanPro.exe" -$url = "http://dl.surfright.nl/HitmanPro.exe" -download-file $path $name $url -$name = "HitmanPro64.exe" -$url = "http://dl.surfright.nl/HitmanPro_x64.exe" -download-file $path $name $url - -## VR-OSR ## -# AdwCleaner -$path = "$bin" -$name = "AdwCleaner.exe" -$dl_page = "http://www.bleepingcomputer.com/download/adwcleaner/dl/125/" -$regex = "href=.*http(s|)://download\.bleepingcomputer\.com/dl/[a-zA-Z0-9]+/[a-zA-Z0-9]+/windows/security/security-utilities/a/adwcleaner/AdwCleaner\.exe" -$url = find-dynamic-url $dl_page $regex -download-file $path $name $url - -# ESET Online Scanner -$path = "$bin" -$name = "ESET.exe" -$url = "http://download.eset.com/special/eos/esetsmartinstaller_enu.exe" -download-file $path $name $url - -# Junkware Removal Tool -$path = "$bin" -$name = "JRT.exe" -$url = "http://downloads.malwarebytes.org/file/jrt" -download-file $path $name $url - -# Kaspersky Virus Removal Tool -$path = "$bin" -$name = "KVRT.exe" -$url = "http://devbuilds.kaspersky-labs.com/devbuilds/KVRT/latest/full/KVRT.exe" -download-file $path $name $url - -# RKill -$path = "$bin\RKill" -$name = "RKill.exe" -$dl_page = "http://www.bleepingcomputer.com/download/rkill/dl/10/" -$regex = "href=.*http(s|)://download\.bleepingcomputer\.com/dl/[a-zA-Z0-9]+/[a-zA-Z0-9]+/windows/security/security-utilities/r/rkill/rkill\.exe" -$url = find-dynamic-url $dl_page $regex -download-file $path $name $url - -# TDSSKiller -$path = "$bin" -$name = "TDSSKiller.exe" -$url = "http://media.kaspersky.com/utilities/VirusUtilities/EN/tdsskiller.exe" -download-file $path $name $url - -## Driver Tools ## -# Acer Serial Number Detect Tool -$path = "$bin\_Drivers" -$name = "Acer Serial Number Detect Tool.exe" -$url = "http://global-download.acer.com/SupportFiles/Files/SNID/APP/SerialNumberDetectionTool.exe" -download-file $path $name $url - -# AMD Autodetect -$path = "$bin\_Drivers" -$name = "AMD Autodetect.exe" -$url = "http://www2.ati.com/drivers/auto/autodetectutility.exe" -download-file $path $name $url - -# AMD Gaming Evolved -$path = "$bin\_Drivers" -$name = "AMD Gaming Evolved.exe" -$url = "http://clientupdater.raptr.com/client/pc/amd/raptr_installer.exe" -download-file $path $name $url - -# Dell System Detect -$path = "$bin\_Drivers" -$name = "Dell System Detect.exe" -$url = "https://downloads.dell.com/tools/dellsystemdetect/dellsystemdetectlauncher.exe" -download-file $path $name $url - -# GeForce Experience -$path = "$bin\_Drivers" -$name = "GeForce Experience.exe" -$dl_page = "http://www.geforce.com/geforce-experience/download" -$regex = "href=.*http(s|)://us\.download\.nvidia\.com/GFE/GFEClient/[0-9\.]+/GeForce_Experience_v[0-9\.]+\.exe" -$url = find-dynamic-url $dl_page $regex -download-file $path $name $url - -# HP Support Solutions Framework -$path = "$bin\_Drivers" -$name = "HP Support Solutions Framework.exe" -$url = "http://h20614.www2.hp.com/ediags/filehosting/api/installer" -download-file $path $name $url - -# Intel Driver Update Utility -$path = "$bin\_Drivers" -$name = "Intel Driver Update Utility.exe" -$dl_page = "http://www.intel.com/content/www/us/en/support/detect.html" -$regex = "a href.*http(s|)://downloadmirror\.intel\.com/[a-zA-Z0-9]+/[a-zA-Z0-9]+/Intel%20Driver%20Update%20Utility%20Installer.exe" -$url = find-dynamic-url $dl_page $regex -$url = find-dynamic-url $dl_page $regex -download-file $path $name $url - -# Intel SSD Toolbox -$path = "$bin\_Drivers" -$name = "Intel SSD Toolbox.exe" -$dl_page = "https://downloadcenter.intel.com/download/26085/Intel-Solid-State-Drive-Toolbox" -$regex = "href=./downloads/eula/[0-9]+/Intel-Solid-State-Drive-Toolbox.httpDown=https\%3A\%2F\%2Fdownloadmirror\.intel\.com\%2F[0-9]+\%2Feng\%2FIntel\%20SSD\%20Toolbox\%20-\%20v[0-9\.]+.exe" -$url = find-dynamic-url $dl_page $regex -$url = $url -ireplace '.*httpDown=(.*)', '$1' -$url = $url -ireplace '%3A', ':' -$url = $url -ireplace '%2F', '/' -download-file $path $name $url - -# Lenovo Service Bridge -$path = "$bin\_Drivers" -$name = "Lenovo Service Bridge.exe" -$url = "https://download.lenovo.com/lsb/LSBsetup.exe" -download-file $path $name $url - -# Samsung Magician -$path = "$bin\_Drivers" -$name = "Samsung Magician.zip" -$dl_page = "http://www.samsung.com/semiconductor/minisite/ssd/download/tools.html" -$regex = "href=./semiconductor/minisite/ssd/downloads/software/Samsung_Magician_Setup_v[0-9]+.zip" -$url = "http://www.samsung.com{0}" -f (find-dynamic-url $dl_page $regex) -download-file $path $name $url -start $sz -argumentlist @("e", "`"$bin\_Drivers\Samsung Magician.zip`"", "-aoa", "-bso0", "-bsp0", "-o$bin\_Drivers") -nonewwindow -wait -Remove-Item "$bin\_Drivers\Samsung Magician.exe" $path 2>&1 | Out-Null -Remove-Item "$bin\_Drivers\Samsung Magician.zip" $path 2>&1 | Out-Null -Move-Item "$bin\_Drivers\Samsung*exe" "$bin\_Drivers\Samsung Magician.exe" $path 2>&1 | Out-Null - -# SanDisk Express Cache -$path = "$bin\_Drivers" -$name = "SanDisk Express Cache.exe" -$url = "http://mp3support.sandisk.com/ReadyCache/ExpressCacheSetup.exe" -download-file $path $name $url - -# Toshiba System Detect -$path = "$bin\_Drivers" -$name = "Toshiba System Detect.exe" -$url = "http://cdgenp01.csd.toshiba.com/content/support/downloads/GetProductInfo.exe" -download-file $path $name $url - -## Done ## -popd -pause "Press Enter to exit..." diff --git a/.bin/Scripts/user_data.ps1 b/.bin/Scripts/user_data.ps1 index 7b8663cf..14902981 100644 --- a/.bin/Scripts/user_data.ps1 +++ b/.bin/Scripts/user_data.ps1 @@ -1,3 +1,5 @@ +# Wizard Kit: List the data usage for the current user (and other users when possible) + param([string]$log) cd $(Split-Path $MyInvocation.MyCommand.Path) @@ -32,17 +34,17 @@ function print-dir-size ($name, $location) { $total = "{0:N0}" -f $bytes $s = " {0} {1} Bytes ({2})" -f $name.PadRight(10), $total.PadLeft(7), $location } - wk-write "$s" "$log" + WK-write "$s" "$log" } foreach ($user in get-wmiobject -class win32_useraccount) { if (test-path registry::hku\$($user.sid)) { - wk-write (" User: {0}" -f $user.name) "$log" + WK-write (" User: {0}" -f $user.name) "$log" # Profile $user_profile = gp "registry::hklm\software\microsoft\windows nt\currentversion\profilelist\$($user.sid)" print-dir-size "Profile" $user_profile.ProfileImagePath - wk-write " ------------------------" "$log" + WK-write " ------------------------" "$log" # Shell Folders $shell_folders = gp "registry::hku\$($user.sid)\software\microsoft\windows\currentversion\explorer\shell folders" @@ -72,6 +74,6 @@ foreach ($user in get-wmiobject -class win32_useraccount) { } # Spacer - wk-write "" "$log" + WK-write "" "$log" } } \ No newline at end of file diff --git a/.bin/Scripts/user_data_transfer.py b/.bin/Scripts/user_data_transfer.py new file mode 100644 index 00000000..5b1bb66b --- /dev/null +++ b/.bin/Scripts/user_data_transfer.py @@ -0,0 +1,248 @@ +# Wizard Kit: Copy user data to the system over the network + +import os +import re +from operator import itemgetter + +# Init +os.chdir(os.path.dirname(os.path.realpath(__file__))) +os.system('title Wizard Kit: Data 1') +from functions import * +vars = init_vars() +vars_os = init_vars_os() +vars['LogFile'] = '{LogDir}\\Data 1.log'.format(**vars) +os.makedirs('{LogDir}'.format(**vars), exist_ok=True) +vars['TransferDir'] = '{ClientDir}\\Transfer\\'.format(**vars) +os.makedirs('{TransferDir}'.format(**vars), exist_ok=True) +vars['FastCopy'] = '{BinDir}\\FastCopy\\FastCopy.exe'.format(**vars) +vars['FastCopyArgs'] = [ + '/cmd=noexist_only', + '/logfile={LogFile}'.format(**vars), + '/utf8', + '/skip_empty_dir', + '/linkdest', + '/no_ui', + '/auto_close', + '/exclude=\\*.esd;\\*.swm;\\*.wim;\\*.dd;\\*.dd.tgz;\\*.dd.txz;\\*.map;\\*.dmg;\\*.image;$RECYCLE.BIN;$Recycle.Bin;.AppleDB;.AppleDesktop;.AppleDouble;.com.apple.timemachine.supported;.dbfseventsd;.DocumentRevisions-V100*;.DS_Store;.fseventsd;.PKInstallSandboxManager;.Spotlight*;.SymAV*;.symSchedScanLockxz;.TemporaryItems;.Trash*;.vol;.VolumeIcon.icns;desktop.ini;Desktop?DB;Desktop?DF;hiberfil.sys;lost+found;Network?Trash?Folder;pagefile.sys;Recycled;RECYCLER;System?Volume?Information;Temporary?Items;Thumbs.db'] +vars['Notepad2'] = '{BinDir}\\Notepad2\\Notepad2-Mod.exe'.format(**vars) +vars['wimlib-imagex'] = '{BinDir}\\wimlib\\x32\\wimlib-imagex.exe'.format(**vars) +if vars_os['Arch'] == 64: + vars['FastCopy'] = vars['FastCopy'].replace('FastCopy.exe', 'FastCopy64.exe') + vars['Notepad2'] = vars['Notepad2'].replace('Notepad2-Mod.exe', 'Notepad2-Mod64.exe') + vars['wimlib-imagex'] = vars['wimlib-imagex'].replace('x32', 'x64') +re_included_root_items = re.compile(r'(^\\((My\s*)|Downloads|Doc(uments?|s?)|WK(-Info|-Transfer|)|Media|Music|Pictures?|Videos?)$|^\\(ProgramData|Recovery|Temp.*|Users)$|(log|txt|rtf|qb\w*|avi|m4a|m4v|mp4|mkv|jpg|png|tiff?)$)', flags=re.IGNORECASE) +re_excluded_root_items = re.compile(r'(^\\boot(mgr|nxt)$|^\\(eula|globdata|install|vc_?red)|.*.sys$|^\\System Volume Information|RECYCLER|\$Recycle\.bin|^\\\$?Win(dows(.old|\.~BT|)$|RE_)|^\\PerfLogs|^\\Program Files|\.(esd|swm|wim|dd|map|dmg|image)$)', flags=re.IGNORECASE) +re_excluded_items = re.compile(r'^(\.(AppleDB|AppleDesktop|AppleDouble|com\.apple\.timemachine\.supported|dbfseventsd|DocumentRevisions-V100.*|DS_Store|fseventsd|PKInstallSandboxManager|Spotlight.*|SymAV.*|symSchedScanLockxz|TemporaryItems|Trash.*|vol|VolumeIcon\.icns)|desktop\.(ini|.*DB|.*DF)|(hiberfil|pagefile)\.sys|lost\+found|Network\.*Trash\.*Folder|Recycle[dr]|System\.*Volume\.*Information|Temporary\.*Items|Thumbs\.db)$', flags=re.IGNORECASE) + +def abort(): + print_warning('Aborted.', log_file=vars['LogFile']) + exit_script() + +def cleanup_transfer(): + """Walk through transfer folder (from the bottom) and remove extraneous items.""" + if os.path.exists(vars['TransferDir']): + for root, dirs, files in os.walk(vars['TransferDir'], topdown=False): + for name in dirs: + try: + # Removes empty directories and junction points + os.rmdir(os.path.join(root, name)) + except OSError: + pass + for name in files: + if re_excluded_items.search(name): + try: + # Removes files based on exclusion regex + os.remove(os.path.join(root, name)) + except OSError: + pass + +def exit_script(): + umount_backup_shares() + pause("Press Enter to exit...") + subprocess.Popen('"{Notepad2}" "{LogFile}"'.format(**vars)) + quit() + +def is_valid_image(item): + _valid = item.is_file() and re.search(r'\.wim$', item.name, flags=re.IGNORECASE) + if _valid: + try: + _cmd = [vars['wimlib-imagex'], 'info', '{image}'.format(image=item.path)] + run_program(_cmd) + except subprocess.CalledProcessError: + _valid = False + print_warning('WARNING: Image damaged.', log_file=vars['LogFile']) + time.sleep(2) + return _valid + +def transfer_file_based(restore_source): + # Registry + _args = vars['FastCopyArgs'].copy() + if os.path.exists('{source}\\Windows\\System32\\config'.format(source=restore_source.path)): + _args.append('{source}\\Windows\\System32\\config'.format(source=restore_source.path)) + if os.path.exists('{source}\\Windows\\System32\\OEM'.format(source=restore_source.path)): + _args.append('{source}\\Windows\\System32\\OEM'.format(source=restore_source.path)) + _args.append('/to={TransferDir}\\Windows\\System32\\'.format(**vars)) + try: + print_standard('Copying Windows Registry...', log_file=vars['LogFile']) + run_program(vars['FastCopy'], _args, check=True) + except subprocess.CalledProcessError: + print_warning('WARNING: Errors encountered while copying registry', log_file=vars['LogFile']) + + # Registry (Windows.old) + _args = vars['FastCopyArgs'].copy() + if os.path.exists('{source}\\Windows.old\\Windows\\System32\\config'.format(source=restore_source.path)): + _args.append('{source}\\Windows.old\\Windows\\System32\\config'.format(source=restore_source.path)) + if os.path.exists('{source}\\Windows.old\\Windows\\System32\\OEM'.format(source=restore_source.path)): + _args.append('{source}\\Windows.old\\Windows\\System32\\OEM'.format(source=restore_source.path)) + _args.append('/to={TransferDir}\\Windows.old\\Windows\\System32\\'.format(**vars)) + try: + print_standard('Copying Windows Registry...', log_file=vars['LogFile']) + run_program(vars['FastCopy'], _args, check=True) + except subprocess.CalledProcessError: + print_warning('WARNING: Errors encountered while copying registry', log_file=vars['LogFile']) + + # Main copy + selected_items = [] + for item in os.scandir(restore_source.path): + if re_included_root_items.search(item.name): + selected_items.append(item.path) + elif not re_excluded_root_items.search(item.name): + if ask('Copy: "{name}" item?'.format(name=item.name)): + selected_items.append(item.path) + if len(selected_items) > 0: + _args = vars['FastCopyArgs'].copy() + _args += selected_items + _args.append('/to={TransferDir}\\'.format(**vars)) + try: + print_standard('Copying main user data...', log_file=vars['LogFile']) + run_program(vars['FastCopy'], _args, check=True) + except subprocess.CalledProcessError: + print_warning('WARNING: Errors encountered while copying main user data', log_file=vars['LogFile']) + else: + print_error('ERROR: No files selected for transfer?', log_file=vars['LogFile']) + abort() + + # Windows.old + selected_items = [] + for item in ['Users', 'ProgramData']: + item = '{source}\\Windows.old\\{item}'.format(source=restore_source.path, item=item) + if os.path.exists(item): + selected_items.append(item) + if len(selected_items) > 0: + _args = vars['FastCopyArgs'].copy() + _args += selected_items + _args.append('/to={TransferDir}\\Windows.old\\'.format(**vars)) + try: + print_standard('Copying user data (Windows.old)...', log_file=vars['LogFile']) + run_program(vars['FastCopy'], _args, check=True) + except subprocess.CalledProcessError: + print_warning('WARNING: Errors encountered while copying data from Windows.old', log_file=vars['LogFile']) + +def transfer_image_based(restore_source): + print_standard('Assessing image...', log_file=vars['LogFile']) + + # Scan source + _args = [ + 'dir', + '{source}'.format(source=restore_source.path), '1'] + try: + _list = run_program(vars['wimlib-imagex'], _args, check=True) + except subprocess.CalledProcessError as err: + print_error('ERROR: Failed to get file list.') + print(err) + abort() + + # Add items to list + selected_items = [] + root_items = [i.strip() for i in _list.stdout.decode('utf-8', 'ignore').splitlines() if i.count('\\') == 1 and i.strip() != '\\'] + for item in root_items: + if re_included_root_items.search(item): + selected_items.append(item) + elif not re_excluded_root_items.search(item): + if ask('Extract: "{name}" item?'.format(name=item)): + selected_items.append(item) + + # Extract files + if len(selected_items) > 0: + # Write files.txt + with open('{TmpDir}\\wim_files.txt'.format(**vars), 'w') as f: + # Defaults + f.write('\\Windows.old\\WK*\n') + f.write('\\Windows.old\\ProgramData\n') + f.write('\\Windows.old\\Temp\n') + f.write('\\Windows.old\\Users\n') + f.write('\\Windows.old\\Windows\\System32\\config\n') + f.write('\\Windows.old\\Windows\\System32\\OEM\n') + f.write('\\Windows\\System32\\config\n') + f.write('\\Windows\\System32\\OEM\n') + f.write('AdwCleaner\\*log\n') + f.write('AdwCleaner\\*txt\n') + for item in selected_items: + f.write('{item}\n'.format(item=item)) + try: + print_standard('Extracting user data...', log_file=vars['LogFile']) + _args = [ + 'extract', + '{source}'.format(source=restore_source.path), '1', + '@{TmpDir}\\wim_files.txt'.format(**vars), + '--dest-dir={TransferDir}\\'.format(**vars), + '--no-acls', + '--nullglob'] + run_program(vars['wimlib-imagex'], _args, check=True) + except subprocess.CalledProcessError: + print_warning('WARNING: Errors encountered while extracting user data', log_file=vars['LogFile']) + else: + print_error('ERROR: No files selected for extraction?', log_file=vars['LogFile']) + abort() + +if __name__ == '__main__': + # Set ticket number + ticket = None + while ticket is None: + tmp = input('Enter ticket number: ') + if re.match(r'^([0-9]+([-_]?\w+|))$', tmp): + ticket = tmp + + # Get backup + backup_source = select_backup(ticket) + if backup_source is None: + abort() + + # Determine restore method + restore_source = None + restore_options = [] + _file_based = False + for item in os.scandir(backup_source.path): + if item.is_dir(): + _file_based = True + restore_options.append({'Name': 'File-Based:\t{source}'.format(source=item.name), 'Source': item}) + for _subitem in os.scandir(item.path): + if is_valid_image(_subitem): + restore_options.append({'Name': 'Image-Based: {dir}\\{source}'.format(dir=item.name, source=_subitem.name), 'Source': _subitem}) + elif is_valid_image(item): + restore_options.append({'Name': 'Image-Based:\t{source}'.format(source=item.name), 'Source': item}) + if _file_based: + restore_options.append({'Name': 'File-Based:\t.', 'Source': backup_source}) + restore_options = sorted(restore_options, key=itemgetter('Name')) + actions = [{'Name': 'Quit', 'Letter': 'Q'}] + if len(restore_options) > 0: + selection = menu_select('Which backup are we using? (Path: {path})'.format(path=backup_source.path), restore_options, actions) + if selection == 'Q': + abort() + else: + restore_source = restore_options[int(selection)-1]['Source'] + else: + print_error('ERROR: No restoration options detected.', log_file=vars['LogFile']) + abort() + + # Start transfer + print_info('Using backup: {path}'.format(path=restore_source.path), log_file=vars['LogFile']) + if restore_source.is_dir(): + transfer_file_based(restore_source) + if restore_source.is_file(): + transfer_image_based(restore_source) + cleanup_transfer() + + # Done + print_success('Done.', log_file=vars['LogFile']) + exit_script() \ No newline at end of file diff --git a/.bin/cmder_mini/vendor/conemu-maximus5/ConEmu.xml b/.bin/cmder_mini/vendor/conemu-maximus5/ConEmu.xml deleted file mode 100644 index 7f70aaf6..00000000 --- a/.bin/cmder_mini/vendor/conemu-maximus5/ConEmu.xml +++ /dev/null @@ -1,844 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Activate Windows.cmd b/Activate Windows.cmd new file mode 100644 index 00000000..4a9a01d5 --- /dev/null +++ b/Activate Windows.cmd @@ -0,0 +1,31 @@ +@echo off + +:Flags +for %%f in (%*) do ( + if /i "%%f" == "/DEBUG" (@echo on) +) + +:FindBin +set bin= & pushd "%~dp0" +:FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner +:FindBinDone +set "bin=%cd%\.bin" & popd + +:Launch +call "%bin%\Scripts\Launch.cmd" PyScript "%bin%\Scripts" "activate.py" /admin +goto Exit + +:ErrorNoBin +popd +color 4e +echo ".bin" folder not found, aborting script. +echo. +echo Press any key to exit... +pause>nul +color +goto Exit + +:Exit diff --git a/Activation/Activate Windows (with BIOS key).cmd b/Activation/Activate Windows (with BIOS key).cmd deleted file mode 100644 index 7135e4b8..00000000 --- a/Activation/Activate Windows (with BIOS key).cmd +++ /dev/null @@ -1,44 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner -:FindBinDone -popd -if not defined bin goto ErrorNoBin - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:Launch -call "%bin%\Scripts\Launch.cmd" PSScript "%bin%\Scripts" "activate.ps1" /admin -goto Exit - -:ErrorNoBin -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Battery Health.cmd b/Battery Health.cmd deleted file mode 100644 index 271a8bb7..00000000 --- a/Battery Health.cmd +++ /dev/null @@ -1,39 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner -:FindBinDone -popd -if not defined bin goto ErrorNoBin - -:Launch -call "%bin%\Scripts\Launch.cmd" PSScript "%bin%\Scripts" "check_battery.ps1" -goto Exit - -:ErrorNoBin -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Copy-WizardKit.cmd b/Copy-WizardKit.cmd index 0b3d1198..227ab0da 100644 --- a/Copy-WizardKit.cmd +++ b/Copy-WizardKit.cmd @@ -8,114 +8,57 @@ for %%f in (%*) do ( :Init setlocal EnableDelayedExpansion -title Wizard Kit Copier +title Wizard Kit: Tools Copier color 1b echo Initializing... -:FindWizardKit -set wrongpath= -call :TestSource "%~dp0" -if defined wrongpath (call :TestSource "\\10.0.0.10\WizardKit") -if defined wrongpath goto WizardKitNotFound +:FindBin +set bin= & pushd "%~dp0" +:FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner +:FindBinDone +set "bin=%cd%\.bin" & popd -:Vars -rem :TestSource above runs pushd, so %cd% should be accurate. +:SetVariables +if /i "!PROCESSOR_ARCHITECTURE!" == "AMD64" set "arch=64" +set "fastcopy=%bin%\FastCopy\FastCopy.exe" +if !arch! equ 64 ( + set "fastcopy=%bin%\FastCopy\FastCopy64.exe" +) +set "fastcopy_args=/cmd=diff /no_ui /auto_close" +rem Set %client_dir% +call "%bin%\Scripts\init_client_dir.cmd" +pushd "%bin%\.." set "source=%cd%" -set "dest=%systemdrive%\WK\Tools" +set "dest=%client_dir%\Tools" -:CreateToolsFolder -mkdir "!dest!" > nul 2>&1 +:CopyFiles +echo Copying data... +rem .bin +start "" /wait "%fastcopy%" %fastcopy_args% /exclude="\_Drivers\SDI\" "%bin%\*" /to="%dest%\.bin\" -:: .bin folder :: -set "args=" -call :RoboCopy "!source!\.bin" "!dest!\.bin" "" "!args!" - -:: RKill Alternatives :: +rem RKill links pushd "!dest!\.bin\RKill" -mklink /h explorer.exe RKill.exe -mklink /h iExplore.exe RKill.exe -mklink /h RKill.com RKill.exe -mklink /h RKill.scr RKill.exe -mklink /h uSeRiNiT.exe RKill.exe -mklink /h WiNlOgOn.exe RKill.exe +mklink /h explorer.exe RKill.exe >nul 2>&1 +mklink /h iExplore.exe RKill.exe >nul 2>&1 +mklink /h RKill.com RKill.exe >nul 2>&1 +mklink /h RKill.scr RKill.exe >nul 2>&1 +mklink /h uSeRiNiT.exe RKill.exe >nul 2>&1 +mklink /h WiNlOgOn.exe RKill.exe >nul 2>&1 popd -:: Root files :: -set "args=" -call :RoboCopy "!source!\.bin\Scripts" "!dest!\.bin\Scripts" "" "!args!" -copy /y "!source!\Battery Health.cmd" "!dest!\" -copy /y "!source!\Enter SafeMode.cmd" "!dest!\" -copy /y "!source!\Exit SafeMode.cmd" "!dest!\" -copy /y "!source!\Final Checklist.cmd" "!dest!\" -copy /y "!source!\Reset Browsers.cmd" "!dest!\" -copy /y "!source!\SW Diagnostics.cmd" "!dest!\" +rem Everything else +start "" /wait "%fastcopy%" %fastcopy_args% /exclude="\.bin\;\.git\;\Data Recovery\;\Copy-WizardKit.cmd;\Drivers\Auto Detect - SDI.cmd" "%source%" /to="%dest%\" -:: Activation :: -set "args=" -call :RoboCopy "!source!\Activation" "!dest!\Activation" "" "!args!" - -:: Data Recovery :: -rem Disabled. -rem set "args=" -rem call :RoboCopy "!source!\Data Recovery" "!dest!\Data Recovery" "" "!args!" - -:: Data Transfers & DSR :: -set "args=" -call :RoboCopy "!source!\Data Transfers & DSR" "!dest!\Data Transfers & DSR" "" "!args!" - -:: Diagnostics :: -set "args=" -call :RoboCopy "!source!\Diagnostics" "!dest!\Diagnostics" "" "!args!" - -:: Drivers :: -set "args=" -call :RoboCopy "!source!\Drivers" "!dest!\Drivers" "" "!args!" - -:: Installers :: -set "args=" -call :RoboCopy "!source!\Installers" "!dest!\Installers" "" "!args!" - -:: Misc :: -set "args=" -call :RoboCopy "!source!\Misc" "!dest!\Misc" "" "!args!" - -:: OSR & VR :: -set "args=" -call :RoboCopy "!source!\OSR & VR" "!dest!\OSR & VR" "" "!args!" - -:: Uninstallers :: -set "args=" -call :RoboCopy "!source!\Uninstallers" "!dest!\Uninstallers" "" "!args!" - -:: Open Folder :: +:OpenFolder start "" explorer "!dest!" goto Done -:: Subroutines :: -:RoboCopy -rem set args (without quotes) -set "_source=%~1" -set "_dest=%~2" -set "_files=%~3" -set "_args=%~4" -mkdir "!_dest!" >nul 2>&1 -robocopy /s /r:3 /w:0 "!_source!" "!_dest!" !_files! !_args! -goto :EOF - -:TestSource -set wrongpath= -:: Testing one for one dir is probably enough. -dir "Uninstallers" >nul 2>&1 -if %errorlevel% neq 0 (set wrongpath=true) -if not defined wrongpath (pushd "%1") -goto :EOF - -:WizardKitNotFound -echo ERROR: WizardKit not found. -goto Abort - -:WindowsVersionError -echo ERROR: This version of Windows is not supported. +:ErrorNoBin +popd +echo ERROR: ".bin" folder not found.. goto Abort :Abort @@ -136,5 +79,3 @@ goto Exit popd color endlocal - -:EOF diff --git a/Data Recovery/PhotoRec (CLI).cmd b/Data Recovery/PhotoRec (CLI).cmd index bd25bb58..1e8ac85a 100644 --- a/Data Recovery/PhotoRec (CLI).cmd +++ b/Data Recovery/PhotoRec (CLI).cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Console "%bin%\TestDisk" "photorec_win.exe" "" /admin goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Data Recovery/PhotoRec.cmd b/Data Recovery/PhotoRec.cmd index 18a69d72..604ce38b 100644 --- a/Data Recovery/PhotoRec.cmd +++ b/Data Recovery/PhotoRec.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\TestDisk" "qphotorec_win.exe" "" /admin goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Data Recovery/TestDisk.cmd b/Data Recovery/TestDisk.cmd index f08d7fdb..f26a09fe 100644 --- a/Data Recovery/TestDisk.cmd +++ b/Data Recovery/TestDisk.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Console "%bin%\TestDisk" "testdisk_win.exe" "" /admin goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Data Transfers/Explorer++.cmd b/Data Transfers/Explorer++.cmd index 33177709..c82029bc 100644 --- a/Data Transfers/Explorer++.cmd +++ b/Data Transfers/Explorer++.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\Explorer++" "Explorer++.exe" "%userprofile%" /max goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Data Transfers/FastCopy (as ADMIN).cmd b/Data Transfers/FastCopy (as ADMIN).cmd index 521db719..97144940 100644 --- a/Data Transfers/FastCopy (as ADMIN).cmd +++ b/Data Transfers/FastCopy (as ADMIN).cmd @@ -6,32 +6,24 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd -:WKInfo -rem Create WK\Info\YYYY-MM-DD and set path as %log_dir% -call "%bin%\Scripts\wk_info.cmd" +:CreateInfoDir +rem Create %client_dir%\Info\YYYY-MM-DD and set path as %log_dir% +call "%bin%\Scripts\init_client_dir.cmd" /Info /Transfer :Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%\FastCopy" "FastCopy.exe" "/logfile=%log_dir%\FastCopy.log /cmd=noexist_only /utf8 /skip_empty_dir /linkdest /exclude=$RECYCLE.BIN;$Recycle.Bin;.AppleDB;.AppleDesktop;.AppleDouble;.com.apple.timemachine.supported;.dbfseventsd;.DocumentRevisions-V100*;.DS_Store;.fseventsd;.PKInstallSandboxManager;.Spotlight*;.SymAV*;.symSchedScanLockxz;.TemporaryItems;.Trash*;.vol;.VolumeIcon.icns;desktop.ini;Desktop?DB;Desktop?DF;hiberfil.sys;lost+found;Network?Trash?Folder;pagefile.sys;Recycled;RECYCLER;System?Volume?Information;Temporary?Items;Thumbs.db /to=%systemdrive%\WK\Transfer\" /admin +call "%bin%\Scripts\Launch.cmd" Program "%bin%\FastCopy" "FastCopy.exe" "/logfile=%log_dir%\FastCopy.log /cmd=noexist_only /utf8 /skip_empty_dir /linkdest /exclude=$RECYCLE.BIN;$Recycle.Bin;.AppleDB;.AppleDesktop;.AppleDouble;.com.apple.timemachine.supported;.dbfseventsd;.DocumentRevisions-V100*;.DS_Store;.fseventsd;.PKInstallSandboxManager;.Spotlight*;.SymAV*;.symSchedScanLockxz;.TemporaryItems;.Trash*;.vol;.VolumeIcon.icns;desktop.ini;Desktop?DB;Desktop?DF;hiberfil.sys;lost+found;Network?Trash?Folder;pagefile.sys;Recycled;RECYCLER;System?Volume?Information;Temporary?Items;Thumbs.db /to=%client_dir%\Transfer\" /admin goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Data Transfers/FastCopy.cmd b/Data Transfers/FastCopy.cmd index b9649ae6..1bb07de2 100644 --- a/Data Transfers/FastCopy.cmd +++ b/Data Transfers/FastCopy.cmd @@ -6,32 +6,24 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd -:WKInfo -rem Create WK\Info\YYYY-MM-DD and set path as %log_dir% -call "%bin%\Scripts\wk_info.cmd" +:CreateInfoDir +rem Create %client_dir%\Info\YYYY-MM-DD and set path as %log_dir% +call "%bin%\Scripts\init_client_dir.cmd" /Info /Transfer :Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%\FastCopy" "FastCopy.exe" "/logfile=%log_dir%\FastCopy.log /cmd=noexist_only /utf8 /skip_empty_dir /linkdest /exclude=$RECYCLE.BIN;$Recycle.Bin;.AppleDB;.AppleDesktop;.AppleDouble;.com.apple.timemachine.supported;.dbfseventsd;.DocumentRevisions-V100*;.DS_Store;.fseventsd;.PKInstallSandboxManager;.Spotlight*;.SymAV*;.symSchedScanLockxz;.TemporaryItems;.Trash*;.vol;.VolumeIcon.icns;desktop.ini;Desktop?DB;Desktop?DF;hiberfil.sys;lost+found;Network?Trash?Folder;pagefile.sys;Recycled;RECYCLER;System?Volume?Information;Temporary?Items;Thumbs.db /to=%systemdrive%\WK\Transfer\" +call "%bin%\Scripts\Launch.cmd" Program "%bin%\FastCopy" "FastCopy.exe" "/logfile=%log_dir%\FastCopy.log /cmd=noexist_only /utf8 /skip_empty_dir /linkdest /exclude=$RECYCLE.BIN;$Recycle.Bin;.AppleDB;.AppleDesktop;.AppleDouble;.com.apple.timemachine.supported;.dbfseventsd;.DocumentRevisions-V100*;.DS_Store;.fseventsd;.PKInstallSandboxManager;.Spotlight*;.SymAV*;.symSchedScanLockxz;.TemporaryItems;.Trash*;.vol;.VolumeIcon.icns;desktop.ini;Desktop?DB;Desktop?DF;hiberfil.sys;lost+found;Network?Trash?Folder;pagefile.sys;Recycled;RECYCLER;System?Volume?Information;Temporary?Items;Thumbs.db /to=%client_dir%\Transfer\" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Data Transfers/KVRT.cmd b/Data Transfers/KVRT.cmd index 1a80626b..7d5051d8 100644 --- a/Data Transfers/KVRT.cmd +++ b/Data Transfers/KVRT.cmd @@ -6,25 +6,18 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd -:CreateQuarantineDir -set "q_dir=%systemdrive%\WK\Quarantine\KVRT" +:Init +rem Set %client_dir% +call "%bin%\Scripts\init_client_dir.cmd" /Quarantine +set "q_dir=%client_dir%\Quarantine\KVRT" mkdir "%q_dir%">nul 2>&1 :Launch @@ -32,6 +25,7 @@ call "%bin%\Scripts\Launch.cmd" Program "%bin%" "KVRT.exe" "-accepteula -d %q_di goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Data Transfers/Q-Dir.cmd b/Data Transfers/Q-Dir.cmd new file mode 100644 index 00000000..3c4daa41 --- /dev/null +++ b/Data Transfers/Q-Dir.cmd @@ -0,0 +1,31 @@ +@echo off + +:Flags +for %%f in (%*) do ( + if /i "%%f" == "/DEBUG" (@echo on) +) + +:FindBin +set bin= & pushd "%~dp0" +:FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner +:FindBinDone +set "bin=%cd%\.bin" & popd + +:Launch +call "%bin%\Scripts\Launch.cmd" Program "%bin%\Q-Dir" "Q-Dir.exe" "%userprofile%" /max +goto Exit + +:ErrorNoBin +popd +color 4e +echo ".bin" folder not found, aborting script. +echo. +echo Press any key to exit... +pause>nul +color +goto Exit + +:Exit diff --git a/Data Transfers/Transferred Keys.cmd b/Data Transfers/Transferred Keys.cmd index 8eabbc37..d9e867db 100644 --- a/Data Transfers/Transferred Keys.cmd +++ b/Data Transfers/Transferred Keys.cmd @@ -6,41 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin - -:ClearConfigs -if not exist "%bin%\tmp" goto Extract -pushd "%bin%\tmp" -if exist "ProduKey.cfg" del "ProduKey.cfg" -if exist "ProduKey64.cfg" del "ProduKey64.cfg" -popd - -:Extract -cls -mkdir "%bin%\tmp" >nul 2>&1 -call "%bin%\Scripts\Launch.cmd" Program "%bin%" "%bin%\7-Zip\7za.exe" "e ProduKey.7z -otmp -aoa -pAbracadabra -bsp0 -bso0" /wait -ping -n 1 127.0.0.1>nul +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Console "%bin%\Scripts" "transferred_keys.cmd" /admin goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Data Transfers/User Data Transfer.cmd b/Data Transfers/User Data Transfer.cmd new file mode 100644 index 00000000..7f9dc352 --- /dev/null +++ b/Data Transfers/User Data Transfer.cmd @@ -0,0 +1,31 @@ +@echo off + +:Flags +for %%f in (%*) do ( + if /i "%%f" == "/DEBUG" (@echo on) +) + +:FindBin +set bin= & pushd "%~dp0" +:FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner +:FindBinDone +set "bin=%cd%\.bin" & popd + +:Launch +call "%bin%\Scripts\Launch.cmd" PyScript "%bin%\Scripts" "user_data_transfer.py" +goto Exit + +:ErrorNoBin +popd +color 4e +echo ".bin" folder not found, aborting script. +echo. +echo Press any key to exit... +pause>nul +color +goto Exit + +:Exit diff --git a/Diagnostics/AIDA64.cmd b/Diagnostics/AIDA64.cmd index 0a21a5c3..90638a4d 100644 --- a/Diagnostics/AIDA64.cmd +++ b/Diagnostics/AIDA64.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\AIDA64" "aida64.exe" "" /admin goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Diagnostics/BatteryInfoView.cmd b/Diagnostics/BatteryInfoView.cmd index 88823c3d..93a73734 100644 --- a/Diagnostics/BatteryInfoView.cmd +++ b/Diagnostics/BatteryInfoView.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\BatteryInfoView" "BatteryInfoView.exe" "" /admin goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Diagnostics/BleachBit.cmd b/Diagnostics/BleachBit.cmd index d6b709c1..e1751888 100644 --- a/Diagnostics/BleachBit.cmd +++ b/Diagnostics/BleachBit.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\BleachBit" "bleachbit.exe" "" /admin goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Diagnostics/BlueScreenView.cmd b/Diagnostics/BlueScreenView.cmd index 22b1e90b..b5c903e2 100644 --- a/Diagnostics/BlueScreenView.cmd +++ b/Diagnostics/BlueScreenView.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\BlueScreenView" "BlueScreenView.exe" "" /admin goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Diagnostics/Auslogics DiskDefrag.cmd b/Diagnostics/Extras/Auslogics DiskDefrag.cmd similarity index 64% rename from Diagnostics/Auslogics DiskDefrag.cmd rename to Diagnostics/Extras/Auslogics DiskDefrag.cmd index 03416ab8..a03dbf39 100644 --- a/Diagnostics/Auslogics DiskDefrag.cmd +++ b/Diagnostics/Extras/Auslogics DiskDefrag.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\Auslogics DiskDefrag" "DiskDefrag.exe" "" /admin goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Diagnostics/Autoruns.cmd b/Diagnostics/Extras/Autoruns (with VirusTotal Scan).cmd similarity index 86% rename from Diagnostics/Autoruns.cmd rename to Diagnostics/Extras/Autoruns (with VirusTotal Scan).cmd index 5599b4f5..68c00c67 100644 --- a/Diagnostics/Autoruns.cmd +++ b/Diagnostics/Extras/Autoruns (with VirusTotal Scan).cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :ModifySettings reg add HKCU\Software\Sysinternals\AutoRuns /v checkvirustotal /t REG_DWORD /d 1 /f >nul @@ -40,6 +31,7 @@ call "%bin%\Scripts\Launch.cmd" Program "%bin%\SysinternalsSuite" "Autoruns.exe" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Diagnostics/BIOSCodes.cmd b/Diagnostics/Extras/BIOSCodes.cmd similarity index 63% rename from Diagnostics/BIOSCodes.cmd rename to Diagnostics/Extras/BIOSCodes.cmd index 6ca0e0f2..81674083 100644 --- a/Diagnostics/BIOSCodes.cmd +++ b/Diagnostics/Extras/BIOSCodes.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\BIOSCodes" "BIOSCodes.exe" "" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Diagnostics/CPU-Z.cmd b/Diagnostics/Extras/CPU-Z.cmd similarity index 62% rename from Diagnostics/CPU-Z.cmd rename to Diagnostics/Extras/CPU-Z.cmd index 9333c843..984560d7 100644 --- a/Diagnostics/CPU-Z.cmd +++ b/Diagnostics/Extras/CPU-Z.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\CPU-Z" "cpuz.exe" "" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Diagnostics/ERUNT.cmd b/Diagnostics/Extras/ERUNT.cmd similarity index 56% rename from Diagnostics/ERUNT.cmd rename to Diagnostics/Extras/ERUNT.cmd index 458f04cb..c1ef3e4e 100644 --- a/Diagnostics/ERUNT.cmd +++ b/Diagnostics/Extras/ERUNT.cmd @@ -6,32 +6,24 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd -:WKInfo -rem Create WK\Info\YYYY-MM-DD and set path as %log_dir% -call "%bin%\Scripts\wk_info.cmd" +:Init +rem Create %client_dir%\Info\YYYY-MM-DD and set path as %log_dir% +call "%bin%\Scripts\init_client_dir.cmd" /Info :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\erunt" "ERUNT.EXE" "%log_dir%%\Registry sysreg curuser otherusers" /admin goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Diagnostics/HeavyLoad.cmd b/Diagnostics/Extras/HeavyLoad.cmd similarity index 63% rename from Diagnostics/HeavyLoad.cmd rename to Diagnostics/Extras/HeavyLoad.cmd index 36935b7d..5ff4aa41 100644 --- a/Diagnostics/HeavyLoad.cmd +++ b/Diagnostics/Extras/HeavyLoad.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\HeavyLoad" "HeavyLoad.exe" "" /admin goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Diagnostics/HitmanPro (FullBreach).cmd b/Diagnostics/Extras/HitmanPro (FullBreach).cmd similarity index 58% rename from Diagnostics/HitmanPro (FullBreach).cmd rename to Diagnostics/Extras/HitmanPro (FullBreach).cmd index c62e82e4..147ff089 100644 --- a/Diagnostics/HitmanPro (FullBreach).cmd +++ b/Diagnostics/Extras/HitmanPro (FullBreach).cmd @@ -6,32 +6,24 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd -:WKInfo -rem Create WK\Info\YYYY-MM-DD and set path as %log_dir% -call "%bin%\Scripts\wk_info.cmd" +:CreateInfoDir +rem Create %client_dir%\Info\YYYY-MM-DD and set path as %log_dir% +call "%bin%\Scripts\init_client_dir.cmd" /Info :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\HitmanPro" "HitmanPro.exe" "/scan /noinstall /noupload /log=%log_dir%\hitman.xml /fb" /admin goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Diagnostics/MailPasswordView (as ADMIN).cmd b/Diagnostics/Extras/MailPasswordView (as ADMIN).cmd similarity index 71% rename from Diagnostics/MailPasswordView (as ADMIN).cmd rename to Diagnostics/Extras/MailPasswordView (as ADMIN).cmd index faacd91e..e54b87d7 100644 --- a/Diagnostics/MailPasswordView (as ADMIN).cmd +++ b/Diagnostics/Extras/MailPasswordView (as ADMIN).cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Init setlocal enabledelayedexpansion @@ -29,7 +20,7 @@ setlocal enabledelayedexpansion :Extract mkdir "%bin%\tmp" >nul 2>&1 call "%bin%\Scripts\Launch.cmd" Program "%bin%" "%bin%\7-Zip\7za.exe" "x mailpv.7z -otmp -aoa -pAbracadabra -bsp0 -bso0" /wait -ping -n 1 127.0.0.1>nul +ping -n 2 127.0.0.1>nul :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\tmp" "mailpv.exe" "" /admin @@ -40,6 +31,7 @@ endlocal goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Diagnostics/MailPasswordView.cmd b/Diagnostics/Extras/MailPasswordView.cmd similarity index 71% rename from Diagnostics/MailPasswordView.cmd rename to Diagnostics/Extras/MailPasswordView.cmd index d9344ce9..3f50b538 100644 --- a/Diagnostics/MailPasswordView.cmd +++ b/Diagnostics/Extras/MailPasswordView.cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Init setlocal enabledelayedexpansion @@ -29,7 +20,7 @@ setlocal enabledelayedexpansion :Extract mkdir "%bin%\tmp" >nul 2>&1 call "%bin%\Scripts\Launch.cmd" Program "%bin%" "%bin%\7-Zip\7za.exe" "x mailpv.7z -otmp -aoa -pAbracadabra -bsp0 -bso0" /wait -ping -n 1 127.0.0.1>nul +ping -n 2 127.0.0.1>nul :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\tmp" "mailpv.exe" "" @@ -40,6 +31,7 @@ endlocal goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Diagnostics/GpuTest.cmd b/Diagnostics/GpuTest.cmd index f601eee1..39bfb9a7 100644 --- a/Diagnostics/GpuTest.cmd +++ b/Diagnostics/GpuTest.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\GpuTest" "GpuTest_GUI.exe" "" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Diagnostics/HWMonitor.cmd b/Diagnostics/HWMonitor.cmd index 613c9404..1a065e43 100644 --- a/Diagnostics/HWMonitor.cmd +++ b/Diagnostics/HWMonitor.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\HWMonitor" "HWMonitor.exe" "" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Diagnostics/HWiNFO (Sensors).cmd b/Diagnostics/HWiNFO (Sensors).cmd new file mode 100644 index 00000000..bde9f5a7 --- /dev/null +++ b/Diagnostics/HWiNFO (Sensors).cmd @@ -0,0 +1,39 @@ +@echo off + +:Flags +for %%f in (%*) do ( + if /i "%%f" == "/DEBUG" (@echo on) +) + +:FindBin +set bin= & pushd "%~dp0" +:FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner +:FindBinDone +set "bin=%cd%\.bin" & popd + +:Configure +rem just configure for both x32 & x64 +for %%a in (32 64) do ( + copy /y "%bin%\HWiNFO\general.ini" "%bin%\HWiNFO\HWiNFO%%a.ini" + (echo SensorsOnly=1)>>"%bin%\HWiNFO\HWiNFO%%a.ini" + (echo SummaryOnly=0)>>"%bin%\HWiNFO\HWiNFO%%a.ini" +) + +:Launch +call "%bin%\Scripts\Launch.cmd" Program "%bin%\HWiNFO" "HWiNFO.exe" "" +goto Exit + +:ErrorNoBin +popd +color 4e +echo ".bin" folder not found, aborting script. +echo. +echo Press any key to exit... +pause>nul +color +goto Exit + +:Exit diff --git a/Diagnostics/HWiNFO.cmd b/Diagnostics/HWiNFO.cmd new file mode 100644 index 00000000..fdda567b --- /dev/null +++ b/Diagnostics/HWiNFO.cmd @@ -0,0 +1,39 @@ +@echo off + +:Flags +for %%f in (%*) do ( + if /i "%%f" == "/DEBUG" (@echo on) +) + +:FindBin +set bin= & pushd "%~dp0" +:FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner +:FindBinDone +set "bin=%cd%\.bin" & popd + +:Configure +rem just configure for both x32 & x64 +for %%a in (32 64) do ( + copy /y "%bin%\HWiNFO\general.ini" "%bin%\HWiNFO\HWiNFO%%a.ini" + (echo SensorsOnly=0)>>"%bin%\HWiNFO\HWiNFO%%a.ini" + (echo SummaryOnly=0)>>"%bin%\HWiNFO\HWiNFO%%a.ini" +) + +:Launch +call "%bin%\Scripts\Launch.cmd" Program "%bin%\HWiNFO" "HWiNFO.exe" "" +goto Exit + +:ErrorNoBin +popd +color 4e +echo ".bin" folder not found, aborting script. +echo. +echo Press any key to exit... +pause>nul +color +goto Exit + +:Exit diff --git a/Diagnostics/HitmanPro.cmd b/Diagnostics/HitmanPro.cmd index 93a9465d..2d20f9f9 100644 --- a/Diagnostics/HitmanPro.cmd +++ b/Diagnostics/HitmanPro.cmd @@ -6,32 +6,24 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd -:WKInfo -rem Create WK\Info\YYYY-MM-DD and set path as %log_dir% -call "%bin%\Scripts\wk_info.cmd" +:CreateInfoDir +rem Create %client_dir%\Info\YYYY-MM-DD and set path as %log_dir% +call "%bin%\Scripts\init_client_dir.cmd" /Info :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\HitmanPro" "HitmanPro.exe" "/scan /noinstall /noupload /log=%log_dir%\hitman.xml" /admin goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Diagnostics/ProduKey.cmd b/Diagnostics/ProduKey.cmd index 48d5cd27..e61fbbfa 100644 --- a/Diagnostics/ProduKey.cmd +++ b/Diagnostics/ProduKey.cmd @@ -6,92 +6,39 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Init setlocal EnableDelayedExpansion :ClearConfigs -if not exist "%bin%\tmp" goto FindHives +if not exist "%bin%\tmp" goto Extract pushd "%bin%\tmp" if exist "ProduKey.cfg" del "ProduKey.cfg" if exist "ProduKey64.cfg" del "ProduKey64.cfg" popd -:FindHives -set choices=L -echo.L: ~Local System~ -set "_S=%systemdrive%\WK\Transfer\Software" -if exist "!_S!" ( - set "choices=!choices!S" - echo.S: !_S! -) -set "_T=%systemdrive%\WK\Transfer\Windows\System32\config\Software" -if exist "!_T!" ( - set "choices=!choices!T" - echo.T: !_T! -) -set "_O=%systemdrive%\WK\Transfer\Windows.old\Windows\System32\config\Software" -if exist "!_O!" ( - set "choices=!choices!O" - echo.O: !_O! -) -set "_P=%systemdrive%\WK\Transfer\Windows.old\Software" -if exist "!_P!" ( - set "choices=!choices!P" - echo.P: !_P! -) - -:Choose -echo. -set "args=" - -rem If there are no choices, then don't ask -if "!choices!" == "L" (goto Extract) - -rem pick souce and use response to set sw_hive -choice /c !choices! /t 10 /d l /m "Please select source" -set /a "index=!errorlevel! - 1" -set "choice=!choices:~%index%,1!" - -rem Transferred hives -if "!choice!" == "S" (set "sw_hive=!_S!") -if "!choice!" == "T" (set "sw_hive=!_T!") -if "!choice!" == "O" (set "sw_hive=!_O!") -if "!choice!" == "P" (set "sw_hive=!_P!") - -rem set args -if !index! neq 0 (set "args=/regfile !sw_hive!") - :Extract cls mkdir "%bin%\tmp" >nul 2>&1 call "%bin%\Scripts\Launch.cmd" Program "%bin%" "%bin%\7-Zip\7za.exe" "e ProduKey.7z -otmp -aoa -pAbracadabra -bsp0 -bso0" /wait -ping -n 1 127.0.0.1>nul +ping -n 2 127.0.0.1>nul :Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%\tmp" "ProduKey.exe" "!args!" /admin +call "%bin%\Scripts\Launch.cmd" Program "%bin%\tmp" "ProduKey.exe" "" /admin :Done endlocal goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Diagnostics/SIV.cmd b/Diagnostics/SIV.cmd new file mode 100644 index 00000000..c21c8393 --- /dev/null +++ b/Diagnostics/SIV.cmd @@ -0,0 +1,31 @@ +@echo off + +:Flags +for %%f in (%*) do ( + if /i "%%f" == "/DEBUG" (@echo on) +) + +:FindBin +set bin= & pushd "%~dp0" +:FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner +:FindBinDone +set "bin=%cd%\.bin" & popd + +:Launch +call "%bin%\Scripts\Launch.cmd" Program "%bin%\SIV" "SIV.exe" "-LOCAL -KEYS -UNICODE -NOWIZARD" +goto Exit + +:ErrorNoBin +popd +color 4e +echo ".bin" folder not found, aborting script. +echo. +echo Press any key to exit... +pause>nul +color +goto Exit + +:Exit diff --git a/Drivers/Auto Detect - Acer.cmd b/Drivers/Auto Detect - Acer.cmd index fd89b742..745c9077 100644 --- a/Drivers/Auto Detect - Acer.cmd +++ b/Drivers/Auto Detect - Acer.cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch echo Waiting for software installation to finish... @@ -30,6 +21,7 @@ start "" "http://us.acer.com/ac/en/US/content/drivers" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Drivers/Auto Detect - Dell.cmd b/Drivers/Auto Detect - Dell.cmd index 4e17f9b5..23f6615d 100644 --- a/Drivers/Auto Detect - Dell.cmd +++ b/Drivers/Auto Detect - Dell.cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch echo Waiting for software installation to finish... @@ -30,6 +21,7 @@ start "" "http://www.dell.com/support/home/us/en/19/Eula/scan?sourcePage=J&scanT goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Drivers/Auto Detect - HP.cmd b/Drivers/Auto Detect - HP.cmd index 42aad16a..bf3a5315 100644 --- a/Drivers/Auto Detect - HP.cmd +++ b/Drivers/Auto Detect - HP.cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch echo Waiting for software installation to finish... @@ -30,6 +21,7 @@ start "" "http://support.hp.com/us-en/drivers/selfservice/identify" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Drivers/Auto Detect - Intel.cmd b/Drivers/Auto Detect - Intel.cmd index 76eb6853..1339c168 100644 --- a/Drivers/Auto Detect - Intel.cmd +++ b/Drivers/Auto Detect - Intel.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\_Drivers" "Intel Driver Update Utility.exe" "" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Drivers/Auto Detect - Lenovo.cmd b/Drivers/Auto Detect - Lenovo.cmd index f251c339..3192c004 100644 --- a/Drivers/Auto Detect - Lenovo.cmd +++ b/Drivers/Auto Detect - Lenovo.cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch echo Waiting for software installation to finish... @@ -30,6 +21,7 @@ start "" "http://support.lenovo.com/us/en/products?tabName=Downloads" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Drivers/Auto Detect - SDI.cmd b/Drivers/Auto Detect - SDI.cmd index 7bce2d13..e99cce36 100644 --- a/Drivers/Auto Detect - SDI.cmd +++ b/Drivers/Auto Detect - SDI.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\_Drivers\SDI" "SDI.exe" "" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Drivers/Auto Detect - Toshiba.cmd b/Drivers/Auto Detect - Toshiba.cmd index 237d2681..b75a030d 100644 --- a/Drivers/Auto Detect - Toshiba.cmd +++ b/Drivers/Auto Detect - Toshiba.cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch echo Waiting for software installation to finish... @@ -30,6 +21,7 @@ start "" "http://support.toshiba.com/drivers" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Drivers/GPU - AMD.cmd b/Drivers/GPU - AMD.cmd index ff279924..c54564dc 100644 --- a/Drivers/GPU - AMD.cmd +++ b/Drivers/GPU - AMD.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\_Drivers" "AMD Autodetect.exe" "" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Drivers/GPU - Gaming Evolved (AMD).cmd b/Drivers/GPU - Gaming Evolved (AMD).cmd deleted file mode 100644 index 15023b5a..00000000 --- a/Drivers/GPU - Gaming Evolved (AMD).cmd +++ /dev/null @@ -1,39 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner -:FindBinDone -popd -if not defined bin goto ErrorNoBin - -:Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%\_Drivers" "AMD Gaming Evolved.exe" "" -goto Exit - -:ErrorNoBin -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Drivers/GPU - GeForce Experience.cmd b/Drivers/GPU - GeForce Experience.cmd deleted file mode 100644 index 65f3cc57..00000000 --- a/Drivers/GPU - GeForce Experience.cmd +++ /dev/null @@ -1,39 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner -:FindBinDone -popd -if not defined bin goto ErrorNoBin - -:Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%\_Drivers" "GeForce Experience.exe" "" -goto Exit - -:ErrorNoBin -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Drivers/GPU - NVIDIA.cmd b/Drivers/GPU - NVIDIA.cmd new file mode 100644 index 00000000..7a447c63 --- /dev/null +++ b/Drivers/GPU - NVIDIA.cmd @@ -0,0 +1,31 @@ +@echo off + +:Flags +for %%f in (%*) do ( + if /i "%%f" == "/DEBUG" (@echo on) +) + +:FindBin +set bin= & pushd "%~dp0" +:FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner +:FindBinDone +set "bin=%cd%\.bin" & popd + +:Launch +start "" "http://www.nvidia.com/Download/index.aspx?lang=en-us" +goto Exit + +:ErrorNoBin +popd +color 4e +echo ".bin" folder not found, aborting script. +echo. +echo Press any key to exit... +pause>nul +color +goto Exit + +:Exit diff --git a/Drivers/SSD - ExpressCache.cmd b/Drivers/SSD - ExpressCache.cmd index cb015203..2b25b405 100644 --- a/Drivers/SSD - ExpressCache.cmd +++ b/Drivers/SSD - ExpressCache.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\_Drivers" "SanDisk Express Cache.exe" "" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Drivers/SSD - Intel.cmd b/Drivers/SSD - Intel.cmd index 381a4102..5a93cb0e 100644 --- a/Drivers/SSD - Intel.cmd +++ b/Drivers/SSD - Intel.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\_Drivers" "Intel SSD Toolbox.exe" "" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Drivers/SSD - Samsung.cmd b/Drivers/SSD - Samsung.cmd index eb3b56ae..4c7c9e75 100644 --- a/Drivers/SSD - Samsung.cmd +++ b/Drivers/SSD - Samsung.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\_Drivers" "Samsung Magician.exe" "" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Enter SafeMode.cmd b/Enter SafeMode.cmd index 8d70a370..1c4885ba 100644 --- a/Enter SafeMode.cmd +++ b/Enter SafeMode.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" PSScript "%bin%\Scripts" "enter_safemode.ps1" /admin goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Exit SafeMode.cmd b/Exit SafeMode.cmd index 98304eb9..2b5429e2 100644 --- a/Exit SafeMode.cmd +++ b/Exit SafeMode.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" PSScript "%bin%\Scripts" "exit_safemode.ps1" /admin goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Final Checklist.cmd b/Final Checklist.cmd index e183f8d5..f4191c65 100644 --- a/Final Checklist.cmd +++ b/Final Checklist.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch -call "%bin%\Scripts\Launch.cmd" PSScript "%bin%\Scripts" "checklist.ps1" /admin +call "%bin%\Scripts\Launch.cmd" PSScript "%bin%\Scripts" "final_checklist.ps1" /admin goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Installers/Extras/Office/2007/2007 Microsoft Office system (SP3).cmd b/Installers/Extras/Office/2007/2007 Microsoft Office system (SP3).cmd index 75e55ee8..c55c8be5 100644 --- a/Installers/Extras/Office/2007/2007 Microsoft Office system (SP3).cmd +++ b/Installers/Extras/Office/2007/2007 Microsoft Office system (SP3).cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\2007 Microsoft Office system (SP3)" @@ -29,6 +20,7 @@ call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\2007 Microsoft Offi goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Installers/Extras/Office/2007/Access 2007 (SP3).cmd b/Installers/Extras/Office/2007/Access 2007 (SP3).cmd index 2e89162b..85474c41 100644 --- a/Installers/Extras/Office/2007/Access 2007 (SP3).cmd +++ b/Installers/Extras/Office/2007/Access 2007 (SP3).cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\Access 2007 (SP3)" @@ -29,6 +20,7 @@ call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\Access 2007 (SP3)" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Installers/Extras/Office/2007/AccessRuntime2007.cmd b/Installers/Extras/Office/2007/AccessRuntime2007.cmd index ae17aa1e..e5d3c8a0 100644 --- a/Installers/Extras/Office/2007/AccessRuntime2007.cmd +++ b/Installers/Extras/Office/2007/AccessRuntime2007.cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\AccessRuntime2007.exe" @@ -29,6 +20,7 @@ call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\AccessRuntime2007.e goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Installers/Extras/Office/2007/Home and Student 2007 (SP3).cmd b/Installers/Extras/Office/2007/Home and Student 2007 (SP3).cmd index aa2e5228..314579ee 100644 --- a/Installers/Extras/Office/2007/Home and Student 2007 (SP3).cmd +++ b/Installers/Extras/Office/2007/Home and Student 2007 (SP3).cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\Home and Student 2007 (SP3)" @@ -29,6 +20,7 @@ call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\Home and Student 20 goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Installers/Extras/Office/2007/Outlook 2007 (SP3).cmd b/Installers/Extras/Office/2007/Outlook 2007 (SP3).cmd index abd96542..4a37c3c4 100644 --- a/Installers/Extras/Office/2007/Outlook 2007 (SP3).cmd +++ b/Installers/Extras/Office/2007/Outlook 2007 (SP3).cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\Outlook 2007 (SP3)" @@ -29,6 +20,7 @@ call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\Outlook 2007 (SP3)" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Installers/Extras/Office/2007/Professional 2007 (SP3).cmd b/Installers/Extras/Office/2007/Professional 2007 (SP3).cmd index 09706022..b92ceec5 100644 --- a/Installers/Extras/Office/2007/Professional 2007 (SP3).cmd +++ b/Installers/Extras/Office/2007/Professional 2007 (SP3).cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\Professional 2007 (SP3)" @@ -29,6 +20,7 @@ call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\Professional 2007 ( goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Installers/Extras/Office/2007/Publisher 2007 (SP3).cmd b/Installers/Extras/Office/2007/Publisher 2007 (SP3).cmd index 3b40b3df..fa7c0d8f 100644 --- a/Installers/Extras/Office/2007/Publisher 2007 (SP3).cmd +++ b/Installers/Extras/Office/2007/Publisher 2007 (SP3).cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\Publisher 2007 (SP3)" @@ -29,6 +20,7 @@ call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\Publisher 2007 (SP3 goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Installers/Extras/Office/2007/Small Business 2007 (SP3).cmd b/Installers/Extras/Office/2007/Small Business 2007 (SP3).cmd index 96396082..994eb95a 100644 --- a/Installers/Extras/Office/2007/Small Business 2007 (SP3).cmd +++ b/Installers/Extras/Office/2007/Small Business 2007 (SP3).cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\Small Business 2007 (SP3)" @@ -29,6 +20,7 @@ call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2007\Small Business 2007 goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Installers/Extras/Office/2010/Outlook 2010 (SP2) (x32).cmd b/Installers/Extras/Office/2010/Outlook 2010 (SP2) (x32).cmd index 79488c23..00eec8da 100644 --- a/Installers/Extras/Office/2010/Outlook 2010 (SP2) (x32).cmd +++ b/Installers/Extras/Office/2010/Outlook 2010 (SP2) (x32).cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2010\Outlook 2010 (SP2) (x32)" @@ -29,6 +20,7 @@ call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2010\Outlook 2010 (SP2) goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Installers/Extras/Office/2010/Outlook 2010 (SP2) (x64).cmd b/Installers/Extras/Office/2010/Outlook 2010 (SP2) (x64).cmd index f9cff6e8..2367166f 100644 --- a/Installers/Extras/Office/2010/Outlook 2010 (SP2) (x64).cmd +++ b/Installers/Extras/Office/2010/Outlook 2010 (SP2) (x64).cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2010\Outlook 2010 (SP2) (x64)" @@ -29,6 +20,7 @@ call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2010\Outlook 2010 (SP2) goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Installers/Extras/Office/2010/Professional Plus 2010 (SP2).cmd b/Installers/Extras/Office/2010/Professional Plus 2010 (SP2).cmd index dc48db57..f5c69563 100644 --- a/Installers/Extras/Office/2010/Professional Plus 2010 (SP2).cmd +++ b/Installers/Extras/Office/2010/Professional Plus 2010 (SP2).cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2010\Professional Plus 2010 (SP2)" @@ -29,6 +20,7 @@ call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2010\Professional Plus 2 goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Installers/Extras/Office/2010/Publisher 2010 (SP2).cmd b/Installers/Extras/Office/2010/Publisher 2010 (SP2).cmd index f48c6c56..20c21467 100644 --- a/Installers/Extras/Office/2010/Publisher 2010 (SP2).cmd +++ b/Installers/Extras/Office/2010/Publisher 2010 (SP2).cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2010\Publisher 2010 (SP2)" @@ -29,6 +20,7 @@ call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2010\Publisher 2010 (SP2 goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Installers/Extras/Office/2010/Single Image 2010 (SP2).cmd b/Installers/Extras/Office/2010/Single Image 2010 (SP2).cmd index b664cb9f..2017c15c 100644 --- a/Installers/Extras/Office/2010/Single Image 2010 (SP2).cmd +++ b/Installers/Extras/Office/2010/Single Image 2010 (SP2).cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2010\Single Image 2010 (SP2)" @@ -29,6 +20,7 @@ call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2010\Single Image 2010 ( goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Installers/Extras/Office/2013/Home and Business 2013.cmd b/Installers/Extras/Office/2013/Home and Business 2013.cmd index 31631733..336ccd0a 100644 --- a/Installers/Extras/Office/2013/Home and Business 2013.cmd +++ b/Installers/Extras/Office/2013/Home and Business 2013.cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2013\Home and Business 2013" @@ -29,6 +20,7 @@ call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2013\Home and Business 2 goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Installers/Extras/Office/2013/Home and Student 2013.cmd b/Installers/Extras/Office/2013/Home and Student 2013.cmd index 2b1413e0..3a679d3e 100644 --- a/Installers/Extras/Office/2013/Home and Student 2013.cmd +++ b/Installers/Extras/Office/2013/Home and Student 2013.cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2013\Home and Student 2013" @@ -29,6 +20,7 @@ call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2013\Home and Student 20 goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Installers/Extras/Office/2013/Professional Plus 2013.cmd b/Installers/Extras/Office/2013/Professional Plus 2013.cmd index c193913e..d5a14822 100644 --- a/Installers/Extras/Office/2013/Professional Plus 2013.cmd +++ b/Installers/Extras/Office/2013/Professional Plus 2013.cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2013\Professional Plus 2013" @@ -29,6 +20,7 @@ call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2013\Professional Plus 2 goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Installers/Extras/Office/2016/Home and Business 2016.cmd b/Installers/Extras/Office/2016/Home and Business 2016.cmd index 54073827..b78c2fdc 100644 --- a/Installers/Extras/Office/2016/Home and Business 2016.cmd +++ b/Installers/Extras/Office/2016/Home and Business 2016.cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2016\Home and Business 2016" @@ -29,6 +20,7 @@ call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2016\Home and Business 2 goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Installers/Extras/Office/2016/Home and Student 2016.cmd b/Installers/Extras/Office/2016/Home and Student 2016.cmd index 1c266f16..29a1c8f6 100644 --- a/Installers/Extras/Office/2016/Home and Student 2016.cmd +++ b/Installers/Extras/Office/2016/Home and Student 2016.cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2016\Home and Student 2016" @@ -29,6 +20,7 @@ call "%bin%\Scripts\Launch.cmd" Office "%bin%\Scripts" "2016\Home and Student 20 goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Installers/SW Bundle.cmd b/Installers/SW Bundle.cmd new file mode 100644 index 00000000..ebd09227 --- /dev/null +++ b/Installers/SW Bundle.cmd @@ -0,0 +1,31 @@ +@echo off + +:Flags +for %%f in (%*) do ( + if /i "%%f" == "/DEBUG" (@echo on) +) + +:FindBin +set bin= & pushd "%~dp0" +:FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner +:FindBinDone +set "bin=%cd%\.bin" & popd + +:Launch +call "%bin%\Scripts\Launch.cmd" PyScript "%bin%\Scripts" "install_sw_bundle.py" /admin +goto Exit + +:ErrorNoBin +popd +color 4e +echo ".bin" folder not found, aborting script. +echo. +echo Press any key to exit... +pause>nul +color +goto Exit + +:Exit diff --git a/Misc/Cmder (as ADMIN).cmd b/Misc/Cmder (as ADMIN).cmd deleted file mode 100644 index 301da954..00000000 --- a/Misc/Cmder (as ADMIN).cmd +++ /dev/null @@ -1,39 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner -:FindBinDone -popd -if not defined bin goto ErrorNoBin - -:Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%\cmder_mini" "Cmder.exe" "" /admin -goto Exit - -:ErrorNoBin -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Misc/Cmder.cmd b/Misc/Cmder.cmd deleted file mode 100644 index 24d3a47e..00000000 --- a/Misc/Cmder.cmd +++ /dev/null @@ -1,39 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner -:FindBinDone -popd -if not defined bin goto ErrorNoBin - -:Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%\cmder_mini" "Cmder.exe" "" -goto Exit - -:ErrorNoBin -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Misc/ConEmu (as ADMIN).cmd b/Misc/ConEmu (as ADMIN).cmd new file mode 100644 index 00000000..82810040 --- /dev/null +++ b/Misc/ConEmu (as ADMIN).cmd @@ -0,0 +1,31 @@ +@echo off + +:Flags +for %%f in (%*) do ( + if /i "%%f" == "/DEBUG" (@echo on) +) + +:FindBin +set bin= & pushd "%~dp0" +:FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner +:FindBinDone +set "bin=%cd%\.bin" & popd + +:Launch +call "%bin%\Scripts\Launch.cmd" Program "%bin%\ConEmu" "ConEmu.exe" "" /admin +goto Exit + +:ErrorNoBin +popd +color 4e +echo ".bin" folder not found, aborting script. +echo. +echo Press any key to exit... +pause>nul +color +goto Exit + +:Exit diff --git a/Misc/ConEmu.cmd b/Misc/ConEmu.cmd new file mode 100644 index 00000000..a1ad3c34 --- /dev/null +++ b/Misc/ConEmu.cmd @@ -0,0 +1,31 @@ +@echo off + +:Flags +for %%f in (%*) do ( + if /i "%%f" == "/DEBUG" (@echo on) +) + +:FindBin +set bin= & pushd "%~dp0" +:FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner +:FindBinDone +set "bin=%cd%\.bin" & popd + +:Launch +call "%bin%\Scripts\Launch.cmd" Program "%bin%\ConEmu" "ConEmu.exe" "" +goto Exit + +:ErrorNoBin +popd +color 4e +echo ".bin" folder not found, aborting script. +echo. +echo Press any key to exit... +pause>nul +color +goto Exit + +:Exit diff --git a/Misc/DeviceRemover.cmd b/Misc/DeviceRemover.cmd index f5e611d3..dc4b1cc9 100644 --- a/Misc/DeviceRemover.cmd +++ b/Misc/DeviceRemover.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%" "DeviceRemover.exe" "" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Misc/Explorer++.cmd b/Misc/Explorer++.cmd index 33177709..c82029bc 100644 --- a/Misc/Explorer++.cmd +++ b/Misc/Explorer++.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\Explorer++" "Explorer++.exe" "%userprofile%" /max goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Misc/Fix Missing Optical Drive.reg b/Misc/Fix Missing Optical Drive.reg new file mode 100644 index 00000000..41828295 --- /dev/null +++ b/Misc/Fix Missing Optical Drive.reg @@ -0,0 +1,6 @@ +Windows Registry Editor Version 5.00 + +;Delete entries acording to http://support.microsoft.com/kb/314060 +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E965-E325-11CE-BFC1-08002BE10318}] +"UpperFilters"=- +"LowerFilters"=- \ No newline at end of file diff --git a/Misc/Notepad2.cmd b/Misc/Notepad2.cmd index 0aba4152..2b4f9bfd 100644 --- a/Misc/Notepad2.cmd +++ b/Misc/Notepad2.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\Notepad2" "Notepad2-Mod.exe" "" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Diagnostics/OutlookAttachView (as ADMIN).cmd b/Misc/OutlookAttachView (as ADMIN).cmd similarity index 72% rename from Diagnostics/OutlookAttachView (as ADMIN).cmd rename to Misc/OutlookAttachView (as ADMIN).cmd index 442a5610..68ee96f5 100644 --- a/Diagnostics/OutlookAttachView (as ADMIN).cmd +++ b/Misc/OutlookAttachView (as ADMIN).cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Init setlocal enabledelayedexpansion @@ -29,7 +20,7 @@ setlocal enabledelayedexpansion :Extract mkdir "%bin%\tmp" >nul 2>&1 call "%bin%\Scripts\Launch.cmd" Program "%bin%" "%bin%\7-Zip\7za.exe" "x OutlookAttachView.7z -otmp -aoa -pAbracadabra -bsp0 -bso0" /wait -ping -n 1 127.0.0.1>nul +ping -n 2 127.0.0.1>nul :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\tmp" "OutlookAttachView.exe" "" /admin @@ -40,6 +31,7 @@ endlocal goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Diagnostics/OutlookAttachView.cmd b/Misc/OutlookAttachView.cmd similarity index 72% rename from Diagnostics/OutlookAttachView.cmd rename to Misc/OutlookAttachView.cmd index b1c70bb6..e4f0af88 100644 --- a/Diagnostics/OutlookAttachView.cmd +++ b/Misc/OutlookAttachView.cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Init setlocal enabledelayedexpansion @@ -29,7 +20,7 @@ setlocal enabledelayedexpansion :Extract mkdir "%bin%\tmp" >nul 2>&1 call "%bin%\Scripts\Launch.cmd" Program "%bin%" "%bin%\7-Zip\7za.exe" "x OutlookAttachView.7z -otmp -aoa -pAbracadabra -bsp0 -bso0" /wait -ping -n 1 127.0.0.1>nul +ping -n 2 127.0.0.1>nul :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\tmp" "OutlookAttachView.exe" "" @@ -40,6 +31,7 @@ endlocal goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Misc/PerfMonitor2.cmd b/Misc/PerfMonitor2.cmd index 0542e7cd..3aa4168b 100644 --- a/Misc/PerfMonitor2.cmd +++ b/Misc/PerfMonitor2.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\PerfMonitor2" "PerfMonitor2.exe" "" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Misc/Q-Dir.cmd b/Misc/Q-Dir.cmd new file mode 100644 index 00000000..3c4daa41 --- /dev/null +++ b/Misc/Q-Dir.cmd @@ -0,0 +1,31 @@ +@echo off + +:Flags +for %%f in (%*) do ( + if /i "%%f" == "/DEBUG" (@echo on) +) + +:FindBin +set bin= & pushd "%~dp0" +:FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner +:FindBinDone +set "bin=%cd%\.bin" & popd + +:Launch +call "%bin%\Scripts\Launch.cmd" Program "%bin%\Q-Dir" "Q-Dir.exe" "%userprofile%" /max +goto Exit + +:ErrorNoBin +popd +color 4e +echo ".bin" folder not found, aborting script. +echo. +echo Press any key to exit... +pause>nul +color +goto Exit + +:Exit diff --git a/Misc/SysinternalsSuite.cmd b/Misc/SysinternalsSuite.cmd index 16409fc9..49b0462f 100644 --- a/Misc/SysinternalsSuite.cmd +++ b/Misc/SysinternalsSuite.cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :OpenFolder cd /d %~dp0 @@ -29,6 +20,7 @@ start "" "explorer.exe" "%bin%\SysinternalsSuite" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Misc/WinDirStat.cmd b/Misc/WinDirStat.cmd index 6ce9c942..938f0e8d 100644 --- a/Misc/WinDirStat.cmd +++ b/Misc/WinDirStat.cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :ModifySettings reg add HKCU\Software\Seifert\WinDirStat\options /v followJunctionPoints /t REG_DWORD /d 0 /f >nul @@ -42,6 +33,7 @@ call "%bin%\Scripts\Launch.cmd" Program "%bin%\WinDirStat" "windirstat.exe" "" / goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Misc/XMPlay.cmd b/Misc/XMPlay.cmd index 34de8e67..7baefd6c 100644 --- a/Misc/XMPlay.cmd +++ b/Misc/XMPlay.cmd @@ -6,34 +6,27 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :RestoreDefaults del "xmplay.library" del "xmplay.library~" del "xmplay.pls" call "%bin%\Scripts\Launch.cmd" Program "%bin%\XMPlay" "%bin%\7-Zip\7za.exe" "e defaults.7z -aoa -bsp0 -bso0" +ping -n 2 127.0.0.1>nul :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\XMPlay" "xmplay.exe" "music.7z" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Misc/_Update Kit.cmd b/Misc/_Update Kit.cmd index 5dfd7ba3..b430d0ce 100644 --- a/Misc/_Update Kit.cmd +++ b/Misc/_Update Kit.cmd @@ -6,28 +6,27 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch -call "%bin%\Scripts\Launch.cmd" PSScript "%bin%\Scripts" "update_tools.ps1" +:: Because this script does not have delayed expansion enabled the '!python!' +:: below is passed verbatim to the Launch.cmd script. This results in +:: Launch.cmd resolving the variable instead. By overriding Launch.cmd in this +:: way we gain two things. First, we take advantage of Launch.cmd's ability to +:: use x64 python if possible. Second, by using the native terminal emulator we +:: avoid the issue in ConEmu where rewriting the same line causes major +:: slowdowns; it can be 5 to 30 times slower than normal. +call "%bin%\Scripts\Launch.cmd" Program "%bin%\Scripts" "!python!" "update_kit.py" /max goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Repairs/AdwCleaner.cmd b/Repairs/AdwCleaner.cmd index b15718dc..865e4915 100644 --- a/Repairs/AdwCleaner.cmd +++ b/Repairs/AdwCleaner.cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Copy set "prog=AdwCleaner.exe" @@ -33,6 +24,7 @@ call "%bin%\Scripts\Launch.cmd" Program "%bin%\tmp" "%prog%" "" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Repairs/Autoruns.cmd b/Repairs/Autoruns.cmd index d20eb876..2157e18a 100644 --- a/Repairs/Autoruns.cmd +++ b/Repairs/Autoruns.cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :ModifySettings reg add HKCU\Software\Sysinternals\AutoRuns /v checkvirustotal /t REG_DWORD /d 0 /f >nul @@ -40,6 +31,7 @@ call "%bin%\Scripts\Launch.cmd" Program "%bin%\SysinternalsSuite" "Autoruns.exe" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Repairs/CHKDSK (Fix).cmd b/Repairs/CHKDSK (Fix).cmd index 1179aaa8..6e36ac7e 100644 --- a/Repairs/CHKDSK (Fix).cmd +++ b/Repairs/CHKDSK (Fix).cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" PSScript "%bin%\Scripts" "check_disk_fix.ps1" /admin goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Repairs/CHKDSK.cmd b/Repairs/CHKDSK.cmd index 5ce89fad..ca3f4eb0 100644 --- a/Repairs/CHKDSK.cmd +++ b/Repairs/CHKDSK.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" PSScript "%bin%\Scripts" "check_disk.ps1" /admin goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Repairs/Complete Internet Repair.cmd b/Repairs/Complete Internet Repair.cmd index 39f0d5b4..77ff23ea 100644 --- a/Repairs/Complete Internet Repair.cmd +++ b/Repairs/Complete Internet Repair.cmd @@ -6,26 +6,17 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd -:WKInfo -rem Create WK\Info\YYYY-MM-DD and set path as %log_dir% -call "%bin%\Scripts\wk_info.cmd" +:Init +rem Create %client_dir%\Info\YYYY-MM-DD and set path as %log_dir% +call "%bin%\Scripts\init_client_dir.cmd" /Info :LaunchERUNT rem Backup registry first @@ -39,6 +30,7 @@ call "%bin%\Scripts\Launch.cmd" Program "%bin%\Complete Internet Repair" "ComInt goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Repairs/DISM.cmd b/Repairs/DISM.cmd index b9dd7e24..7070f8b4 100644 --- a/Repairs/DISM.cmd +++ b/Repairs/DISM.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" PSScript "%bin%\Scripts" "dism.ps1" "" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Repairs/ESET & KVRT.cmd b/Repairs/ESET & KVRT.cmd index ea4b0f17..bbf3c034 100644 --- a/Repairs/ESET & KVRT.cmd +++ b/Repairs/ESET & KVRT.cmd @@ -6,25 +6,18 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd -:CreateQuarantineDir -set "q_dir=%systemdrive%\WK\Quarantine\KVRT" +:Init +rem Set %client_dir% +call "%bin%\Scripts\init_client_dir.cmd" /Quarantine +set "q_dir=%client_dir%\Quarantine\KVRT" mkdir "%q_dir%">nul 2>&1 :Launch @@ -33,6 +26,7 @@ call "%bin%\Scripts\Launch.cmd" Program "%bin%" "KVRT.exe" "-accepteula -d %q_di goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Repairs/JRT.cmd b/Repairs/JRT.cmd index bdbd5c1c..15d11020 100644 --- a/Repairs/JRT.cmd +++ b/Repairs/JRT.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%" "JRT.exe" "" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Repairs/MBAM.cmd b/Repairs/MBAM.cmd index 374667ff..6aaa6c5b 100644 --- a/Repairs/MBAM.cmd +++ b/Repairs/MBAM.cmd @@ -6,25 +6,16 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Install -call "%bin%\Scripts\Launch.cmd" Program "%bin%" "MBAM.exe" "" /wait +call "%bin%\Scripts\Launch.cmd" Program "%bin%\..\Installers\Extras\Security" "Malwarebytes Anti-Malware.exe" "" /wait :Launch if exist "%programfiles%\Malwarebytes Anti-Malware\mbam.exe" (call "%bin%\Scripts\Launch.cmd" Program "%programfiles%\Malwarebytes Anti-Malware" "mbam.exe" "") @@ -32,6 +23,7 @@ if exist "%programfiles(x86)%\Malwarebytes Anti-Malware\mbam.exe" (call "%bin%\S goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Repairs/RKill.cmd b/Repairs/RKill.cmd index 7e0fa97a..3b80387b 100644 --- a/Repairs/RKill.cmd +++ b/Repairs/RKill.cmd @@ -6,27 +6,18 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Init setlocal EnableDelayedExpansion color 1b -title WK Launcher +title Wizard Kit: Launcher :CheckHardLinks pushd "%bin%\RKill" @@ -35,9 +26,9 @@ for %%r in (explorer.exe iExplore.exe RKill.com RKill.scr uSeRiNiT.exe WiNlOgOn. ) popd -:WKInfo -rem Create WK\Info\YYYY-MM-DD and set path as !log_dir! -call "%bin%\Scripts\wk_info.cmd" +:CreateInfoDir +rem Create %client_dir%\Info\YYYY-MM-DD and set path as !log_dir! +call "%bin%\Scripts\init_client_dir.cmd" /Info :RKill echo Scanning system with RKill... @@ -71,6 +62,7 @@ color goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Repairs/SAS (Deprecated).cmd b/Repairs/SAS (Deprecated).cmd index 7c0391e1..5c23e464 100644 --- a/Repairs/SAS (Deprecated).cmd +++ b/Repairs/SAS (Deprecated).cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Install call "%bin%\Scripts\Launch.cmd" Program "%bin%" "SAS.exe" "" /wait @@ -31,6 +22,7 @@ call "%~dp0\..\.bin\Scripts\Launch.cmd" Program "%programfiles%\SUPERAntiSpyware goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Repairs/SFC Scan.cmd b/Repairs/SFC Scan.cmd index b8fb4448..da8082fe 100644 --- a/Repairs/SFC Scan.cmd +++ b/Repairs/SFC Scan.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Console "%bin%\Scripts" "sfc_scan.cmd" /admin goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Repairs/Shortcut Cleaner (Testing).cmd b/Repairs/Shortcut Cleaner.cmd similarity index 63% rename from Repairs/Shortcut Cleaner (Testing).cmd rename to Repairs/Shortcut Cleaner.cmd index 0b779975..54c490bd 100644 --- a/Repairs/Shortcut Cleaner (Testing).cmd +++ b/Repairs/Shortcut Cleaner.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%" "Shortcut Cleaner.exe" "" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Repairs/TDSSKiller.cmd b/Repairs/TDSSKiller.cmd index e9cd3264..439f6fa3 100644 --- a/Repairs/TDSSKiller.cmd +++ b/Repairs/TDSSKiller.cmd @@ -6,37 +6,29 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd + +:Init +rem Create %client_dir%\Info\YYYY-MM-DD and set path as %log_dir% +call "%bin%\Scripts\init_client_dir.cmd" /Info /Quarantine :CreateQuarantineDir -set "q_dir=%systemdrive%\WK\Quarantine\TDSSKiller" +set "q_dir=%client_dir%\Quarantine\TDSSKiller" mkdir "%q_dir%">nul 2>&1 -:WKInfo -rem Create WK\Info\YYYY-MM-DD and set path as %log_dir% -call "%bin%\Scripts\wk_info.cmd" - :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%" "TDSSKiller.exe" "-l %log_dir%\TDSSKiller.log -qpath %q_dir% -accepteula -accepteulaksn -dcexact -tdlfs" rem call "%bin%\Scripts\Launch.cmd" Program "%bin%" "TDSSKiller.exe" "-l %log_dir%\TDSSKiller.log -qpath %q_dir% -accepteula -accepteulaksn -dcexact -qsus -tdlfs" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Reset Browsers.cmd b/Reset Browsers.cmd index ef2e01e6..51743af1 100644 --- a/Reset Browsers.cmd +++ b/Reset Browsers.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" PSScript "%bin%\Scripts" "reset_browsers.ps1" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/SW Diagnostics.cmd b/SW Diagnostics.cmd index 5ff8545f..cd5edadf 100644 --- a/SW Diagnostics.cmd +++ b/SW Diagnostics.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch -call "%bin%\Scripts\Launch.cmd" PSScript "%bin%\Scripts" "diagnostics.ps1" /admin +call "%bin%\Scripts\Launch.cmd" PSScript "%bin%\Scripts" "sw_diagnostics.ps1" /admin goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Uninstallers/IObit Uninstaller.cmd b/Uninstallers/IObit Uninstaller.cmd index decc2a74..70b8da71 100644 --- a/Uninstallers/IObit Uninstaller.cmd +++ b/Uninstallers/IObit Uninstaller.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\IObitUninstaller" "IObitUninstaler.exe" "" /admin goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Uninstallers/MyUninstaller.cmd b/Uninstallers/MyUninstaller.cmd deleted file mode 100644 index 33706c24..00000000 --- a/Uninstallers/MyUninstaller.cmd +++ /dev/null @@ -1,39 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner -:FindBinDone -popd -if not defined bin goto ErrorNoBin - -:Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%\MyUninstaller" "myuninst.exe" "" -goto Exit - -:ErrorNoBin -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Uninstallers/PC Decrapifier (Deprecated).cmd b/Uninstallers/PC Decrapifier (Deprecated).cmd deleted file mode 100644 index 42ce7eb9..00000000 --- a/Uninstallers/PC Decrapifier (Deprecated).cmd +++ /dev/null @@ -1,39 +0,0 @@ -@echo off - -:Flags -for %%f in (%*) do ( - if /i "%%f" == "/DEBUG" (@echo on) -) - -:FindBin -set bin= -pushd "%~dp0" -:FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner -:FindBinDone -popd -if not defined bin goto ErrorNoBin - -:Launch -call "%bin%\Scripts\Launch.cmd" Program "%bin%\PC Decrapifier 2.2.8" "pc-decrapifier.exe" "" -goto Exit - -:ErrorNoBin -color 4e -echo ".bin" folder not found, aborting script. -echo. -echo Press any key to exit... -pause>nul -color -goto Exit - -:Exit diff --git a/Uninstallers/Removal Tools.cmd b/Uninstallers/Removal Tools.cmd index 07ef4276..d6a0aeca 100644 --- a/Uninstallers/Removal Tools.cmd +++ b/Uninstallers/Removal Tools.cmd @@ -6,22 +6,13 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch pushd "%bin%\_Removal Tools" @@ -30,6 +21,7 @@ popd goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo. diff --git a/Uninstallers/Revo Uninstaller.cmd b/Uninstallers/Revo Uninstaller.cmd index 33882f1a..f387d79f 100644 --- a/Uninstallers/Revo Uninstaller.cmd +++ b/Uninstallers/Revo Uninstaller.cmd @@ -6,28 +6,20 @@ for %%f in (%*) do ( ) :FindBin -set bin= -pushd "%~dp0" +set bin= & pushd "%~dp0" :FindBinInner -if exist ".bin" ( - set "bin=%cd%\.bin" - goto FindBinDone -) -if "%~d0\" == "%cd%" ( - goto FindBinDone -) else ( - cd .. -) -goto FindBinInner +if exist ".bin" goto FindBinDone +if "%~d0\" == "%cd%" goto ErrorNoBin +cd .. & goto FindBinInner :FindBinDone -popd -if not defined bin goto ErrorNoBin +set "bin=%cd%\.bin" & popd :Launch call "%bin%\Scripts\Launch.cmd" Program "%bin%\Revo Uninstaller" "Revouninstaller.exe" "" goto Exit :ErrorNoBin +popd color 4e echo ".bin" folder not found, aborting script. echo.