From 1822b7e9bf04efeb22cd01e58a7f999b8d2d3aed Mon Sep 17 00:00:00 2001 From: Alan Mason <@2Shirt> Date: Fri, 17 Nov 2017 00:55:27 -0700 Subject: [PATCH] 2016-12: Retroactive Updates * Removed SIV and switched back to AIDA64 * Bugfixes --- .bin/Scripts/functions.py | 2 + .bin/Scripts/reset_browsers.py | 72 +++++++---- .bin/Scripts/sw_checklist.py | 119 ++++++++++-------- .bin/Scripts/sw_diagnostics.py | 111 ++++++++-------- .bin/Scripts/user_data_transfer.py | 2 +- .../{AIDA64 (Deprecated).cmd => AIDA64.cmd} | 2 +- Diagnostics/Extras/HWiNFO (Summary).cmd | 119 ++++++++++++++++++ Diagnostics/{ => Extras}/HWiNFO.cmd | 0 Drivers/Acer.cmd | 12 +- Drivers/Lenovo.cmd | 12 +- Drivers/Toshiba.cmd | 12 +- 11 files changed, 304 insertions(+), 159 deletions(-) rename Diagnostics/{AIDA64 (Deprecated).cmd => AIDA64.cmd} (99%) create mode 100644 Diagnostics/Extras/HWiNFO (Summary).cmd rename Diagnostics/{ => Extras}/HWiNFO.cmd (100%) diff --git a/.bin/Scripts/functions.py b/.bin/Scripts/functions.py index 16f46cc0..e7dee7e2 100644 --- a/.bin/Scripts/functions.py +++ b/.bin/Scripts/functions.py @@ -920,6 +920,8 @@ def upload_data(path=None, file=None, vars_wk=None): with open('{TmpDir}\\psftp.batch'.format(**vars_wk), 'w', encoding='ascii') as f: f.write('lcd "{path}"\n'.format(path=path)) f.write('cd "{Share}"\n'.format(**CLIENT_INFO_SERVER)) + f.write('mkdir {ProduKey}'.format(**vars_wk)) + f.write('cd {ProduKey}'.format(**vars_wk)) f.write('put "{file}"\n'.format(file=file)) # Upload Info diff --git a/.bin/Scripts/reset_browsers.py b/.bin/Scripts/reset_browsers.py index 5381af7a..34bcc05c 100644 --- a/.bin/Scripts/reset_browsers.py +++ b/.bin/Scripts/reset_browsers.py @@ -187,7 +187,7 @@ def clean_internet_explorer(): pass def exit_script(): - # pause("Press Enter to exit...") + pause("Press Enter to exit...") quit() def get_chrome_exe(): @@ -210,10 +210,13 @@ def get_chrome_exe(): def get_chrome_profiles(): """Find any existing Chrome profiles and return as a list of os.DirEntry objects.""" profiles = [] - for entry in os.scandir('{LOCALAPPDATA}\\Google\\Chrome\\User Data'.format(**vars_wk['Env'])): - if entry.is_dir() and re.search(r'^(Default|Profile)', entry.name, re.IGNORECASE): - profiles.append(entry) - profiles = [p for p in profiles if not re.search(r'\.(wk|)bak.*', p.name, re.IGNORECASE)] + try: + for entry in os.scandir('{LOCALAPPDATA}\\Google\\Chrome\\User Data'.format(**vars_wk['Env'])): + if entry.is_dir() and re.search(r'^(Default|Profile)', entry.name, re.IGNORECASE): + profiles.append(entry) + profiles = [p for p in profiles if not re.search(r'\.(wk|)bak.*', p.name, re.IGNORECASE)] + except: + pass return profiles @@ -223,16 +226,18 @@ def get_chrome_canary_exe(): if os.path.exists(prog_exe): return prog_exe else: - print_error(' ERROR: chrome.exe not found. Please verify installation.', vars_wk['LogFile']) return None def get_chrome_canary_profiles(): """Find any existing Chrome profiles and return as a list of os.DirEntry objects.""" profiles = [] - for entry in os.scandir('{LOCALAPPDATA}\\Google\\Chrome SxS\\User Data'.format(**vars_wk['Env'])): - if entry.is_dir() and re.search(r'^(Default|Profile)', entry.name, re.IGNORECASE): - profiles.append(entry) - profiles = [p for p in profiles if not re.search(r'\.(wk|)bak.*', p.name, re.IGNORECASE)] + try: + for entry in os.scandir('{LOCALAPPDATA}\\Google\\Chrome SxS\\User Data'.format(**vars_wk['Env'])): + if entry.is_dir() and re.search(r'^(Default|Profile)', entry.name, re.IGNORECASE): + profiles.append(entry) + profiles = [p for p in profiles if not re.search(r'\.(wk|)bak.*', p.name, re.IGNORECASE)] + except: + pass return profiles @@ -276,10 +281,13 @@ def get_opera_exe(): def get_firefox_profiles(): """Find any existing Chrome profiles and return as a list of os.DirEntry objects.""" profiles = [] - for entry in os.scandir('{APPDATA}\\Mozilla\\Firefox\\Profiles'.format(**vars_wk['Env'])): - if entry.is_dir(): - profiles.append(entry) - profiles = [p for p in profiles if not re.search(r'\.(wk|)bak.*', p.name, re.IGNORECASE)] + try: + for entry in os.scandir('{APPDATA}\\Mozilla\\Firefox\\Profiles'.format(**vars_wk['Env'])): + if entry.is_dir(): + profiles.append(entry) + profiles = [p for p in profiles if not re.search(r'\.(wk|)bak.*', p.name, re.IGNORECASE)] + except: + pass return profiles @@ -323,27 +331,36 @@ def get_opera_dev_exe(): def get_opera_profile(): """Find an existing Opera profile and return as a length-1 list of os.DirEntry objects.""" profiles = [] - for entry in os.scandir('{APPDATA}\\Opera Software'.format(**vars_wk['Env'])): - if entry.is_dir() and entry.name == 'Opera Stable': - return [entry] + try: + for entry in os.scandir('{APPDATA}\\Opera Software'.format(**vars_wk['Env'])): + if entry.is_dir() and entry.name == 'Opera Stable': + return [entry] + except: + pass return profiles def get_opera_beta_profile(): """Find an existing Opera Beta profile and return as a length-1 list of os.DirEntry objects.""" profiles = [] - for entry in os.scandir('{APPDATA}\\Opera Software'.format(**vars_wk['Env'])): - if entry.is_dir() and entry.name == 'Opera Next': - return [entry] + try: + for entry in os.scandir('{APPDATA}\\Opera Software'.format(**vars_wk['Env'])): + if entry.is_dir() and entry.name == 'Opera Next': + return [entry] + except: + pass return profiles def get_opera_dev_profile(): """Find an existing Opera Dev profile and return as a length-1 list of os.DirEntry objects.""" profiles = [] - for entry in os.scandir('{APPDATA}\\Opera Software'.format(**vars_wk['Env'])): - if entry.is_dir() and entry.name == 'Opera Developer': - return [entry] + try: + for entry in os.scandir('{APPDATA}\\Opera Software'.format(**vars_wk['Env'])): + if entry.is_dir() and entry.name == 'Opera Developer': + return [entry] + except: + pass return profiles @@ -480,14 +497,15 @@ def reset_mozilla_firefox(): run_program(firefox_dev_exe, ['https://addons.mozilla.org/en-us/firefox/addon/ublock-origin/'], check=False) def reset_opera(): - print_standard(' Opera', vars_wk['LogFile']) opera_exe = get_opera_exe() profiles = get_opera_profile() # Bail early if opera_exe is None and len(profiles) == 0: - print_warning(' Opera not installed and no profiles found.') + # print_warning(' Opera not installed and no profiles found.') return + else: + print_standard(' Opera', vars_wk['LogFile']) if opera_exe is None: print_error(' ERROR: Opera not installed.', vars_wk['LogFile']) @@ -512,7 +530,7 @@ def reset_opera_beta(): # Bail early if opera_beta_exe is None and len(profiles) == 0: - print_error(' Opera Beta not installed and no profiles found.') + # print_error(' Opera Beta not installed and no profiles found.') return else: print_standard(' Opera Beta', vars_wk['LogFile']) @@ -540,7 +558,7 @@ def reset_opera_dev(): # Bail early if opera_dev_exe is None and len(profiles) == 0: - print_error(' Opera Dev not installed and no profiles found.') + # print_error(' Opera Dev not installed and no profiles found.') return else: print_standard(' Opera Dev', vars_wk['LogFile']) diff --git a/.bin/Scripts/sw_checklist.py b/.bin/Scripts/sw_checklist.py index c22edaa7..8c03ac7c 100644 --- a/.bin/Scripts/sw_checklist.py +++ b/.bin/Scripts/sw_checklist.py @@ -14,13 +14,13 @@ vars_wk = init_vars_wk() vars_wk.update(init_vars_os()) vars_wk['BackupDir'] = '{ClientDir}\\Backups\\{Date}'.format(**vars_wk) vars_wk['LogFile'] = '{LogDir}\\Software Checklist.log'.format(**vars_wk) +vars_wk['AIDA64'] = '{BinDir}\\AIDA64\\aida64.exe'.format(**vars_wk) vars_wk['AutoRuns'] = '{BinDir}\\SysinternalsSuite\\autoruns.exe'.format(**vars_wk) vars_wk['ERUNT'] = '{BinDir}\\erunt\\ERUNT.EXE'.format(**vars_wk) vars_wk['Everything'] = '{BinDir}\\Everything\\Everything.exe'.format(**vars_wk) vars_wk['HWiNFO'] = '{BinDir}\\HWiNFO\\HWiNFO.exe'.format(**vars_wk) vars_wk['Notepad2'] = '{BinDir}\\Notepad2\\Notepad2-Mod.exe'.format(**vars_wk) vars_wk['ProduKey'] = '{BinDir}\\ProduKey\\ProduKey.exe'.format(**vars_wk) -vars_wk['SIV'] = '{BinDir}\\SIV\\SIV.exe'.format(**vars_wk) vars_wk['SevenZip'] = '{BinDir}\\7-Zip\\7za.exe'.format(**vars_wk) vars_wk['XMPlay'] = '{BinDir}\\XMPlay\\xmplay.exe'.format(**vars_wk) if vars_wk['Arch'] == 64: @@ -29,7 +29,6 @@ if vars_wk['Arch'] == 64: vars_wk['HWiNFO'] = vars_wk['HWiNFO'].replace('.exe', '64.exe') vars_wk['Notepad2'] = vars_wk['Notepad2'].replace('.exe', '64.exe') vars_wk['ProduKey'] = vars_wk['ProduKey'].replace('.exe', '64.exe') - vars_wk['SIV'] = vars_wk['SIV'].replace('.exe', '64.exe') vars_wk['SevenZip'] = vars_wk['SevenZip'].replace('.exe', '64.exe') os.makedirs(vars_wk['LogDir'], exist_ok=True) @@ -86,12 +85,21 @@ def cleanup_adwcleaner(): print_error('ERROR: Failed to uninstall AdwCleaner.', vars_wk['LogFile']) def cleanup_desktop(): + #~#TODO (Pseudo-code) + #~#for d in drives: + #~# for user in os.scandir('{drive}\\Users'.format(drive=d)): + #~# if os.path.exists('{drive}\\Users\\{user}\\Desktop'.format(drive=d, user=user)): + #~# for entry in os.scandir('{drive}\\Users\\{user}\\Desktop'.format(drive=d, user=user)): + #~# # JRT, RKill, Shortcut cleaner + #~# if re.search(r'^((JRT|RKill).*|sc-cleaner)', entry.name, re.IGNORECASE): + #~# shutil.move(entry.path, '{ClientDir}\\Info\\{name}'.format(name=entry.name, **vars_wk)) print_info('* Checking Desktop for leftover files', vars_wk['LogFile']) os.makedirs('{ClientDir}\\Info'.format(**vars_wk), exist_ok=True) - for entry in os.scandir('{USERPROFILE}\\Desktop'.format(**vars_wk['Env'])): - # JRT, RKill, Shortcut cleaner - if re.search(r'^((JRT|RKill).*|sc-cleaner)', entry.name, re.IGNORECASE): - shutil.move(entry.path, '{ClientDir}\\Info\\{name}'.format(name=entry.name, **vars_wk)) + if os.path.exists('{USERPROFILE}\\Desktop'.format(**vars_wk['Env'])): + for entry in os.scandir('{USERPROFILE}\\Desktop'.format(**vars_wk['Env'])): + # JRT, RKill, Shortcut cleaner + if re.search(r'^((JRT|RKill).*|sc-cleaner)', entry.name, re.IGNORECASE): + shutil.move(entry.path, '{ClientDir}\\Info\\{name}'.format(name=entry.name, **vars_wk)) run_program('rmdir "{path}"'.format(path='{ClientDir}\\Info'.format(**vars_wk)), check=False, shell=True) def exit_script(): @@ -108,14 +116,18 @@ def get_battery_info(): def get_free_space(): print_info('* Free space', vars_wk['LogFile']) for drive in get_free_space_info(): - print_standard(' {} {}'.format(*drive)) + print_standard(' {} {}'.format(*drive), vars_wk['LogFile']) def get_installed_ram(): print_info('* Installed RAM', vars_wk['LogFile']) - with open ('{LogDir}\\RAM Information (SIV).txt'.format(**vars_wk), 'r', encoding='utf16') as f: + with open ('{LogDir}\\RAM Information (AIDA64).txt'.format(**vars_wk), 'r') as f: + _module = '' for line in f.readlines(): - if re.search(r'^Memory', line, re.IGNORECASE): - print_standard(' ' + line.strip(), vars_wk['LogFile']) + if re.search(r'Module Size', line, re.IGNORECASE): + _module = re.sub(r'\s*Module Size\s+(.*)\s+\(.*$', r' Module: \1', line.strip()) + if re.search(r'Memory Speed', line, re.IGNORECASE): + _module += re.sub(r'\s*Memory Speed\s+(.*)$', r' \1', line.strip()) + print_standard(_module, vars_wk['LogFile']) def get_os_info(): print_info('* Operating System', vars_wk['LogFile']) @@ -158,11 +170,11 @@ def get_os_info(): print_warning(' {Name} x{Arch} (unrecognized)'.format(**vars_wk), vars_wk['LogFile']) # OS Activation if re.search(r'permanent', vars_wk['Activation'], re.IGNORECASE): - print_standard(' {Activation}'.format(**vars_wk)) + print_standard(' {Activation}'.format(**vars_wk), vars_wk['LogFile']) elif re.search(r'unavailable', vars_wk['Activation'], re.IGNORECASE): - print_warning(' {Activation}'.format(**vars_wk)) + print_warning(' {Activation}'.format(**vars_wk), vars_wk['LogFile']) else: - print_error(' {Activation}'.format(**vars_wk)) + print_error(' {Activation}'.format(**vars_wk), vars_wk['LogFile']) def get_ticket_number(): """Get TicketNumber from user and save it in the info folder.""" @@ -214,53 +226,60 @@ def run_produkey(): _args = ['/nosavereg', '/stext', '{LogDir}\\Product Keys (ProduKey).txt'.format(**vars_wk)] run_program(vars_wk['ProduKey'], _args, check=False) -def run_siv(): - extract_item('SIV', vars_wk, silent=True) +def run_aida64(): + extract_item('AIDA64', vars_wk, silent=True) # All system info - if not os.path.exists('{LogDir}\\System Information (SIV).txt'.format(**vars_wk)): + if not os.path.exists('{LogDir}\\System Information (AIDA64).html'.format(**vars_wk)): print_info('* Saving System information', vars_wk['LogFile']) _cmd = [ - vars_wk['SIV'], - '-KEYS', - '-LOCAL', - '-UNICODE', - '-SAVE={LogDir}\\System_Information_(SIV).txt'.format(**vars_wk)] + vars_wk['AIDA64'], + '/R', + '{LogDir}\\System Information (AIDA64).html'.format(**vars_wk), + '/CUSTOM', + '{BinDir}\\AIDA64\\full.rpf'.format(**vars_wk), + '/HTML', + '/SILENT'] run_program(_cmd, check=False) # RAM - if not os.path.exists('{LogDir}\\RAM_Information_(SIV).txt'.format(**vars_wk)): - _args = [ - '-KEYS', - '-LOCAL', - '-UNICODE', - '-SAVE=[dimms]={LogDir}\\RAM_Information_(SIV).txt'.format(**vars_wk)] - run_program(vars_wk['SIV'], _args, check=False) + if not os.path.exists('{LogDir}\\RAM Information (AIDA64).txt'.format(**vars_wk)): + _cmd = [ + vars_wk['AIDA64'], + '/R', + '{LogDir}\\RAM Information (AIDA64).txt'.format(**vars_wk), + '/CUSTOM', + '{BinDir}\\AIDA64\\ram.rpf'.format(**vars_wk), + '/TEXT', + '/SILENT'] + run_program(_cmd, check=False) # Installed Programs - if not os.path.exists('{LogDir}\\Installed Program List_(SIV).txt'.format(**vars_wk)): + if not os.path.exists('{LogDir}\\Installed Program List (AIDA64).txt'.format(**vars_wk)): print_info('* Saving installed program list', vars_wk['LogFile']) - _args = [ - '-KEYS', - '-LOCAL', - '-UNICODE', - '-SAVE=[software]={LogDir}\\Installed_Program_List_(SIV).txt'.format(**vars_wk)] - run_program(vars_wk['SIV'], _args, check=False) + _cmd = [ + vars_wk['AIDA64'], + '/R', + '{LogDir}\\Installed Program List (AIDA64).txt'.format(**vars_wk), + '/CUSTOM', + '{BinDir}\\AIDA64\\installed_programs.rpf'.format(**vars_wk), + '/TEXT', + '/SILENT', + '/SAFEST'] + run_program(_cmd, check=False) # Product Keys - if not os.path.exists('{LogDir}\\Product Keys (SIV).txt'.format(**vars_wk)): + if not os.path.exists('{LogDir}\\Product Keys (AIDA64).txt'.format(**vars_wk)): print_info('* Saving product keys', vars_wk['LogFile']) - _args = [ - '-KEYS', - '-LOCAL', - '-UNICODE', - '-SAVE=[product-ids]={LogDir}\\Product_Keys_(SIV).txt'.format(**vars_wk)] - run_program(vars_wk['SIV'], _args, check=False) - extract_item('ProduKey', vars_wk, silent=True) - - # Rename files - for item in os.scandir(vars_wk['LogDir']): - if re.search(r'SIV', item.name, re.IGNORECASE): - shutil.move(item.path, item.path.replace('_', ' ').title().replace('Siv', 'SIV')) + _cmd = [ + vars_wk['AIDA64'], + '/R', + '{LogDir}\\Product Keys (AIDA64).txt'.format(**vars_wk), + '/CUSTOM', + '{BinDir}\\AIDA64\\licenses.rpf'.format(**vars_wk), + '/TEXT', + '/SILENT', + '/SAFEST'] + run_program(_cmd, check=False) def run_xmplay(): extract_item('XMPlay', vars_wk, silent=True) @@ -358,7 +377,7 @@ if __name__ == '__main__': update_clock() backup_power_plans() backup_registry() - run_siv() + run_aida64() run_produkey() ## System information ## @@ -388,7 +407,7 @@ if __name__ == '__main__': pause('Press Enter exit...') # Open log - extract_item('Notepad2', vars_wk) + extract_item('Notepad2', vars_wk, silent=True) subprocess.Popen([vars_wk['Notepad2'], vars_wk['LogFile']]) # Quit diff --git a/.bin/Scripts/sw_diagnostics.py b/.bin/Scripts/sw_diagnostics.py index 0ff6d62b..1fdb7c11 100644 --- a/.bin/Scripts/sw_diagnostics.py +++ b/.bin/Scripts/sw_diagnostics.py @@ -13,6 +13,7 @@ vars_wk = init_vars_wk() vars_wk.update(init_vars_os()) vars_wk['BackupDir'] = '{ClientDir}\\Backups\\{Date}'.format(**vars_wk) vars_wk['LogFile'] = '{LogDir}\\Software Diagnostics.log'.format(**vars_wk) +vars_wk['AIDA64'] = '{BinDir}\\AIDA64\\aida64.exe'.format(**vars_wk) vars_wk['AutoRuns'] = '{BinDir}\\SysinternalsSuite\\autoruns.exe'.format(**vars_wk) vars_wk['BleachBit'] = '{BinDir}\\BleachBit\\bleachbit_console.exe'.format(**vars_wk) vars_wk['ERUNT'] = '{BinDir}\\erunt\\ERUNT.EXE'.format(**vars_wk) @@ -20,7 +21,6 @@ vars_wk['Everything'] = '{BinDir}\\Everything\\Everything.exe'.format(**vars_wk) vars_wk['HitmanPro'] = '{BinDir}\\HitmanPro\\HitmanPro.exe'.format(**vars_wk) vars_wk['Notepad2'] = '{BinDir}\\Notepad2\\Notepad2-Mod.exe'.format(**vars_wk) vars_wk['ProduKey'] = '{BinDir}\\ProduKey\\ProduKey.exe'.format(**vars_wk) -vars_wk['SIV'] = '{BinDir}\\SIV\\SIV.exe'.format(**vars_wk) vars_wk['SevenZip'] = '{BinDir}\\7-Zip\\7za.exe'.format(**vars_wk) if vars_wk['Arch'] == 64: vars_wk['AutoRuns'] = vars_wk['AutoRuns'].replace('.exe', '64.exe') @@ -28,7 +28,6 @@ if vars_wk['Arch'] == 64: vars_wk['HitmanPro'] = vars_wk['HitmanPro'].replace('.exe', '64.exe') vars_wk['Notepad2'] = vars_wk['Notepad2'].replace('.exe', '64.exe') vars_wk['ProduKey'] = vars_wk['ProduKey'].replace('.exe', '64.exe') - vars_wk['SIV'] = vars_wk['SIV'].replace('.exe', '64.exe') vars_wk['SevenZip'] = vars_wk['SevenZip'].replace('.exe', '64.exe') os.makedirs(vars_wk['LogDir'], exist_ok=True) @@ -127,21 +126,25 @@ def get_battery_info(): def get_free_space(): print_info('* Free space', vars_wk['LogFile']) for drive in get_free_space_info(): - print_standard(' {} {}'.format(*drive)) + print_standard(' {} {}'.format(*drive), vars_wk['LogFile']) def get_installed_office(): print_info('* Installed Office programs', vars_wk['LogFile']) - with open ('{LogDir}\\Installed Program List (SIV).txt'.format(**vars_wk), 'r', encoding='utf16') as f: + with open ('{LogDir}\\Installed Program List (AIDA64).txt'.format(**vars_wk), 'r') as f: for line in sorted(f.readlines()): if re.search(r'(Microsoft (Office\s+(365|Enterprise|Home|Pro(\s|fessional)|Single|Small|Standard|Starter|Ultimate|system)|Works[-\s\d]+\d)|(Libre|Open|Star)\s*Office|WordPerfect|Gnumeric|Abiword)', line, re.IGNORECASE): - print_standard(' ' + line[18:96].strip(), vars_wk['LogFile']) + print_standard(' ' + line[4:82].strip(), vars_wk['LogFile']) def get_installed_ram(): print_info('* Installed RAM', vars_wk['LogFile']) - with open ('{LogDir}\\RAM Information (SIV).txt'.format(**vars_wk), 'r', encoding='utf16') as f: + with open ('{LogDir}\\RAM Information (AIDA64).txt'.format(**vars_wk), 'r') as f: + _module = '' for line in f.readlines(): - if re.search(r'^Memory', line, re.IGNORECASE): - print_standard(' ' + line.strip(), vars_wk['LogFile']) + if re.search(r'Module Size', line, re.IGNORECASE): + _module = re.sub(r'\s*Module Size\s+(.*)\s+\(.*$', r' Module: \1', line.strip()) + if re.search(r'Memory Speed', line, re.IGNORECASE): + _module += re.sub(r'\s*Memory Speed\s+(.*)$', r' \1', line.strip()) + print_standard(_module, vars_wk['LogFile']) def get_os_info(): print_info('* Operating System', vars_wk['LogFile']) @@ -184,11 +187,11 @@ def get_os_info(): print_warning(' {Name} x{Arch} (unrecognized)'.format(**vars_wk), vars_wk['LogFile']) # OS Activation if re.search(r'permanent', vars_wk['Activation'], re.IGNORECASE): - print_standard(' {Activation}'.format(**vars_wk)) + print_standard(' {Activation}'.format(**vars_wk), vars_wk['LogFile']) elif re.search(r'unavailable', vars_wk['Activation'], re.IGNORECASE): - print_warning(' {Activation}'.format(**vars_wk)) + print_warning(' {Activation}'.format(**vars_wk), vars_wk['LogFile']) else: - print_error(' {Activation}'.format(**vars_wk)) + print_error(' {Activation}'.format(**vars_wk), vars_wk['LogFile']) def get_product_keys(): print_info('* Product Keys', vars_wk['LogFile']) @@ -401,57 +404,65 @@ def run_rkill(): abort() # RKill cleanup - for item in os.scandir('{USERPROFILE}\\Desktop'.format(**vars_wk['Env'])): - if re.search(r'^RKill', item.name, re.IGNORECASE): - shutil.move(item.path, '{ClientDir}\\Info\\{name}'.format(name=item.name, **vars_wk)) + if os.path.exists('{USERPROFILE}\\Desktop'.format(**vars_wk['Env'])): + for item in os.scandir('{USERPROFILE}\\Desktop'.format(**vars_wk['Env'])): + if re.search(r'^RKill', item.name, re.IGNORECASE): + shutil.move(item.path, '{ClientDir}\\Info\\{name}'.format(name=item.name, **vars_wk)) -def run_siv(): - extract_item('SIV', vars_wk, silent=True) +def run_aida64(): + extract_item('AIDA64', vars_wk, silent=True) # All system info - if not os.path.exists('{LogDir}\\System Information (SIV).txt'.format(**vars_wk)): + if not os.path.exists('{LogDir}\\System Information (AIDA64).html'.format(**vars_wk)): print_info('* Saving System information', vars_wk['LogFile']) _cmd = [ - vars_wk['SIV'], - '-KEYS', - '-LOCAL', - '-UNICODE', - '-SAVE={LogDir}\\System_Information_(SIV).txt'.format(**vars_wk)] + vars_wk['AIDA64'], + '/R', + '{LogDir}\\System Information (AIDA64).html'.format(**vars_wk), + '/CUSTOM', + '{BinDir}\\AIDA64\\full.rpf'.format(**vars_wk), + '/HTML', + '/SILENT'] run_program(_cmd, check=False) # RAM - if not os.path.exists('{LogDir}\\RAM_Information_(SIV).txt'.format(**vars_wk)): - _args = [ - '-KEYS', - '-LOCAL', - '-UNICODE', - '-SAVE=[dimms]={LogDir}\\RAM_Information_(SIV).txt'.format(**vars_wk)] - run_program(vars_wk['SIV'], _args, check=False) + if not os.path.exists('{LogDir}\\RAM Information (AIDA64).txt'.format(**vars_wk)): + _cmd = [ + vars_wk['AIDA64'], + '/R', + '{LogDir}\\RAM Information (AIDA64).txt'.format(**vars_wk), + '/CUSTOM', + '{BinDir}\\AIDA64\\ram.rpf'.format(**vars_wk), + '/TEXT', + '/SILENT'] + run_program(_cmd, check=False) # Installed Programs - if not os.path.exists('{LogDir}\\Installed Program List_(SIV).txt'.format(**vars_wk)): + if not os.path.exists('{LogDir}\\Installed Program List (AIDA64).txt'.format(**vars_wk)): print_info('* Saving installed program list', vars_wk['LogFile']) - _args = [ - '-KEYS', - '-LOCAL', - '-UNICODE', - '-SAVE=[software]={LogDir}\\Installed_Program_List_(SIV).txt'.format(**vars_wk)] - run_program(vars_wk['SIV'], _args, check=False) + _cmd = [ + vars_wk['AIDA64'], + '/R', + '{LogDir}\\Installed Program List (AIDA64).txt'.format(**vars_wk), + '/CUSTOM', + '{BinDir}\\AIDA64\\installed_programs.rpf'.format(**vars_wk), + '/TEXT', + '/SILENT', + '/SAFEST'] + run_program(_cmd, check=False) # Product Keys - if not os.path.exists('{LogDir}\\Product Keys (SIV).txt'.format(**vars_wk)): + if not os.path.exists('{LogDir}\\Product Keys (AIDA64).txt'.format(**vars_wk)): print_info('* Saving product keys', vars_wk['LogFile']) - _args = [ - '-KEYS', - '-LOCAL', - '-UNICODE', - '-SAVE=[product-ids]={LogDir}\\Product_Keys_(SIV).txt'.format(**vars_wk)] - run_program(vars_wk['SIV'], _args, check=False) - extract_item('ProduKey', vars_wk, silent=True) - - # Rename files - for item in os.scandir(vars_wk['LogDir']): - if re.search(r'SIV', item.name, re.IGNORECASE): - shutil.move(item.path, item.path.replace('_', ' ').title().replace('Siv', 'SIV')) + _cmd = [ + vars_wk['AIDA64'], + '/R', + '{LogDir}\\Product Keys (AIDA64).txt'.format(**vars_wk), + '/CUSTOM', + '{BinDir}\\AIDA64\\licenses.rpf'.format(**vars_wk), + '/TEXT', + '/SILENT', + '/SAFEST'] + run_program(_cmd, check=False) def run_sfc_scan(): """Run SFC in a "split window" and report errors.""" @@ -544,7 +555,7 @@ if __name__ == '__main__': backup_power_plans() backup_registry() backup_browsers() - run_siv() + run_aida64() run_produkey() # Summary diff --git a/.bin/Scripts/user_data_transfer.py b/.bin/Scripts/user_data_transfer.py index 2dcb68f0..11901db4 100644 --- a/.bin/Scripts/user_data_transfer.py +++ b/.bin/Scripts/user_data_transfer.py @@ -89,7 +89,7 @@ def is_valid_image(item): run_program(_cmd) except subprocess.CalledProcessError: _valid = False - print_warning('WARNING: Image damaged.', vars_wk['LogFile']) + print_warning('WARNING: Image "{image}" damaged.'.format(image=item.name), vars_wk['LogFile']) time.sleep(2) return _valid diff --git a/Diagnostics/AIDA64 (Deprecated).cmd b/Diagnostics/AIDA64.cmd similarity index 99% rename from Diagnostics/AIDA64 (Deprecated).cmd rename to Diagnostics/AIDA64.cmd index c0b4b08d..68b6574f 100644 --- a/Diagnostics/AIDA64 (Deprecated).cmd +++ b/Diagnostics/AIDA64.cmd @@ -35,7 +35,7 @@ set L_ITEM=aida64.exe set L_ARGS= set L_7ZIP= set L_CHCK=True -set L_ELEV=True +set L_ELEV= set L_NCMD=True set L_WAIT= diff --git a/Diagnostics/Extras/HWiNFO (Summary).cmd b/Diagnostics/Extras/HWiNFO (Summary).cmd new file mode 100644 index 00000000..95841f73 --- /dev/null +++ b/Diagnostics/Extras/HWiNFO (Summary).cmd @@ -0,0 +1,119 @@ +:: Wizard Kit: Launcher Script :: +:: +:: This script works by setting env variables and then calling Launch.cmd +:: which inherits the variables. This bypasses batch file argument parsing +:: which is awful. +@echo off + +:Init +setlocal +title Wizard Kit: Launcher +call :CheckFlags %* +call :FindBin + +: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=1)>>"%bin%\HWiNFO\HWiNFO%%a.ini" +) + +:DefineLaunch +:: Set L_TYPE to one of these options: +:: Console, Folder, Office, Program, PSScript, or PyScript +:: Set L_PATH to the path to the program folder +:: NOTE: Launch.cmd will test for L_PATH in the following order: +:: 1: %cbin%\L_PATH.7z (which will be extracted to %bin%\L_PATH) +:: 2: %bin%\L_PATH +:: 3. %L_PATH% (i.e. treat L_PATH as an absolute path) +:: Set L_ITEM to one of the following: +:: 1. The filename of the item to launch +:: 2. The Office product to install +:: 3. '.' to open extracted folder +:: Set L_ARGS to include any necessary arguments (if any) +:: Set L_7ZIP to include any necessary arguments for extraction +:: Set L_CHCK to True to have Launch.cmd to stay open if an error is encountered +:: Set L_ELEV to True to launch with elevated permissions +:: Set L_NCMD to True to stay in the native console window +:: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted +set L_TYPE=Program +set L_PATH=HWiNFO +set L_ITEM=HWiNFO.exe +set L_ARGS= +set L_7ZIP= +set L_CHCK=True +set L_ELEV= +set L_NCMD=True +set L_WAIT= + +::::::::::::::::::::::::::::::::::::::::::: +:: Do not edit anything below this line! :: +::::::::::::::::::::::::::::::::::::::::::: + +:LaunchPrep +rem Verifies the environment before launching item +if not defined bin (goto ErrorNoBin) +if not exist "%bin%\Scripts\Launch.cmd" (goto ErrorLaunchCMDMissing) + +:Launch +rem Calls the Launch.cmd script using the variables defined above +call "%bin%\Scripts\Launch.cmd" || goto ErrorLaunchCMD +goto Exit + +:: Functions :: +:CheckFlags +rem Loops through all arguments to check for accepted flags +set DEBUG= +for %%f in (%*) do ( + if /i "%%f" == "/DEBUG" (@echo on & set "DEBUG=/DEBUG") +) +@exit /b 0 + +:FindBin +rem Checks the current directory and all parents for the ".bin" folder +rem NOTE: Has not been tested for UNC paths +set bin= +pushd "%~dp0" +:FindBinInner +if exist ".bin" (goto FindBinDone) +if "%~d0\" == "%cd%" (popd & @exit /b 1) +cd .. +goto FindBinInner +:FindBinDone +set "bin=%cd%\.bin" +set "cbin=%cd%\.cbin" +popd +@exit /b 0 + +:: Errors :: +:ErrorLaunchCMD +echo. +echo ERROR: Launch.cmd did not run correctly. Try using the /DEBUG flag? +goto Abort + +:ErrorLaunchCMDMissing +echo. +echo ERROR: Launch.cmd script not found. +goto Abort + +:ErrorNoBin +echo. +echo ERROR: ".bin" folder not found. +goto Abort + +:Abort +color 4e +echo Aborted. +echo. +echo Press any key to exit... +pause>nul +color +rem Set errorlevel to 1 by calling color incorrectly +color 00 +goto Exit + +:: Cleanup and exit :: +:Exit +endlocal +exit /b %errorlevel% \ No newline at end of file diff --git a/Diagnostics/HWiNFO.cmd b/Diagnostics/Extras/HWiNFO.cmd similarity index 100% rename from Diagnostics/HWiNFO.cmd rename to Diagnostics/Extras/HWiNFO.cmd diff --git a/Drivers/Acer.cmd b/Drivers/Acer.cmd index 9168025a..18282c07 100644 --- a/Drivers/Acer.cmd +++ b/Drivers/Acer.cmd @@ -11,14 +11,6 @@ title Wizard Kit: Launcher call :CheckFlags %* call :FindBin -: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" -) - :OpenDriverPage start "" "http://us.acer.com/ac/en/US/content/drivers" @@ -41,8 +33,8 @@ start "" "http://us.acer.com/ac/en/US/content/drivers" :: Set L_NCMD to True to stay in the native console window :: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted set L_TYPE=Program -set L_PATH=HWiNFO -set L_ITEM=HWiNFO.exe +set L_PATH=AIDA64 +set L_ITEM=aida64.exe set L_ARGS= set L_7ZIP= set L_CHCK=True diff --git a/Drivers/Lenovo.cmd b/Drivers/Lenovo.cmd index 0cb2ff1d..f82029e8 100644 --- a/Drivers/Lenovo.cmd +++ b/Drivers/Lenovo.cmd @@ -11,14 +11,6 @@ title Wizard Kit: Launcher call :CheckFlags %* call :FindBin -: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" -) - :OpenDriverPage start "" "http://support.lenovo.com/us/en/products?tabName=Downloads" @@ -41,8 +33,8 @@ start "" "http://support.lenovo.com/us/en/products?tabName=Downloads" :: Set L_NCMD to True to stay in the native console window :: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted set L_TYPE=Program -set L_PATH=HWiNFO -set L_ITEM=HWiNFO.exe +set L_PATH=AIDA64 +set L_ITEM=aida64.exe set L_ARGS= set L_7ZIP= set L_CHCK=True diff --git a/Drivers/Toshiba.cmd b/Drivers/Toshiba.cmd index b958fd40..f767bd32 100644 --- a/Drivers/Toshiba.cmd +++ b/Drivers/Toshiba.cmd @@ -11,14 +11,6 @@ title Wizard Kit: Launcher call :CheckFlags %* call :FindBin -: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" -) - :OpenDriverPage start "" "http://support.toshiba.com/drivers" @@ -41,8 +33,8 @@ start "" "http://support.toshiba.com/drivers" :: Set L_NCMD to True to stay in the native console window :: Set L_WAIT to True to have the script wait until L_ITEM has comlpeted set L_TYPE=Program -set L_PATH=HWiNFO -set L_ITEM=HWiNFO.exe +set L_PATH=AIDA64 +set L_ITEM=aida64.exe set L_ARGS= set L_7ZIP= set L_CHCK=True