Updated system checklist/diags and user checklits
* Added D7_MODE to limit functions run during d7II * Added new archive_all_users() function to be run in system_diagnostics
This commit is contained in:
parent
71297eacc8
commit
ed3323fffb
4 changed files with 139 additions and 68 deletions
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
from functions.common import *
|
||||
|
||||
from operator import itemgetter
|
||||
|
||||
# Define other_results for later try_and_print
|
||||
browser_data = {}
|
||||
other_results = {
|
||||
|
|
@ -98,11 +100,57 @@ SUPPORTED_BROWSERS = {
|
|||
},
|
||||
}
|
||||
|
||||
def archive_all_users():
|
||||
"""Create backups for all browsers for all users."""
|
||||
users_root = r'{}\Users'.format(global_vars['Env']['SYSTEMDRIVE'])
|
||||
user_envs = []
|
||||
|
||||
# Build list of valid users
|
||||
for user_name in os.listdir(users_root):
|
||||
valid_user = True
|
||||
if user_name in ('Default', 'Default User'):
|
||||
# Skip default users
|
||||
continue
|
||||
user_path = os.path.join(users_root, user_name)
|
||||
appdata_local = os.path.join(user_path, r'AppData\Local')
|
||||
appdata_roaming = os.path.join(user_path, r'AppData\Roaming')
|
||||
valid_user &= os.path.exists(appdata_local)
|
||||
valid_user &= os.path.exists(appdata_roaming)
|
||||
if valid_user:
|
||||
user_envs.append({
|
||||
'USERNAME': user_name,
|
||||
'USERPROFILE': user_path,
|
||||
'APPDATA': appdata_roaming,
|
||||
'LOCALAPPDATA': appdata_local})
|
||||
|
||||
# Backup browsers for all valid users
|
||||
print_info('Backing up browsers')
|
||||
for fake_env in sorted(user_envs, key=itemgetter('USERPROFILE')):
|
||||
print_standard(fake_env['USERNAME'])
|
||||
for b_k, b_v in sorted(SUPPORTED_BROWSERS.items()):
|
||||
if b_k == 'Mozilla Firefox Dev':
|
||||
continue
|
||||
source_path = b_v['user_data_path'].format(**fake_env)
|
||||
if not os.path.exists(source_path):
|
||||
continue
|
||||
source_items = source_path + '*'
|
||||
archive_path = r'{BackupDir}\Browsers ({USERNAME})'.format(
|
||||
**global_vars, **fake_env)
|
||||
os.makedirs(archive_path, exist_ok=True)
|
||||
archive_path += r'\{}.7z'.format(b_k)
|
||||
cmd = [
|
||||
global_vars['Tools']['SevenZip'],
|
||||
'a', '-aoa', '-bso0', '-bse0', '-mx=1',
|
||||
archive_path, source_items]
|
||||
try_and_print(message=' {}...'.format(b_k),
|
||||
function=run_program, cmd=cmd)
|
||||
print_standard(' ')
|
||||
|
||||
def archive_browser(name):
|
||||
"""Create backup of Browser saved in the BackupDir."""
|
||||
source = '{}*'.format(browser_data[name]['user_data_path'])
|
||||
dest = r'{BackupDir}\Browsers ({USERNAME})'.format(
|
||||
**global_vars, **global_vars['Env'])
|
||||
**global_vars, **env)
|
||||
archive = r'{}\{}.7z'.format(dest, name)
|
||||
os.makedirs(dest, exist_ok=True)
|
||||
cmd = [
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ from functions.setup import *
|
|||
init_global_vars()
|
||||
os.system('title {}: System Checklist Tool'.format(KIT_NAME_FULL))
|
||||
global_vars['LogFile'] = r'{LogDir}\System Checklist.log'.format(**global_vars)
|
||||
D7_MODE = 'd7mode' in sys.argv
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
|
|
@ -49,6 +50,7 @@ if __name__ == '__main__':
|
|||
function=cleanup_adwcleaner, cs='Done', other_results=other_results)
|
||||
|
||||
# Export system info
|
||||
if not D7_MODE:
|
||||
print_info('Backup System Information')
|
||||
try_and_print(message='AIDA64 reports...',
|
||||
function=run_aida64, cs='Done', other_results=other_results)
|
||||
|
|
@ -79,12 +81,18 @@ if __name__ == '__main__':
|
|||
try_and_print(message='Installed RAM:',
|
||||
function=show_installed_ram, ns='Unknown', silent_function=False)
|
||||
show_free_space()
|
||||
if D7_MODE:
|
||||
try_and_print(message='Temp Size:',
|
||||
function=show_temp_files_size, silent_function=False)
|
||||
try_and_print(message='Installed Antivirus:',
|
||||
function=get_installed_antivirus, ns='Unknown',
|
||||
other_results=other_results, print_return=True)
|
||||
try_and_print(message='Installed Office:',
|
||||
function=get_installed_office, ns='Unknown',
|
||||
other_results=other_results, print_return=True)
|
||||
if D7_MODE:
|
||||
try_and_print(message='Product Keys:',
|
||||
function=get_product_keys, ns='Unknown', print_return=True)
|
||||
|
||||
# Play audio, show devices, open Windows updates, and open Activation
|
||||
try_and_print(message='Opening Device Manager...',
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ init_global_vars()
|
|||
os.system('title {}: System Diagnostics Tool'.format(KIT_NAME_FULL))
|
||||
global_vars['LogFile'] = r'{LogDir}\System Diagnostics.log'.format(
|
||||
**global_vars)
|
||||
D7_MODE = 'd7mode' in sys.argv
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
|
|
@ -37,8 +38,7 @@ if __name__ == '__main__':
|
|||
|
||||
# Sanitize Environment
|
||||
print_info('Sanitizing Environment')
|
||||
# try_and_print(message='Killing processes...',
|
||||
# function=run_process_killer, cs='Done')
|
||||
if not D7_MODE:
|
||||
try_and_print(message='Running RKill...',
|
||||
function=run_rkill, cs='Done', other_results=other_results)
|
||||
try_and_print(message='Running TDSSKiller...',
|
||||
|
|
@ -48,6 +48,7 @@ if __name__ == '__main__':
|
|||
stay_awake()
|
||||
|
||||
# Start diags
|
||||
if not D7_MODE:
|
||||
print_info('Starting Background Scans')
|
||||
check_connection()
|
||||
try_and_print(message='Running HitmanPro...',
|
||||
|
|
@ -65,6 +66,11 @@ if __name__ == '__main__':
|
|||
try_and_print(message='DISM CheckHealth...',
|
||||
function=run_dism, other_results=other_results, repair=False)
|
||||
|
||||
|
||||
if D7_MODE:
|
||||
# Archive all browsers for all users
|
||||
archive_all_users()
|
||||
else:
|
||||
# Scan for supported browsers
|
||||
print_info('Scanning for browsers')
|
||||
scan_for_browsers()
|
||||
|
|
@ -75,6 +81,7 @@ if __name__ == '__main__':
|
|||
function=run_aida64, cs='Done', other_results=other_results)
|
||||
try_and_print(message='BleachBit report...',
|
||||
function=run_bleachbit, cs='Done', other_results=other_results)
|
||||
if not D7_MODE:
|
||||
backup_browsers()
|
||||
try_and_print(message='File listing...',
|
||||
function=backup_file_list, cs='Done', other_results=other_results)
|
||||
|
|
@ -82,10 +89,12 @@ if __name__ == '__main__':
|
|||
function=backup_power_plans, cs='Done')
|
||||
try_and_print(message='Product Keys...',
|
||||
function=run_produkey, cs='Done', other_results=other_results)
|
||||
if not D7_MODE:
|
||||
try_and_print(message='Registry...',
|
||||
function=backup_registry, cs='Done', other_results=other_results)
|
||||
|
||||
# Summary
|
||||
if not D7_MODE:
|
||||
print_info('Summary')
|
||||
try_and_print(message='Operating System:',
|
||||
function=show_os_name, ns='Unknown', silent_function=False)
|
||||
|
|
@ -106,6 +115,7 @@ if __name__ == '__main__':
|
|||
function=get_product_keys, ns='Unknown', print_return=True)
|
||||
|
||||
# User data
|
||||
if not D7_MODE:
|
||||
print_info('User Data')
|
||||
try:
|
||||
show_user_data_summary()
|
||||
|
|
@ -113,6 +123,7 @@ if __name__ == '__main__':
|
|||
print_error(' Unknown error.')
|
||||
|
||||
# Done
|
||||
if not D7_MODE:
|
||||
print_standard('\nDone.')
|
||||
pause('Press Enter to exit...')
|
||||
exit_script()
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ init_global_vars()
|
|||
os.system('title {}: User Checklist Tool'.format(KIT_NAME_FULL))
|
||||
global_vars['LogFile'] = r'{LogDir}\User Checklist ({USERNAME}).log'.format(
|
||||
**global_vars, **global_vars['Env'])
|
||||
D7_MODE = 'd7mode' in sys.argv
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
|
|
@ -46,6 +47,8 @@ if __name__ == '__main__':
|
|||
list_homepages()
|
||||
|
||||
# Backup
|
||||
if not D7_MODE:
|
||||
# Done during system_diagnostics
|
||||
print_info('Backing up browsers')
|
||||
backup_browsers()
|
||||
|
||||
|
|
@ -77,6 +80,7 @@ if __name__ == '__main__':
|
|||
popen_program(['start', '', 'https://fast.com'], shell=True)
|
||||
|
||||
# Done
|
||||
if not D7_MODE:
|
||||
print_standard('\nDone.')
|
||||
pause('Press Enter to exit...')
|
||||
exit_script()
|
||||
|
|
|
|||
Loading…
Reference in a new issue