├── .gitattributes ├── AD_SHOU_Checker_rename_and_move_system_based_on_AD-site.ps1 ├── AD_unlock_account.ps1 ├── Enable RDP.bat ├── LGPO.exe ├── LICENSE ├── Linux one-liners (bash).sh ├── MyLittlePony.bat ├── PermanentlyRemove'Links'FromIEBookmarks.reg ├── RDP_remote_enabler.bat ├── README.md ├── TempFileCleanup.bat ├── WhosOn.bat ├── Windows one-liners.bat ├── WindowsVersionOnDesktop.reg ├── active directory one-liners.txt ├── adobe_flash_player_nuker.bat ├── aexp_nsm_task_tagger.ps1 ├── ahk_v2_rapid_mouse_click_capslock_toggle.ahk ├── backup_differential.bat ├── backup_differential.ps1 ├── caffeine.exe ├── clean_MKV_data.bat ├── clear_Windows_event_logs.bat ├── clear_stuck_print_jobs.bat ├── convert_archives_to_7z.bat ├── deploy_file_to_systems.bat ├── deploy_pdq_packs.ps1 ├── deploy_tron.ps1 ├── deploy_wsus_offline_updates.ps1 ├── dhcp_server_watchdog.bat ├── disable_shortcut_to_text.reg ├── disable_win_s_hotkey.bat ├── enable_Powershell_scripts_run_by_double-clicking.reg ├── father_quotes.txt ├── icehost.sh ├── java_runtime_nuker.bat ├── keepSystemAwake.ps1 ├── launch_vmware_workstation.bat ├── librenms ├── better_default_alert_template ├── device_rebooted_template ├── disk_space_low_alert_template ├── firewall_port_down_template ├── microsoft_teams_alert_template ├── printer_toner_low_alert_template ├── screenshot_alert.png ├── screenshot_rebooted.png ├── screenshot_recovery_alert.png ├── screenshot_warning_alert.png └── sensor_fault_condition_template ├── lnk link command lines and batch hints shortcuts.txt ├── lottery.bat ├── map_printers.bat ├── microsoft_offline_update_launcher.bat ├── microsoft_silverlight_nuker.bat ├── pingup.bat ├── registry ├── Add_Take_Ownership_to_context_menu.reg ├── Tweak_Office_Excel_Add_Open In New Excel Instance Right-Click Option.reg ├── Tweak_Office_Excel_Add_Open In New Excel Instance Right-Click Option_UNDO.reg ├── Tweak_Office_Excel_open in new instance by default.reg ├── Tweak_Office_Excel_open in new instance by default_UNDO.reg ├── Tweak_Office_Outlook_stop_auto-compressing_images.reg ├── Tweak_Office_Visio_open_files_in_separate_windows.reg ├── Windows_Server_disable_shutdown_event_tracker.reg ├── add_Take_Ownership_to_context_menu.reg ├── ask_user_instead_of_silently_installing_minor_updates.reg ├── disable_Adobe_Shockwave_Autoupdate.reg ├── disable_Adobe_Shockwave_Stats_Collection.reg ├── disable_Java_Auto-Update.reg ├── disable_NCSI_phone-home_Internet_connectivity_check.reg ├── disable_Tray_Balloon_Notifcations.reg ├── disable_Windows_Update_Auto-Reboot.reg ├── disable_shortcut_to_text.reg ├── disable_telemetry_registry_entries.reg ├── disable_use_web_service_to_find_the_correct_program.reg ├── disable_windows_10_upgrade_registry_entries.reg ├── enable_Powershell_scripts_run_by_double-clicking.reg ├── enable_command-prompt_auto-complete.reg ├── enable_command-prompt_use_of_systems_mapped_drives.reg ├── enable_standard_RunAs_on_Vista.reg ├── force_NumLock_on_at_startup.reg ├── remove_old_unused_drivers.ps1 ├── show_windows_version_on_desktop.reg ├── tweak_office_excel_Add_Open In New Excel Instance Right-Click Option.reg ├── tweak_office_excel_open in new instance by default.reg ├── tweak_office_visio_open_files_in_separate_windows.reg ├── vista_StopHijackingMySleepButton.reg ├── win10_annoyance_remove_stupid_folders_in_MyPC (Videos, Pictures, etc).reg ├── win10_disable_annoying_lock_screen.reg ├── win10_disable_libraries_in_navigation_pane.reg ├── win10_enable_legacy_incoming_remote_desktop_security (allow Linux clients to connect).reg ├── win10_force_folder_views_not_to_change.reg ├── win10_powershell_enable_double-clicking_ps1_files_to_launch.ps1 ├── win10_prevent_wifi_credential_sharing.reg ├── win10_show_window_contents_while_dragging.reg ├── win7-10_disable_wallpaper_compression.reg ├── win7-8.1_disable_uncancellable_auto_restart_notification.reg ├── win7_disable_libraries.reg ├── win7_enable_tcpipv6.reg ├── win7_shrink_window_borders.reg ├── win8_remove_pin-to-start_right_click_option.reg ├── winVista_win7_prevent_Welcome_Center_running_for_each_new_user.reg ├── winXP-10_disable_all_balloon_notification_tips.reg └── winXP-10_disable_all_balloon_tips.reg ├── remove_all_printers_and_unused_drivers_and_ports.bat ├── remove_libraries_icon_from_desktop.bat ├── remove_old_unused_drivers.ps1 ├── repair_windows_update.bat ├── repair_wmi.bat ├── send_popup_message_to_multiple_systems.ps1 ├── setip.bat ├── setip_basic.bat ├── show_windows_version_on_desktop.reg ├── simple_backup_script.bat ├── tron_guid_whitelist.txt ├── tron_metro_whitelist.txt ├── tron_parse_incoming_guids.ps1 ├── tron_parse_incoming_metro_apps.ps1 ├── unblock_downloaded_files.ps1 ├── wget v1.20.3 x86.exe ├── wget v1.20.3.exe └── win8_remove_default_metro_apps.ps1 /.gitattributes: -------------------------------------------------------------------------------- 1 | # Declare files that will always have CRLF line endings on checkout. 2 | *.bat eol=crlf 3 | *.ps1 eol=crlf 4 | *.txt eol=crlf 5 | *.vbs eol=crlf 6 | *.xml eol=crlf 7 | *.properties eol=crlf 8 | *.sites eol=crlf 9 | *.config eol=crlf 10 | *.h eol=crlf 11 | *.reg eol=crlf 12 | *.cfg eol=crlf 13 | *.ini eol=crlf 14 | 15 | 16 | # Denote all files that are truly binary and should not be modified. 17 | *.exe binary 18 | -------------------------------------------------------------------------------- /AD_SHOU_Checker_rename_and_move_system_based_on_AD-site.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Purpose: SHOU(Site, Hostname, OU) checker: Moves a workstation to the correct OU based on its site, renames it according to the naming standard, then reboots it 3 | Requirements: Domain admin rights 4 | Author: reddit.com/user/vocatus ( vocatus.gate@gmail.com ) // PGP key ID: 0x07d1490f82a211a2 5 | History: 1.0.0 Initial write 6 | Usage: 1. Run with Task Scheduler whenever you feel necessary, just be aware the affected machines will be rebooted 7 | Run like this: .\scriptName.ps1 -CheckOU "Name of OU to scan" 8 | Notes: If moving from Pima to Ventura, since we don't know which specific OU to place the machine in, we default to dumping it in the Ventura-Area-D OU since that's where most moves happen 9 | #> 10 | 11 | 12 | ############# 13 | # VARIABLES # -- set these to your desired values or supply them from shell 14 | ############# 15 | param ( 16 | # Logging information 17 | [string] $LogPath = $env:systemdrive + "\Logs", 18 | [string] $LogFile = $env:computername + "_AD_SHOU_checker.log", 19 | # Credentials to perform the operation 20 | [string] $DomainUsername = "adrename_robot", 21 | [string] $DomainPassword = "8I5az5jR66fdxWZKpYdU", 22 | [string] $CheckOU = $( Read-Host "Enter OU to check" ), # prompt for this if it wasn't supplied 23 | 24 | [string] $FixOU = "no", # Auto-move the host to the correct OU if incorrect 25 | [string] $FixHostnames = "no" # Auto-rename hosts if name is incorrect (note: forces reboot) 26 | ) 27 | 28 | 29 | 30 | ######## 31 | # Prep # 32 | ######## 33 | $SCRIPT_VERSION="1.0.0" 34 | $SCRIPT_UPDATED="2015-03-10" 35 | $CUR_DATE=get-date -f "yyyy-MM-dd" 36 | $ErrorActionPreference = "SilentlyContinue" 37 | 38 | 39 | ########### 40 | # EXECUTE # 41 | ########### 42 | # Log that we started 43 | "$CUR_DATE "+ $(get-date -f "hh:mm:ss") + " SHOU checker v$SCRIPT_VERSION initialized, scanning OU `"$CheckOU`"..." >> $LogPath\$LogFile 44 | write-host $CUR_DATE (get-date -f hh:mm:ss) -n -f darkgray; write-host -n " SHOU checker v$SCRIPT_VERSION initialized, scanning OU `""; write-host -n -f blue "$CheckOU"; write-host "`"..." 45 | 46 | # Scan the target OU and populate an array with the current hostnames 47 | $CURRENT_OU_HOSTS=(get-adcomputer -searchbase "OU=$CheckOU,OU=NTI_Workstations,DC=green,DC=nti" -filter 'ObjectClass -eq "Computer"' | select -expand Name) 48 | 49 | # FixOU was specified 50 | if ($FixOU -eq "yes") { 51 | "$CUR_DATE "+ $(get-date -f "hh:mm:ss") + " FixOU specified; will automatically fix host OU membership if incorrect" >> $LogPath\$LogFile 52 | write-host $CUR_DATE (get-date -f hh:mm:ss) -n -f darkgray; write-host " FixOU specified; will automatically fix host OU membership if incorrect" 53 | } 54 | 55 | # FixHostnames was specified 56 | if ($FixHostnames -eq "yes") { 57 | "$CUR_DATE "+ $(get-date -f "hh:mm:ss") + " FixHostnames specified; hosts will be automatically renamed and rebooted if their hostname is incorrect" >> $LogPath\$LogFile 58 | write-host $CUR_DATE (get-date -f hh:mm:ss) -n -f darkgray; write-host " FixHostnames specified; hosts will be automatically renamed and rebooted if their hostname is incorrect" 59 | } 60 | 61 | # Neither action was specified 62 | if ($FixHostnames -ne "yes" -And $FixOU -ne "yes") { 63 | "$CUR_DATE "+ $(get-date -f "hh:mm:ss") + " No actions specified, enumerating OU hosts only" >> $LogPath\$LogFile 64 | write-host $CUR_DATE (get-date -f hh:mm:ss) -n -f darkgray; write-host -b black -f yellow " No actions specified, enumerating OU hosts only" 65 | } 66 | 67 | 68 | # Iterate through the array and check each system 69 | foreach ($i in $CURRENT_OU_HOSTS) { 70 | # Temporary exclusion to prevent renaming Lauri's box 71 | if ($i -ne "G-DGPBZV1") { 72 | # Log which host we're on 73 | "$CUR_DATE "+ $(get-date -f "hh:mm:ss") + " $i..." >> $LogPath\$LogFile 74 | write-host $CUR_DATE (get-date -f hh:mm:ss) -n -f darkgray; write-host " $i..." 75 | 76 | # Populate current system information (site, hostname, serial number) 77 | $tempVar = nltest /dsgetsite /server:$i 78 | $CURRENT_SITE = $tempVar[0] 79 | $tempVar = Get-ADComputer $i -EA SilentlyContinue 80 | $CURRENT_OU = $tempVar.DistinguishedName 81 | $tempVar = wmic /node:$i bios get serialnumber # get the remote system's serial number 82 | $tempVar1 = $tempVar[2].trim() # trim trailing space 83 | $SERIAL = $tempVar1.replace(' ','') # trim other spaces 84 | 85 | 86 | # STEP 1: Check the OU-to-site mapping 87 | if ($FixOU -eq "yes") { 88 | if ($CURRENT_SITE -like '*VENTURA*' -And $CURRENT_OU -like '*Ventura*') { 89 | "$CUR_DATE "+ $(get-date -f "hh:mm:ss") + " OK (OU-site mapping)" >> $LogPath\$LogFile 90 | write-host $CUR_DATE (get-date -f hh:mm:ss) -n -f darkgray; write-host -n -f green " OK "; write-host "(OU-site mapping)" -f darkgray 91 | } elseif ($CURRENT_SITE -like '*PIMA*' -And $CURRENT_OU -like '*Pima*') { 92 | "$CUR_DATE "+ $(get-date -f "hh:mm:ss") + " OK (OU-site mapping)" >> $LogPath\$LogFile 93 | write-host $CUR_DATE (get-date -f hh:mm:ss) -n -f darkgray; write-host -n -f green " OK "; write-host "(OU-site mapping)" -f darkgray 94 | } else { 95 | "$CUR_DATE "+ $(get-date -f "hh:mm:ss") + " ERROR: $i is in `"$CheckOU`" OU but in site `"$CURRENT_SITE`". Moving to correct OU." >> $LogPath\$LogFile 96 | write-host $CUR_DATE (get-date -f hh:mm:ss) -n -f darkgray; write-host -n -f red " ERROR"; write-host ": $i is in `"$CheckOU`" OU but in site `"$CURRENT_SITE`". Moving to correct OU." 97 | if ($CURRENT_SITE -like '*VENTURA*') { Get-ADComputer $i | Move-ADObject -TargetPath "OU=Ventura-Area-D,OU=NTI_Workstations,DC=green,DC=nti" } 98 | if ($CURRENT_SITE -like '*PIMA*') { Get-ADComputer $i | Move-ADObject -TargetPath "OU=Pima,OU=NTI_Workstations,DC=green,DC=nti" } 99 | } 100 | } 101 | 102 | # STEP 2: Check the hostname 103 | if ($FixHostnames -eq "yes") { 104 | if ($CURRENT_SITE -like '*VENTURA*' -And $i -like '*VENW*') { 105 | "$CUR_DATE "+ $(get-date -f "hh:mm:ss") + " OK (hostname)" >> $LogPath\$LogFile 106 | write-host $CUR_DATE (get-date -f hh:mm:ss) -n -f darkgray; write-host -n -f green " OK "; write-host "(hostname)" -f darkgray 107 | } elseif ($CURRENT_SITE -like '*PIMA*' -And $i -like '*PIMW*') { 108 | "$CUR_DATE "+ $(get-date -f "hh:mm:ss") + " OK (hostname)" >> $LogPath\$LogFile 109 | write-host $CUR_DATE (get-date -f hh:mm:ss) -n -f darkgray; write-host -n -f green " OK "; write-host "(hostname)" -f darkgray 110 | } else { 111 | "$CUR_DATE "+ $(get-date -f "hh:mm:ss") + " ERROR: $i does not match naming standard for `"$CURRENT_SITE`"." >> $LogPath\$LogFile 112 | write-host $CUR_DATE (get-date -f hh:mm:ss) -n -f darkgray; write-host -n -f red " ERROR"; write-host ": $i does not match naming standard for site `"$CURRENT_SITE`"." 113 | if ($CURRENT_SITE -like '*VENTURA*') { 114 | "$CUR_DATE "+ $(get-date -f "hh:mm:ss") + " Renaming to GVENW$SERIAL and rebooting using account $DomainUsername." >> $LogPath\$LogFile 115 | write-host $CUR_DATE (get-date -f hh:mm:ss) -n -f darkgray; write-host " Renaming to GVENW$SERIAL and rebooting using account $DomainUsername." 116 | #&netdom renamecomputer $i /newname:GPIMW$SERIAL /ud:$DomainUsername /pd:$DomainPassword /force /reboot:5 117 | } 118 | if ($CURRENT_SITE -like '*PIMA*') { 119 | "$CUR_DATE "+ $(get-date -f "hh:mm:ss") + " Renaming to GPIMW$SERIAL and rebooting using account $DomainUsername." >> $LogPath\$LogFile 120 | write-host $CUR_DATE (get-date -f hh:mm:ss) -n -f darkgray; write-host " Renaming to GPIMW$SERIAL and rebooting using account $DomainUsername." 121 | #&netdom renamecomputer $i /newname:GVENW$SERIAL /ud:$DomainUsername /pd:$DomainPassword /force /reboot:5 122 | } 123 | } 124 | } 125 | } 126 | } 127 | 128 | 129 | "$CUR_DATE "+ $(get-date -f "hh:mm:ss") + " SHOU checker v$SCRIPT_VERSION complete" >> $LogPath\$LogFile 130 | write-host $CUR_DATE (get-date -f hh:mm:ss) -n -f darkgray; write-host " SHOU checker v$SCRIPT_VERSION complete" -------------------------------------------------------------------------------- /AD_unlock_account.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Purpose: Unlocks Active Directory accounts 3 | Requirements: Network admin rights 4 | Author: reddit.com/user/vocatus ( vocatus.gate@gmail.com ) // PGP key: 0x07d1490f82a211a2 5 | History: 1.1.0 + Added Prep section with standard variables to be consistent with other scripts 6 | 1.0.0 Initial write 7 | 8 | Usage: Pass account names to be unlocked as arguments, e.g. .\unlock_AD_account.ps1 MyAccountName MySecondAccountName 9 | #> 10 | 11 | 12 | ############# 13 | # VARIABLES # -- Set these to your desired values 14 | ############# 15 | # Rules for variables: 16 | # * Quotes are required (e.g.: "c:\directory\path" ) 17 | # * NO trailing slashes on paths! (bad: "c:\directory\" ) 18 | # * Spaces are okay (okay: "c:\my folder\with spaces" ) 19 | # * Network paths are okay (okay: "\\server\share name" ) 20 | # ( "\\172.16.1.5\share name" ) 21 | # Logging information 22 | $LOGPATH=$env:systemdrive + "\Logs" 23 | $LOGFILE=$env:computername + "_AD_unlock_account.log" 24 | 25 | 26 | ######## 27 | # Prep # 28 | ######## 29 | $SCRIPT_VERSION="1.1.0" 30 | $SCRIPT_UPDATED="2014-01-16" 31 | $CUR_DATE=get-date -f "yyyy-MM-dd" 32 | 33 | 34 | 35 | ############# 36 | # EXECUTION # 37 | ############# 38 | # If no arguments were passed, spit out a message and die. 39 | # AKA if "$args" is false / aka not true, then do this stuff 40 | if (! $args) { 41 | write-host 42 | Write-Host "Pass names of accounts to unlock, separated by spaces. e.g. .\unlock_AD_account.ps1 MyAccountName MySecondAccountName" -f white 43 | write-host 44 | Break 45 | } 46 | 47 | # Log that the script was triggered 48 | "$CUR_DATE "+ $(get-date -f "hh:mm:ss") + " Account unlock script triggered. Executing..." >> $LOGPATH\$LOGFILE 49 | 50 | # Do the unlock 51 | foreach ($i in $args) { 52 | unlock-adaccount $i 53 | write-host $i unlocked -f green 54 | "$CUR_DATE "+ $(get-date -f "hh:mm:ss") + " $i unlocked" >> $LOGPATH\$LOGFILE 55 | #if $LASTEXITCODE -ne "0" write-host $i failed to unlock -f red 56 | } -------------------------------------------------------------------------------- /Enable RDP.bat: -------------------------------------------------------------------------------- 1 | :: Script to enable Remote Desktop on a machine (must run locally) 2 | 3 | :: For a version of this script that can be run against a REMOTE machine, see here: 4 | :: https://github.com/bmrf/standalone_scripts/blob/master/RDP_remote_enabler.bat 5 | 6 | :: Thanks to reddit.com/user/diggity801 for idea and initial script 7 | 8 | :: Open the firewall to allow incoming connections 9 | netsh advfirewall firewall set rule group="Remote Desktop" new enable=Yes 10 | 11 | :: Disable the "Deny TS Connections" registry key 12 | reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f 13 | 14 | :: Set the service to start automatically at boot time 15 | sc config termservice start= auto 16 | 17 | :: Start the service 18 | net start termservice 19 | -------------------------------------------------------------------------------- /LGPO.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/LGPO.exe -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Vocatus Gate 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Linux one-liners (bash).sh: -------------------------------------------------------------------------------- 1 | # Search all files for a text string, starting at root, and only display the file name, not the contents 2 | grep -Ril "text-to-find-here" / 3 | grep -r "string to be searched" / 4 | 5 | # rdesktop to a system with compression (z), bitmap caching (P), in low-bandwidth mode (-x m), with remote sound played through remote speakers 6 | rdesktop hgate.us.to:1338 -g 1450x1250 -z -r sound:remote -x m -P -p 7 | 8 | # Update all expired apt keys 9 | for K in $(apt-key list | grep expired | cut -d'/' -f2 | cut -d' ' -f1); do sudo apt-key adv --recv-keys --keyserver keys.gnupg.net $K; done 10 | 11 | # Matrix text scrolling effect in the terminal 12 | echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) ;sleep 0.05; done|awk '{ letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}' 13 | 14 | # Calculate cost of lines of code in a directory 15 | sloccount ./ 16 | 17 | # List all services/daemons that run at startup (run level 3) 18 | /sbin/chkconfig --list |grep '3:on' 19 | 20 | # Release and renew IP addresses 21 | dhclient -r 22 | dhclient 23 | 24 | # Determine if system is 32 or 64 bits 25 | cat /proc/cpuinfo | grep -Gq "flags.* lm " && echo '64bit' || echo '32bit' 26 | 27 | # Get release version 28 | cat /etc/release # red hat and derivatives 29 | cat /etc/issue # debian and derivatives 30 | 31 | # Monitor disk i/o 32 | iostat -x 1 33 | 34 | # Disk usage summary by directory 35 | du -chs /* 36 | 37 | # Disk usage summary by directory, alternate (sometimes more effective) 38 | du -h / | grep '[0-9\.]\+G' 39 | du -h / | grep '^\s*[0-9\.]\+G' # only directories larger than 1.0 GB 40 | du -ch -d 1 | sort -hr # uses util ncdu 41 | 42 | # Find average size of all files on the entire drive (/) 43 | find / -type f -print0 | xargs -0 ls -l | gawk '{sum += $5; n++;} END {print "Total Size: " sum/1024/1024 " MB : Avg Size: " sum/n/1024 " KB : Total Files: " n ;}' 44 | 45 | # Kill all processes whose name contains this string ("minion" in this example) 46 | kill `ps -A|awk '/minion/{print $1}'` 47 | 48 | # Verify no non-root users have UID 0 (root) 49 | awk -F: '($3 == "0") {print}' /etc/passwd 50 | 51 | # Follow a log file in real-time 52 | tail -f /var/log/maillog 53 | tail -f /var/log/messages 54 | tail -f /var/log/httpd 55 | 56 | # Useful tools for watching NIC traffic/throughput 57 | vnstat -l -i eth1 58 | iptraf 59 | iptraf-ng # new version 60 | ntop # Self-contained webGUI traffic monitor, with graphs and detailed tables. Runs by default on port 3000 61 | 62 | # Add static route for a specific host 63 | route add -host 192.168.1.83 gw 172.16.1.1 # old version 64 | ip route add 192.168.1.0/24 via 10.0.0.1 # new version 65 | ip route add 192.168.1.0/24 dev eth2 # specifying via interface vs. gateway IP 66 | 67 | # Add static route for a specific subnet 68 | route add -net 192.168.1.0/24 gw 172.16.1.1 69 | 70 | # Add static route for a specific subnet and specify a metric 71 | route add -net 192.168.1.0/24 gw 172.16.1.1 3 72 | 73 | # RHEL/CentOS: Show all installed packages and the date of last update 74 | rpm -qa --qf '%{INSTALLTIME} %-40{NAME} %{INSTALLTIME:date}\n' | sort -n | cut -d' ' -f2- 75 | -------------------------------------------------------------------------------- /MyLittlePony.bat: -------------------------------------------------------------------------------- 1 | :: Launch a full-screen, autoplaying YouTube video every hour in Kiosk mode (full-screen, all controls except alt-f4 disabled) 2 | schtasks /f /create /sc hourly /tn MyLittlePony /tr "'%ProgramFiles(x86)%\Microsoft\Edge\Application\msedge.exe' --kiosk https://www.youtube.com/embed/dUoiwSQdnoc?autoplay=1" --edge-kiosk-type=fullscreen 3 | 4 | :: Launch a full-screen, autoplaying YouTube video every 5 minutes in Kiosk mode (full-screen, all controls except alt-f4 disabled) 5 | schtasks /f /create /sc minute /MO 5 /tn MyLittlePony /tr "'%ProgramFiles(x86)%\Microsoft\Edge\Application\msedge.exe' --kiosk https://www.youtube.com/embed/dUoiwSQdnoc?autoplay=1" --edge-kiosk-type=fullscreen 6 | 7 | :: Alternate version of above command if Task Scheduler execution of IE is blocked 8 | schtasks /f /create /sc minute /MO 5 /tn MyLittlePony /tr "%windir%\explorer.exe \"https://www.youtube.com/embed/dUoiwSQdnoc?autoplay=1\"" --edge-kiosk-type=fullscreen 9 | 10 | :: Alternate version of above command using Microsoft Word, loads the MyLittlePony website in Word every 5 minutes 11 | schtasks /f /create /sc minute /MO 5 /tn MyLittlePony /tr "'%ProgramFiles(x86)\Microsoft Office\Office15\winword.exe' /q /h https://mylittlepony.hasbro.com/en-us" --edge-kiosk-type=fullscreen 12 | 13 | :: Launch the MyLittlePony website every hour in Kiosk mode (full-screen, all controls except alt-f4 disabled) 14 | schtasks /f /create /sc hourly /tn MyLittlePony /tr "'%ProgramFiles(x86)%\Microsoft\Edge\Application\msedge.exe' --kiosk https://mylittlepony.hasbro.com/en-us" --edge-kiosk-type=fullscreen 15 | 16 | :: Launch the MyLittlePony website every 5 minutes in Kiosk mode (full-screen, all controls except alt-f4 disabled) 17 | schtasks /f /create /sc minute /MO 5 /tn MyLittlePony /tr "'%ProgramFiles(x86)%\Microsoft\Edge\Application\msedge.exe' --kiosk https://mylittlepony.hasbro.com/en-us" --edge-kiosk-type=fullscreen 18 | 19 | :: Alternate version of above command if Task Scheduler execution of IE is blocked 20 | schtasks /f /create /sc minute /MO 5 /tn MyLittlePony /tr "%windir%\explorer.exe \"https://mylittlepony.hasbro.com/en-us\"" 21 | 22 | :: Launch the Windows93 website every hour in Kiosk mode (full-screen, all controls except alt-f4 disabled) 23 | schtasks /f /create /sc hourly /tn Windows93 /tr "'%ProgramFiles(x86)%\Microsoft\Edge\Application\msedge.exe' --kiosk http://windows93.net" 24 | 25 | :: Schedule to open every minute 26 | schtasks /f /create /SC MINUTE /TN "MyLittlePony" /TR "'%SystemDrive%\Program Files\Internet Explorer\iexplore.exe' 'https://mylittlepony.hasbro.com/en-us'" --edge-kiosk-type=fullscreen 27 | 28 | :: Schedule to open as soon as the computer is idle for 1 minute or more -- Change "1" to any number you want 29 | schtasks /f /create /SC ONIDLE /I 1 /TN "MyLittlePony" /TR "'%SystemDrive%\Program Files\Internet Explorer\iexplore.exe' 'https://mylittlepony.hasbro.com/en-us'" --edge-kiosk-type=fullscreen 30 | 31 | :: Schedule to open at every logon -- this requires Administrator access 32 | schtasks /f /create /SC ONLOGON /TN "MyLittlePony" /TR "'%SystemDrive%\Program Files\Internet Explorer\iexplore.exe' 'https://mylittlepony.hasbro.com/en-us'" --edge-kiosk-type=fullscreen 33 | 34 | :: Delete the "MyLittlePony" scheduled task 35 | schtasks /Delete /TN "MyLittlePony" /F 36 | 37 | 38 | :: Launch the task we created 39 | schtasks /run /tn "MyLittlePony" 40 | schtasks /run /tn "Windows93" 41 | 42 | ==================================== 43 | ==================================== 44 | 45 | :: Bonus: Schedule a popup message every hour 46 | schtasks /f /create /SC HOURLY /TN "PonyReminder" /TR "msg console ADMIT YOUR LOVE FOR MYLITTLEPONY!" 47 | 48 | :: Bonus: Schedule a popup message every 3 minutes 49 | schtasks /f /create /SC MINUTE /MO 3 /TN "PonyReminder" /TR "msg console ADMIT YOUR LOVE FOR PONIES!" 50 | 51 | :: Delete the "PonyReminder" scheduled task 52 | schtasks /Delete /TN "PonyReminder" /F 53 | -------------------------------------------------------------------------------- /PermanentlyRemove'Links'FromIEBookmarks.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | [-HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Toolbar] 4 | LinksFolderName=Links -------------------------------------------------------------------------------- /RDP_remote_enabler.bat: -------------------------------------------------------------------------------- 1 | :: Purpose: Enables RDP on a Vista/7/8/10 system remotely 2 | :: Requirements: 1. Run this script with a network admin account 3 | :: 2. reg.exe, psexec.exe, and ntrights.exe must be in any of these locations: 4 | :: a) the directory you run the script from 5 | :: b) c:\windows\system32\ 6 | :: c) the system PATH variable 7 | :: Author: reddit.com/user/vocatus ( vocatus.gate at gmail ) // PGP key: 0x07d1490f82a211a2 8 | :: History: 1.7.0 * Reworked CUR_DATE variable to handle more than one Date/Time format 9 | :: Can now handle all Windows date formats 10 | :: 1.6.0 + Added new Step 7 to show who's logged in at the remote box instead of disable CAC-only login 11 | :: + Added workaround method for Step 1 (was failing when passing IP's for some reason). 12 | :: 1.5.0 + Added a 1-count ping before running operations 13 | :: 1.4.0 / Changed step 1 to stack ALL usernams in a single command (instead one separate /ADD command per user) 14 | :: 1.3.0 + Added code to allow run-once behavior (specify computer name when starting the script). 15 | :: example: rdp_enabler.bat computername 16 | :: 1.2.0 * Cleaned up comments and information that displays while the script is running 17 | :: - Removed 4th section that added Remote Interactive rights for individual users, 18 | :: since this is accomplished by verifying RI rights are present for the RDU group 19 | :: 1.0.0 Initial write 20 | @echo off 21 | cls 22 | 23 | 24 | ::::::::::::::: 25 | :: VARIABLES :: -- Set these 26 | ::::::::::::::: 27 | 28 | :: Which user to enable RDP for 29 | set RDP_USER=vocatus 30 | 31 | :: Connection timeout (in seconds) 32 | set TIMEOUT=4 33 | 34 | 35 | :::::::::: 36 | :: Prep :: -- Don't change anything in this section 37 | :::::::::: 38 | set SCRIPT_VERSION=1.7.0 39 | set SCRIPT_UPDATED=2020-07-22 40 | :: Get the date into ISO 8601 standard format (yyyy-mm-dd) so we can use it 41 | FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a 42 | set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% 43 | set TARGET=%1% 44 | title RDP Enabler v%SCRIPT_VERSION% 45 | 46 | 47 | ::::::::::::: 48 | :: EXECUTE :: 49 | ::::::::::::: 50 | :: Test if we're hitting one system then quitting 51 | if not '%1%'=='' goto run_once 52 | 53 | :: Start menu 54 | :start 55 | echo. 56 | echo Remote RDP Enabler v%SCRIPT_VERSION% 57 | echo Requires reg.exe, psexec.exe and ntrights.exe 58 | echo. 59 | echo Enter the IP or name of the remote computer to enable 60 | echo Remote Desktop access. 61 | :loop 62 | echo. 63 | @set /P TARGET= Target Computer: 64 | if %TARGET%==exit goto end 65 | :: Eight steps: 66 | :: 0. Ping to wake up any sleeping connections (this helps for some reason) 67 | :: 1. Enable RDP on the remote box (flip the registry bit) 68 | :: 2. Add appropriate users to "Remote Desktop Users" user group 69 | :: 3. Bug fix 1: On some Vista images, the Remote Desktop Users group is missing the Remote Interactive Logon right 70 | :: 4. Bug fix 2: "Deny Remote Interactive Logon" includes the "Everyone" group for some reason. Revoke (disable/undo) this. 71 | :: 5. Start Terminal Services services and dependencies 72 | :: 6. Disable CAC-only login (bonus!) 73 | :: 7. Report who (if anyone) is logged on locally at the box. This fails quite a bit. 74 | :: 8. Report results and loop back, if RUN_ONCE is set to false. Otherwise quit. 75 | 76 | :run_once 77 | :: Built-in Windows method. Sometimes fails when using an IP address instead of a system name for some reason. 78 | ::reg add "\\%TARGET%\HKLM\SYSTEM\ControlSet001\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f 79 | 80 | :: Workaround method using SysInternals PsExec. Usually works fine. 81 | psexec \\%TARGET% reg add "HKLM\SYSTEM\ControlSet001\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f 82 | 83 | :: Step 2 - Add users to "Remote Desktop Users" group; you can add multiple users in one command. Enclose full usernames in quotes, separated by a space 84 | psexec -accepteula -n %TIMEOUT% -d \\%TARGET% net localgroup "Remote Desktop Users" /add "%RDP_USER%" 85 | 86 | :: Step 3 - Fix some annoyances - make sure the Remote Desktop Users group has access to login remotely 87 | ntrights -u "Remote Desktop Users" +r SeNetworkLogonRight -m \\%TARGET% 88 | ntrights -u "Remote Desktop Users" +r SeRemoteInteractiveLogonRight -m \\%TARGET% 89 | 90 | :: step 4 - Revoke (remove/disable) all the "deny" rights for "everyone" just in case. These will usually fail, not a problem. 91 | ntrights -u Everyone -r SeDenyRemoteInteractiveLogonRight -m \\%TARGET% 92 | ntrights -u Everyone -r SeDenyServiceLogonRight -m \\%TARGET% 93 | ntrights -u Everyone -r SeDenyBatchLogonRight -m \\%TARGET% 94 | ntrights -u Everyone -r SeDenyNetworkLogonRight -m \\%TARGET% 95 | 96 | :: Step 5 - Start up the Terminal Services dependencies and set to auto-start 97 | psexec -accepteula -n %TIMEOUT% -d \\%TARGET% sc config termservice start= auto && net start termservice 98 | 99 | :: Step 6 - Disable CAC login (bonus!) 100 | reg add \\%TARGET%\HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system /v scforceoption /t REG_DWORD /d 0 /f 101 | 102 | :: Step 7 - Report who (if anyone) is logged in locally at the box 103 | echo. 104 | echo Currently Logged-In User: 105 | echo ========================= 106 | echo. 107 | :: Method #1: WMIC. Most accurate, only works on XP and up. Usually works 108 | WMIC /NODE: %TARGET% computersystem GET name, username 109 | 110 | :: Method #2: SysInternals utility. Works most of the time if you have the exe. 111 | ::PsLoggedon.exe -l \\%target% 112 | 113 | :: Method #3: Windows built-in. Usually doesn't work 114 | ::psexec -accepteula -n %TIMEOUT% \\%TARGET% query user 115 | 116 | 117 | :: Step 8 - Report results and loop back 118 | echo. 119 | psexec \\%TARGET% netstat -an | find "3389" 120 | title RDP Enabler 121 | echo. 122 | echo If you see port 3389 listed above, or "netstat exited with error code 0" 123 | echo then Remote Desktop is listening correctly. 124 | echo. 125 | echo. 126 | :: reset target and check to see if this is a one-time deal 127 | set TARGET= 128 | if '%1%'=='' goto loop 129 | 130 | :end 131 | title %USERNAME% -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | standalone_scripts 2 | ================== 3 | 4 | Various standalone scripts 5 | 6 | Each script is well-commented; read to see purpose and function 7 | -------------------------------------------------------------------------------- /WhosOn.bat: -------------------------------------------------------------------------------- 1 | :: Purpose: Checks who's logged-on to a remote computer 2 | :: Pings first to create an ARP entry, seems to lessen the chance of a timeout error. 3 | :: Requirements: Run this script with a network admin account 4 | :: Author: vocatus on reddit.com/r/sysadmin ( vocatus.gate@gmail.com ) // PGP key ID: 0x07d1490f82a211a2 5 | :: History: 1.7.1 / Minor header cleanup; Variables section now above prep and checks 6 | :: 1.7.0 * Overhauled Date/Time conversion so we can handle ALL versions of Windows using ANY local date-time format 7 | :: 1.6.0 + Added "SCRIPT_UPDATED" variable to note when the script was last updated 8 | :: / Structure cleanup 9 | :: 1.5.0 / Comment cleanup 10 | :: / Structure cleanup 11 | :: 1.4.0 + Added missing quotes around %TARGET% variable 12 | :: 1.3.0 + Added /FAILFAST:on to WMIC method to allow faster time-outs if the machine isn't responding 13 | :: 1.2.0 + Added "WMIC /NODE:%TARGET% csproduct get vendor,name,identifyingnumber" to WMIC section 14 | :: 1.1.0 + Added two additional methods for checking which can be activated by uncommenting 15 | :: + Added METHOD variable to reflect which method we're trying 16 | :: / Capped variables properly 17 | :: 1.0.0 Initial write 18 | SETLOCAL 19 | @echo off 20 | 21 | ::::::::::::::: 22 | :: VARIABLES :: -------------- These are the defaults. Change them if you so desire. --------- :: 23 | ::::::::::::::: 24 | 25 | :: Set method of querying remote system. Valid methods are: 26 | :: - WMIC (most reliable, however provides the least information) 27 | :: - Windows_query_user (requires Windows Vista and up; doesn't work on XP) 28 | :: - PsLoggedon (requires PsLoggedon.exe from sysinternals) 29 | set METHOD=WMIC 30 | 31 | :: --------------------------- Don't edit anything below this line --------------------------- :: 32 | 33 | 34 | 35 | ::::::::::::::::::::: 36 | :: PREP AND CHECKS :: 37 | ::::::::::::::::::::: 38 | @echo off 39 | title Who's Logged On? 40 | set TARGET=%1% 41 | set SCRIPT_VERSION=1.7.1 42 | set SCRIPT_UPDATED=2014-09-08 43 | set RUNONCE=NO 44 | :: Get the date into ISO 8601 standard date format (yyyy-mm-dd) so we can use it 45 | FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a 46 | set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% 47 | 48 | 49 | ::::::::::::::: 50 | :: EXECUTION :: 51 | ::::::::::::::: 52 | if not '%1%'=='' set RUNONCE=YES && goto run_once 53 | cls 54 | echo. 55 | echo Check who's logged on to a remote computer. 56 | echo. 57 | echo Available methods, from most reliable to least: 58 | echo - WMIC Uses WMIC to query the remote system 59 | echo - Windows_query_user Uses Windows' built-in "query user /SERVER:%TARGET%" command 60 | echo (Your local PC must be running Windows Vista or 7 to use this) 61 | echo - PsLoggedon Uses SysInternal's PsLoggedon.exe to query the remote system 62 | echo. 63 | echo Currently set to use the '%METHOD%' method. 64 | echo. 65 | :loop 66 | set /P TARGET= Check: 67 | if %TARGET%==exit goto end 68 | :go 69 | echo. 70 | echo Checking %TARGET% using %METHOD%... 71 | echo. 72 | ping -n 1 %TARGET% >NUL 73 | goto %METHOD% 74 | 75 | 76 | :: 77 | :: Method #1: WMIC. Most accurate, usually works. Valid on XP and up. 78 | :: 79 | :WMIC 80 | WMIC /FAILFAST:on /NODE:"%TARGET%" computersystem GET name, username 81 | ::WMIC /FAILFAST:on /NODE:"%TARGET%" csproduct get vendor,name,identifyingnumber 82 | if %ERRORLEVEL%==1 echo. && echo WMIC method failed. Trying Windows_query_user method... && echo. && goto Windows_query_user 83 | if %RUNONCE%==YES (goto end) ELSE (goto loop) 84 | 85 | :: 86 | :: Method #2: Windows built-in. Only available on Vista/7 to my knowledge. Provides the most information. 87 | :: 88 | :Windows_query_user 89 | query user /SERVER:%TARGET% 90 | if %RUNONCE%==YES (goto end) ELSE (goto loop) 91 | 92 | :: 93 | :: Method #3: SysInternals utility. Works most of the time. the PsLoggedon.exe file is required. 94 | :: 95 | :PsLoggedon 96 | PsLoggedon.exe -l \\%TARGET% 97 | if %RUNONCE%==YES goto end 98 | 99 | 100 | :run_once 101 | echo. 102 | echo Checking %TARGET% using %METHOD% method... 103 | echo. 104 | goto %METHOD% 105 | 106 | 107 | :end 108 | title %USERNAME% 109 | -------------------------------------------------------------------------------- /WindowsVersionOnDesktop.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ;Display the Build Number on the desktop 4 | [HKEY_CURRENT_USER\Control Panel\Desktop] 5 | "PaintDesktopVersion"=dword:00000001 -------------------------------------------------------------------------------- /active directory one-liners.txt: -------------------------------------------------------------------------------- 1 | # List all Domain Controllers 2 | Nltest /dclist:%userdnsdomain% 3 | 4 | # List stale computer accounts 5 | dsquery computer domainroot -stalepwd 180 -limit 0 6 | 7 | # List stale user accounts 8 | dsquery user domainroot -stalepwd 180 -limit 0 9 | 10 | # List disabled user accounts 11 | dsquery user domainroot -disabled -limit 0 12 | 13 | # AD Database disk usage 14 | for /f %i in ("dsquery server -domain %userdnsdomain% -o rdn") do dir \\%i\admin$\ntds 15 | 16 | # Global Catalog Servers from DNS 17 | dnscmd %logonserver% /enumrecords %userdnsdomain% _tcp | find /i "3268" 18 | 19 | # Global Catalog Servers from AD 20 | dsquery * "CN=Configuration,DC=forestRootDomain" -filter "(&(objectCategory=nTDSDSA)(options:1.2.840.113556.1.4.803:=1))" 21 | 22 | # Users with no logon script 23 | dsquery * domainroot -filter"(&(objectCategory=Person)(objectClass=User)(!scriptPath=*))"-limit 0 -attr sAMAccountName sn givenName pwdLastSet distinguishedName 24 | 25 | # User accounts with no pwd required 26 | dsquery * domainroot -filter "(&(objectCategory=Person)(objectClass=User)(userAccountControl:1.2.840.113556.1.4.803:=32))" 27 | 28 | # User accounts with no pwd expiry 29 | dsquery * domainroot -filter"(&(objectCategory=Person)(objectClass=User)(userAccountControl:1.2.840.113556.1.4.803:=65536))" 30 | 31 | # User accounts that are disabled 32 | dsquery * domainroot -filter "(&(objectCategory=Person)(objectClass=User)(userAccountControl:1.2.840.113556.1.4.803:=2))" 33 | 34 | # DNS Information 35 | for /f %i in ("dsquery server -domain %userdnsdomain% -o rdn") do dnscmd %i /info 36 | 37 | # DNS Zone Detailed information 38 | dnscmd /zoneinfo %userdnsdomain% 39 | 40 | # Garbage Collection and tombstone 41 | dsquery * "cn=Directory Service,cn=WindowsNT,cn=Services,cn=Configuration,DC=forestRootDomain" -attrgarbageCollPeriod tombstoneLifetime 42 | 43 | # List authorised DHCP Servers 44 | netsh dhcp show server 45 | 46 | # DSQuery version of list authorised DHCP Servers 47 | Dsquery * "cn=NetServices,cn=Services,cn=Configuration, DC=forestRootDomain" -attr dhcpServers 48 | 49 | # DHCP server information 50 | netsh dhcp server \\DHCP_SERVER show all 51 | 52 | # DHCP server dump 53 | netsh dhcp server \\DHCP_SERVER dump 54 | 55 | # WINS server information 56 | Netsh wins server \\WINS_SERVER dump 57 | 58 | # Group Policy Verification Tool 59 | gpotool.exe /checkacl /verbose 60 | 61 | # AD OU membership 62 | dsquery computer -limit 0 63 | 64 | # AD OU membership 65 | dsquery user -limit 0 66 | 67 | # List Service Principal Names 68 | for /f %i in ("dsquery server -domain %userdnsdomain% -o rdn") do setspn -L %i 69 | 70 | # List Domain Controller IP Configuration (requires psexec.exe from Sysinternals/Microsoft) 71 | for /f %i in ("dsquery server -domain %userdnsdomain% -o rdn") do psexec \\%i ipconfig /all 72 | 73 | # List DC FSMO Roles 74 | ntdsutilroles Connections "Connect to server %logonserver%" Quit "selectOperation Target" "List roles for conn server" Quit Quit Quit 75 | [JDH: This is really a series of steps, not a single command 76 | expression] 77 | 78 | # Check AD ACLs 79 | acldiag dc=domainTree 80 | 81 | # NTFRS Replica Sets 82 | for /f %i in ("dsquery server -domain %userdnsdomain% -o rdn") do ntfrsutl sets %i 83 | 84 | # NTFRS DS View 85 | for /f %i in ("dsquery server -domain %userdnsdomain% -o rdn") do ntfrsutl ds %i 86 | 87 | # Domain Controllers per site 88 | Dsquery * "CN=Sites,CN=Configuration,DC=forestRootDomain" -filter (objectCategory=Server) 89 | 90 | # DNS Zones in AD 91 | for /f %i in ("dsquery server -o rdn") do Dsquery * -s %i domainroot -filter (objectCategory=dnsZone) 92 | 93 | # Enumerate DNS Server Zones 94 | for /f %i in ("dsquery server -o rdn") do dnscmd %i /enumzones 95 | 96 | # Subnet information 97 | Dsquery subnet ?limit 0 98 | 99 | # List Organisational Units 100 | Dsquery OU 101 | 102 | # ACL on all OUs 103 | For /f "delims=|" %i in ("dsquery OU") do acldiag %i 104 | 105 | # Domain Trusts 106 | nltest /domain_trusts /v 107 | 108 | # Print DNS Zones 109 | dnscmd DNSServer /zoneprint DNSZone 110 | 111 | # List active DHCP leases against a list of DHCP servers specified in DHCPServers.txt 112 | For /f %i in (DHCPServers.txt) do for /f "delims=- " %j in (""netshdhcp server \\%i show scope | find /i "active""") do netsh dhcp server\\%i scope %j show clientsv5 113 | 114 | # DHCP Server Active Scope Info 115 | For /f %i in (DHCPServers.txt) do netsh dhcp server \\%i show scope | find /i "active" 116 | 117 | # Resolve DHCP clients hostnames 118 | for /f "tokens=1,2,3 delims=," %i in (Output from "Find Subnets fromDHCP clients") do @for /f "tokens=2 delims=: " %m in (""nslookup %j |find /i "Name:""") do echo %m,%j,%k,%i 119 | 120 | # Find two online PCs per subnet 121 | Echo. > TwoClientsPerSubnet.txt & for /f "tokens=1,2,3,4delims=, " %i in (""find /i "pc" "Output from Resolve DHCP clientshostnames""") do for /f "tokens=3 skip=1 delims=: " %m in (""Find /i /c"%l" TwoClientsPerSubnet.txt"") do If %m LEQ 1 for /f %p in (""ping -n1 %i | find /i /c "(0% loss""") do If %p==1 Echo %i,%j,%k,%l 122 | 123 | # AD Subnet and Site Information 124 | dsquery * "CN=Subnets,CN=Sites,CN=Configuration,DC=forestRootDomain" -attr cn siteObject description location 125 | 126 | # AD Site Information 127 | dsquery * "CN=Sites,CN=Configuration,DC=forestRootDomain" -attr cn description location -filter (objectClass=site) 128 | 129 | # Printer Queue Objects in AD 130 | dsquery * domainroot -filter "(objectCategory=printQueue)" -limit 0 131 | 132 | # Group Membership with user details 133 | dsget group "groupDN" -members | dsget user -samid -fn -mi -ln -display -empid -desc -office -tel -email -title -dept -mgr 134 | 135 | # Total DHCP Scopes 136 | find /i "subnet" "Output from DHCP server information" | find /i "subnet" 137 | 138 | # List domain site Links and Cost 139 | dsquery * "CN=Sites,CN=Configuration,DC=forestRootDomain" -attr cn costdescription replInterval siteList -filter (objectClass=siteLink) 140 | 141 | # Check local system time against Domain time 142 | w32tm /monitor /computers:ForestRootPDC 143 | 144 | # Domain Controller Diagnostics 145 | dcdiag /s:%logonserver% /v /e /c 146 | 147 | # Domain Replication Bridgeheads 148 | repadmin /bridgeheads 149 | 150 | # Replication Failures from KCC 151 | repadmin /failcache 152 | 153 | # Inter-site Topology servers per site 154 | Repadmin /istg * /verbose 155 | 156 | # Replication latency 157 | repadmin /latency /verbose 158 | 159 | # Queued replication requests 160 | repadmin /queue * 161 | 162 | # Show connections for a DC 163 | repadmin /showconn * 164 | 165 | # Replication summary 166 | Repadmin /replsummary 167 | 168 | # Show replication partners 169 | repadmin /showrepl * /all 170 | 171 | # All DCs in the forest 172 | repadmin /viewlist * 173 | 174 | # ISTG from AD attributes 175 | dsquery * "CN=NTDS Site Settings,CN=siteName,CN=Sites,CN=Configuration,DC=forestRootDomain" -attr interSiteTopologyGenerator 176 | 177 | # Return the object if KCC Intra/Inter site is disabled for each site 178 | Dsquery site | dsquery * -attr * -filter "(|(Options:1.2.840.113556.1.4.803:=1)(Options:1.2.840.113556.1.4.803:=16))" 179 | 180 | # Find all connection objects 181 | dsquery * forestRoot -filter (objectCategory=nTDSConnection) ?attr distinguishedName fromServer whenCreated displayName 182 | 183 | # Find all connection schedules 184 | adfind -b "cn=Configuration,dc=qraps,dc=com,dc=au" -f "objectcategory=ntdsConnection" cn Schedule -csv 185 | 186 | # Software Information for each server, requires psinfo from Microsoft/Sysinternals 187 | for /f %i in (Output from "Domain Controllers") do psinfo \\%i &filever \\%i\admin$\explorer.exe \\%i\admin$\system32\vbscript.dll\\%i\admin$\system32\kernel32.dll \\%i\admin$\system32\wbem\winmgmt.exe\\%i\admin$\system32\oleaut32.dll 188 | 189 | # Check Terminal Services Delete Temp on Exit flag 190 | For /f %i in (Output from "Domain Controllers") do Reg query"\\%i\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TerminalServer" /v DeleteTempDirsOnExit 191 | 192 | # For each XP workstation, query the current site and what Group Policy info 193 | @dsquery * domainroot -filter"(&(objectCategory=Computer)(operatingSystem=Windows XPProfessional))" -limit 0 -attr cn > Workstations.txt & @For /f%i in (Workstations.txt) do @ping %i -n 1 >NUL & @if ErrorLevel0 If NOT ErrorLevel 1 @Echo %i & for /f "tokens=3" %k in (""regquery "\\%i\hklm\software\microsoft\windows\currentversion\grouppolicy\history" /v DCName | Find /i "DCName""") do @for /f %m in(""nltest /server:%i /dsgetsite | find /i /v "completedsuccessfully""") do @echo %i,%k,%m 194 | 195 | # Information on existing GPOs 196 | dsquery * "CN=Policies,CN=System,domainRoot" -filter"(objectCategory=groupPolicyContainer)" -attr displayName cnwhenCreated gPCFileSysPath 197 | 198 | # Copy all Group Policy .pol files 199 | for /f "tokens=1-8 delims=\" %i in ("dir /b /s\\%userdnsdomain%\sysvol\%userdnsdomain%\policies\*.pol") do @echo copy\\%i\%j\%k\%l\%m\%n\%o %m_%n.pol 200 | 201 | # Domain Controller Netlogon entries 202 | for /f %i in ("dsquery server /o rdn") do echo %i & reg query\\%i\hklm\system\currentcontrolset\services\netlogon\parameters 203 | 204 | # WINS Statistics 205 | for /f "tokens=1,2 delims=," %i in (WINSServers.txt) do netsh wins server \\%i show statistics 206 | 207 | # WINS Record counts per server 208 | for /f "tokens=1,2 delims=," %i in (WINSServers.txt) do netsh wins server \\%i show reccount %i 209 | 210 | # WINS Server Information 211 | for /f "tokens=2 delims=," %i in (WINSServers.txt) do netsh wins server \\%i show info 212 | 213 | # WINS Server Dump 214 | for /f "tokens=2 delims=," %i in (WINSServers.txt) do netsh wins server \\%i dump 215 | 216 | # WINS Static Records per Server 217 | netsh wins server \\LocalWINSServer show database servers={} rectype=1 218 | 219 | # Find policy display name given the GUID 220 | dsquery * "CN=Policies,CN=System,DC=domainRoot" -filter (objectCategory=groupPolicyContainer) -attr Name displayName 221 | 222 | # Find empty groups 223 | dsquery * -filter "&(objectCategory=group)(!member=*)" -limit 0-attr whenCreated whenChanged groupType sAMAccountNamedistinguishedName memberOf 224 | 225 | # Find remote NIC bandwidth 226 | wmic /node:%server% path Win32_PerfRawData_Tcpip_NetworkInterface GET Name,CurrentBandwidth 227 | 228 | # Find remote free physical memory 229 | wmic /node:%Computer% path Win32_OperatingSystem GET FreePhysicalMemory 230 | 231 | # Find remote system information 232 | SystemInfo /s %Computer% 233 | 234 | # Disk statistics, including the number of files on the filesystem 235 | chkdsk /i /c 236 | 237 | # Query IIS web sites 238 | iisweb /s %Server% /query "Default Web Site" 239 | 240 | # Check port state and connectivity 241 | portqry -n %server% -e %endpoint% -v 242 | 243 | # Forest/Domain Functional Levels 244 | ldifde -d cn=partitions,cn=configuration,dc=%domain% -r"(|(systemFlags=3)(systemFlags=-2147483648))" -lmsds-behavior-version,dnsroot,ntmixeddomain,NetBIOSName -p subtree -fcon 245 | 246 | # Forest/Domain Functional Levels 247 | dsquery * cn=partitions,cn=configuration,dc=%domain% -filter"(|(systemFlags=3)(systemFlags=-2147483648))" -attrmsDS-Behavior-Version 248 | Name dnsroot ntmixeddomain NetBIOSName 249 | 250 | # Find the parent of a process 251 | wmic path Win32_Process WHERE Name="notepad.exe" GET Name,ParentProcessId 252 | 253 | # Lookup SRV records from DNS 254 | nslookup -type=srv _ldap._tcp.dc._msdcs.{domainRoot} 255 | 256 | # Find when the AD was installed 257 | dsquery * cn=configuration,DC=forestRootDomain -attr whencreated -scope base 258 | 259 | # Enumerate the trusts from the specified domain 260 | dsquery * "CN=System,DC=domainRoot" -filter "(objectClass=trustedDomain)" -attr trustPartner flatName 261 | 262 | # Find a DC for each trusted domain 263 | for /f "skip=1" %i in (""dsquery * CN=System,DC=domainRoot -filter(objectClass=trustedDomain) -attr trustPartner"") do nltest /dsgetdc:%i 264 | 265 | # Check the notification packages installed on all DCs 266 | for /f %i in ("dsquery server /o rdn") do @for /f "tokens=4" %m in(""reg query\\%i\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa /v"Notification Packages" | find /i "Notification""") do @echo %i,%m 267 | 268 | # List ACLs in SDDL format 269 | setacl -on %filepath% -ot file -actn list -lst f:sddl 270 | 271 | # Find out if a user account is currently enabled or disabled 272 | dsquery user DC=%userdnsdomain:.=,DC=% -name %username% | dsget user -disabled -dn 273 | 274 | # Find servers in the domain 275 | dsquery * domainroot -filter "(&(objectCategory=Computer)(objectClass=Computer)(operatingSystem=*Server*))" -limit 0 276 | 277 | # Open DS query window 278 | rundll32 dsquery,OpenQueryWindow 279 | -------------------------------------------------------------------------------- /aexp_nsm_task_tagger.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Purpose: Pulls TASK numbers out of log files and adds them to the log file name 3 | Requirements: Specify your log file directory in the implementationLogs variable 4 | Script searches the change.log's in the directory, extracts the TASK number, and renames the before/change/after log set based on that. If no task #, then no rename occurs. 5 | Author: reddit.com/user/vocatus ( vocatus.gate@gmail.com ) // PGP key: 0x07d1490f82a211a2 6 | Version: 1.0.1 7 | #> 8 | 9 | 10 | 11 | ############# 12 | # VARIABLES # ---------------------- Set these to match your environment ------------------------ # 13 | ############# 14 | # Rules for variables: 15 | # * NO trailing slashes on paths! (bad: c:\directory\ ) 16 | # * Spaces are okay (okay: c:\my folder\with spaces ) 17 | # * Network paths are okay (okay: \\server\share name ) 18 | param ( 19 | # Logging information 20 | #[string]$logpath = "$env:userprofile\root\documents\misc\logs", 21 | [string]$logpath = "c:\logs", 22 | [string]$logfile = "aexp_task_tagger.log", 23 | 24 | # Path to 7z.exe 25 | [string]$SevenZip = "C:\Program Files\7-Zip\7z.exe", 26 | 27 | # Implementation logs directory that we're scanning 28 | [string]$implementationLogs = "$env:userprofile\root\documents\implementation_logs" 29 | #[string]$implementationLogs = "$env:userprofile\implementation_logs" 30 | ) 31 | 32 | 33 | 34 | 35 | 36 | 37 | # ----------------------------- Don't edit anything below this line ----------------------------- # 38 | 39 | 40 | if (test-path "$env:userprofile\desktop\PeerReviewErros.log") {ri "$env:userprofile\desktop\PeerReviewErros.log"} 41 | 42 | 43 | 44 | ################### 45 | # PREP AND CHECKS # 46 | ################### 47 | $SCRIPT_VERSION = "1.0.1" 48 | $SCRIPT_UPDATED = "2017-03-24" 49 | $CUR_DATE=get-date -f "yyyy-MM-dd" 50 | # Get in our directory. We'll be here for the rest of the script 51 | pushd $implementationLogs 52 | # Preload our different arrays for later 53 | # Extract bare file names, then convert to those filenames to strings and store full path of each file 54 | $logsChange = ls $implementationLogs\*change.log -name 55 | $logsBefore = ls $implementationLogs\*before.log -name 56 | $logsAfter = ls $implementationLogs\*after.log -name 57 | $logsChange = ls $logsChange | % { $_.FullName } 58 | $logsBefore = ls $logsBefore | % { $_.FullName } 59 | $logsAfter = ls $logsAfter | % { $_.FullName } 60 | 61 | 62 | 63 | 64 | ################# 65 | # SANITY CHECKS # 66 | ################# 67 | # List of items to make sure they exist before running the script 68 | $pathsToCheck = @( 69 | # Local machine: 7z.exe 70 | "$SevenZip", 71 | # Local machine: Implementation logs 72 | "$implementationLogs" 73 | ) 74 | 75 | # Run the check 76 | foreach ($i in $pathstoCheck) { 77 | if ( -not (test-path -LiteralPath $i)) { 78 | "" 79 | write-host -n " ["; write-host -n "ERROR" -f red; write-host -n "]"; 80 | write-host " Couldn't find the following required item:" 81 | "" 82 | write-host " $i" 83 | "" 84 | write-host " Check paths and permissions and make sure it exists" 85 | $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown'); 86 | return 87 | } 88 | } 89 | 90 | 91 | 92 | 93 | 94 | ########### 95 | # EXECUTE # 96 | ########### 97 | 98 | # Script is wrapped in a function so we can stick the log function at the bottom 99 | function main() { 100 | log "AEXP NSM log file TASK tagging script v$SCRIPT_VERSION" cyan 101 | log "Executing as $env:userdomain\$env:username" darkgray 102 | 103 | # Loop through the logs and rename them, using the Change log as the "anchor" since it' contains the TASK number 104 | foreach ($logfileChange in $logsChange) { 105 | 106 | # Extract the task number from the log and into a variable 107 | $taskNumber = "" # blank it out each loop 108 | $step1 = gc $logfileChange | sls -pattern TASK\d\d\d\d\d\d\d # extract whole line 109 | $step2 = ("$step1" -split "\*\*\*\*\s")[1] # strip leading asterisks 110 | $taskNumber = $step2 -replace "\s\*\*\*\*","" # strip trailing asterisks 111 | $taskNumber = $taskNumber.trim() # strip before and after whitespace 112 | 113 | # If we were able to get a task number go ahead and perform the rename operations 114 | # If we weren't able to extract a TASK number then all the following is skipped and we go on to the next file 115 | # (length being greater than 7 is a somewhat arbitrary check but whatever) 116 | if ($taskNumber.Length -gt 7) { 117 | 118 | # Parse the CHANGE log 119 | if ($logfileChange -match "$taskNumber") { 120 | log "SKIP $taskNumber change.log (already tagged)" 121 | } else { 122 | log "TAG $taskNumber change.log" green 123 | # Build our new file name then do the rename 124 | $logfileChangeNewName = $logfileChange -replace "TASKxxxxxxx","$taskNumber" 125 | Rename-Item $logfileChange $logfileChangeNewName -force 126 | 127 | # Rename the BEFORE log 128 | # Loop through ALL Before logs and compare them to the working Change log to find a match 129 | foreach ($logfileBefore in $logsBefore) { 130 | # This is really ugly but here's the explanation: 131 | # We're basically doing an AND comparison on the date/time stamp (down to the hour) and the IP address/hostname in the "before" log file names 132 | # If BOTH match, then we assume we've found a matching log set and rename accordingly 133 | # The use of the split function is to strip out the path and leave only the file name 134 | # The use of the substring function is to extract the IP address/hostname for comparison 135 | if ($logfileBefore.split("\\")[-1].substring(0,14) -eq $logfileChange.split("\\")[-1].substring(0,14) -and $logfileBefore.split("-")[-2] -eq $logfileChange.split("-")[-2]) { 136 | 137 | # Rename the Before log 138 | if ($logfileBefore -match "$taskNumber") { 139 | log "SKIP $taskNumber before.log (already tagged)" 140 | } else { 141 | log "TAG $taskNumber before.log" green 142 | 143 | # Make some variables to use in the log messages 144 | $logfileChangeMatch = $logfileChange.split("\\")[-1] 145 | $logfileBeforeMatch = $logfileBefore.split("\\")[-1] 146 | 147 | # Log the match 148 | logNoDateTimeStamp "$logfileChangeMatch" 149 | logNoDateTimeStamp "$logfileBeforeMatch" 150 | 151 | # Build our new file name then do the rename 152 | $logfileBeforeNewName = $logfileBefore -replace "TASKxxxxxxx","$taskNumber" 153 | Rename-Item $logfileBefore $logfileBeforeNewName -force 154 | } 155 | } 156 | } 157 | 158 | 159 | # Rename the AFTER log 160 | # Loop through ALL After logs and compare them to the working Change log to find a match 161 | foreach ($logfileAfter in $logsAfter) { 162 | if ($logfileAfter.split("\\")[-1].substring(0,14) -eq $logfileChange.split("\\")[-1].substring(0,14) -and $logfileAfter.split("-")[-2] -eq $logfileChange.split("-")[-2]) { 163 | 164 | # Rename the After log 165 | if ($logfileAfter -match "$taskNumber") { 166 | log "SKIP $taskNumber after.log (already tagged)" 167 | } else { 168 | log "TAG $taskNumber after.log" green 169 | 170 | # Make some variables to use in the log messages 171 | $logfileChangeMatch = $logfileChange.split("\\")[-1] 172 | $logfileAfterMatch = $logfileAfter.split("\\")[-1] 173 | 174 | # Log the match 175 | logNoDateTimeStamp "$logfileChangeMatch" 176 | logNoDateTimeStamp "$logfileAfterMatch" 177 | 178 | # Build our new file name then do the rename 179 | $logfileAfterNewName = $logfileAfter -replace "TASKxxxxxxx","$taskNumber" 180 | Rename-Item $logfileAfter $logfileAfterNewName -force 181 | } 182 | } 183 | } 184 | } 185 | } else { 186 | $x = $logfileChange.split("\\")[-1] #hacky workaround so the log function doesn't blow up 187 | log "PASS (no task #) $x" darkyellow 188 | } 189 | 190 | } # End rename loop 191 | 192 | 193 | 194 | # Finished 195 | log "COMPLETE" cyan 196 | popd 197 | pause 198 | } # End main function 199 | 200 | 201 | 202 | 203 | 204 | ############# 205 | # FUNCTIONS # 206 | ############# 207 | function log($message, $color) 208 | { 209 | if ($color -eq $null) {$color = "gray"} 210 | 211 | write-host (get-date -f "yyyy-MM-dd hh:mm:ss") -n -f darkgray; write-host " $message" -f $color 212 | (get-date -f "yyyy-MM-dd hh:mm:ss") +" $message" | out-file -Filepath "c:\logs\add_task_number_to_log_names.log" -append 213 | #(get-date -f "yyyy-mm-dd hh:mm:ss") +"$message" | out-file -Filepath "$logpath\$logfile" -append 214 | } 215 | 216 | function logNoDateTimeStamp($message, $color) 217 | { 218 | if ($color -eq $null) {$color = "gray"} 219 | 220 | write-host " $message" -f $color 221 | " $message" | out-file -Filepath "c:\logs\add_task_number_to_log_names.log" -append 222 | } 223 | 224 | 225 | 226 | 227 | # call the main script 228 | main 229 | -------------------------------------------------------------------------------- /ahk_v2_rapid_mouse_click_capslock_toggle.ahk: -------------------------------------------------------------------------------- 1 | ; taken from https://www.autohotkey.com/boards/viewtopic.php?style=1&f=95&t=115469 2 | ; Enables rapid mouse clicks (left mouse button) when CapsLock is toggled (one tap: script activated, second tap, script de-activated) 3 | ; Emits PC speaker-style audio beep when toggled 4 | ; Default delay between clicks is 375ms (line 17). Change this up or down if it overloads the CPU and/or software 5 | ; This only works in AutoHotKey v2.0 6 | #Requires AutoHotkey v2.0 7 | ; Taken from 8 | auto := False 9 | 10 | CapsLock:: { 11 | Global auto := !auto 12 | SoundBeep 1000 + 500 * auto 13 | } 14 | 15 | #HotIf auto 16 | LButton:: { 17 | SetKeyDelay 375, 375 18 | While GetKeyState(ThisHotkey, "P") 19 | SendEvent '{' ThisHotkey '}' 20 | } 21 | #HotIf 22 | F10::ExitApp 23 | -------------------------------------------------------------------------------- /caffeine.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/caffeine.exe -------------------------------------------------------------------------------- /clean_MKV_data.bat: -------------------------------------------------------------------------------- 1 | :: Purpose: Cleans all metadata off supported media files (typically MKV) 2 | :: Requirements: Edit the script to specify location of mkvpropedit.exe and the directory to clean. Operates recursively. 3 | :: Author: reddit.com/user/vocatus ( vocatus.gate at gmail ) // PGP key: 0x07d1490f82a211a2 4 | :: Version: 1.0.0 + Initial write 5 | 6 | 7 | ::::::::::::::: 8 | :: VARIABLES :: ---- Set these to your desired values. The defaults should work fine though ------ :: 9 | ::::::::::::::: 10 | :: Rules for variables: 11 | :: * NO quotes! (bad: "c:\directory\path" ) 12 | :: * NO trailing slashes on the path! (bad: c:\directory\ ) 13 | :: * Spaces are okay (okay: c:\my folder\with spaces ) 14 | :: * Network paths are okay (okay: \\server\share name ) 15 | :: ( \\172.16.1.5\share name ) 16 | 17 | :: Log settings 18 | set LOGPATH=%SystemDrive%\logs 19 | set LOGFILE=%COMPUTERNAME%_clean_MKV_data.log 20 | 21 | :: Set these variables 22 | set MKVPROPEDIT=R:\utilities\cli_utils\mkvpropedit.exe 23 | set TARGETDIR=\\10.0.0.4\Media\TV Shows 24 | 25 | 26 | 27 | ::::::::::::::::::::: 28 | :: PREP AND CHECKS :: 29 | ::::::::::::::::::::: 30 | @echo off && cls 31 | set SCRIPT_VERSION=1.0.0 32 | set SCRIPT_UPDATED=2024-05-12 33 | :: Get the date into ISO 8601 standard format (yyyy-mm-dd) so we can use it 34 | FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a 35 | set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% 36 | 37 | title Clean MKV Data v%SCRIPT_VERSION% (%SCRIPT_UPDATED%) 38 | 39 | 40 | ::::::::::::: 41 | :: EXECUTE :: 42 | ::::::::::::: 43 | pushd "%TARGETDIR%" 44 | 45 | for /r %%i in (*.mkv,*.webm,*.mp4) do ( 46 | echo %CUR_DATE% Processing "%%i" 47 | echo %CUR_DATE% Processing "%%i" >> "%LOGPATH%\%LOGFILE%" 2>NUL 48 | "%MKVPROPEDIT%" "%%i" -d title >> "%LOGPATH%\%LOGFILE%" 2>NUL 49 | ) 50 | 51 | popd 52 | pause 53 | -------------------------------------------------------------------------------- /clear_Windows_event_logs.bat: -------------------------------------------------------------------------------- 1 | :: Purpose: Clears all event logs on a Windows system 2 | :: Requirements: Administrative rights 3 | :: Author: reddit.com/user/vocatus ( vocatus.gate at gmail ) // PGP key: 0x07d1490f82a211a2 4 | :: History: 1.0.0 Initial write 5 | 6 | :::::::::: 7 | :: Prep :: -- Don't change anything in this section 8 | :::::::::: 9 | @echo off 10 | set SCRIPT_VERSION=1.0.0 11 | set SCRIPT_UPDATED=2014-06-10 12 | :: Get the date into ISO 8601 standard format (yyyy-mm-dd) so we can use it 13 | FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a 14 | set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% 15 | echo. 16 | echo Clearing event logs... 17 | echo. 18 | 19 | :: Perform the clear 20 | for /f %%x in ('wevtutil el') do wevtutil cl "%%x" 21 | 22 | :: finished 23 | echo. 24 | echo It's done. 25 | echo. 26 | pause -------------------------------------------------------------------------------- /clear_stuck_print_jobs.bat: -------------------------------------------------------------------------------- 1 | :: Purpose: Flushes the Windows printer queue when it's full and stuck 2 | :: Requirements: Must run as administrator 3 | :: Author: reddit.com/user/vocatus ( vocatus.gate at gmail ) // PGP key: 0x07d1490f82a211a2 4 | :: Version: 1.0.1 * Reworked CUR_DATE variable to handle more than one Date/Time format 5 | :: Can now handle all Windows date formats 6 | :: 1.0.0 Initial write 7 | 8 | 9 | :::::::::: 10 | :: Prep :: -- Don't change anything in this section 11 | :::::::::: 12 | @echo off 13 | set SCRIPT_VERSION=1.0.1 14 | set SCRIPT_UPDATED=2014-01-27 15 | :: Get the date into ISO 8601 standard format (yyyy-mm-dd) so we can use it 16 | FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a 17 | set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% 18 | cls 19 | 20 | ::::::::::::::: 21 | :: VARIABLES :: -- Set these to your desired values 22 | ::::::::::::::: 23 | :: No user-set variables in this script 24 | 25 | 26 | ::::::::::::::: 27 | :: Execution :: 28 | ::::::::::::::: 29 | echo Stopping print spooler. 30 | echo. 31 | net stop spooler 32 | echo Deleting old print jobs... 33 | echo. 34 | FOR %%i IN (%systemroot%\system32\spool\printers\*.*) DO DEL %%i 35 | echo Starting print spooler. 36 | echo. 37 | net start spooler 38 | -------------------------------------------------------------------------------- /convert_archives_to_7z.bat: -------------------------------------------------------------------------------- 1 | :: Purpose: Recursively converts all .rar and .zip files to the .7z format at max compression 2 | :: Requirements: 1. Specify the location of 7z.exe (below in variables section) 3 | :: 2. Specify the desired archive formats to convert (below in variables section) 4 | :: Author: vocatus.gate@gmail.com // github.com/bmrf // reddit.com/user/vocatus // PGP: 0x07d1490f82a211a2 5 | :: Usage: 1. Place this file in the top-level directory containing the files you want to convert 6 | :: 2. Run this file (preferably with Administrator rights, although it's not strictly necessary) 7 | :: History: 1.0.4 + Add rudimentary conversion verification, to avoid removing source file if conversion failed. Thanks to u/CompWizrd 8 | :: + Add creation of log directory if it doesn't exist. Thanks to u/jimicus 9 | :: 1.0.3 + Add multithreading and compression level 9 (highest) 10 | :: 1.0.2 + Add logging 11 | :: 1.0.1 + Add recursion 12 | :: 1.0.0 + Initial write 13 | @echo off 14 | 15 | 16 | ::::::::::::::: 17 | :: VARIABLES :: -- Set these to your desired values 18 | ::::::::::::::: 19 | set SEVENZIP=%ProgramFiles%\7-Zip\7z.exe 20 | set FILETYPES=*.rar *.zip 21 | set LOGPATH=%SystemDrive%\logs 22 | set LOGFILE=%COMPUTERNAME%_convert_archives_to_7z.log 23 | 24 | 25 | ::::::::::::::::::::: 26 | :: PREP AND CHECKS :: 27 | ::::::::::::::::::::: 28 | set SCRIPT_VERSION=1.0.4 29 | set SCRIPT_UPDATED=2022-12-18 30 | :: Get the date into ISO 8601 standard format (yyyy-mm-dd) so we can use it 31 | for /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') do set DTS=%%a 32 | set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% 33 | :: Create the log directory if it doesn't exist 34 | if not exist %LOGPATH% mkdir %LOGPATH% 35 | 36 | 37 | ::::::::::::: 38 | :: EXECUTE :: 39 | ::::::::::::: 40 | :: Get in the correct drive (~d0) and path (~dp0). Sometimes needed when run from a network or thumb drive. 41 | %~d0 2>NUL 42 | pushd "%~dp0" 2>NUL 43 | 44 | 45 | :: Header 46 | echo. 47 | call :log " CONVERT ARCHIVES TO .7z FORMAT v%SCRIPT_VERSION% (%SCRIPT_UPDATED%)" 48 | echo. 49 | call :log " Script: github.com/bmrf/standalone_scripts" 50 | call :log " Logfile: %LOGPATH%\%LOGFILE%" 51 | call :log " Filetypes: %FILETYPES%" 52 | echo. 53 | call :log " Recursively repacks various archive formats to 7-Zip's" 54 | call :log " .7z format, configured for maximum compression. Starts" 55 | call :log " from the directory you ran it from." 56 | echo. 57 | echo ORIGINAL ARCHIVES WILL BE REPLACED WITH .7z VERSION! 58 | echo. 59 | echo Proceed? 60 | echo. 61 | pause 62 | echo. 63 | 64 | :: Begin conversion 65 | call :log "%CUR_DATE% %TIME% Converting files..." 66 | 67 | :: For each file, extract it to a temp folder, re-pack it, and delete the original file 68 | setlocal enabledelayedexpansion 69 | for /r %%f in (%FILETYPES%) do ( 70 | 71 | :: Build some easier to read variables 72 | set FILE=%%f 73 | set FILE_NO_EXT=%%~nf 74 | set FILE_PATH=%%~dpf 75 | set NEW_FILE=!FILE_NO_EXT!.7z 76 | set UNPACK_DIR=!FILE_PATH!!FILE_NO_EXT!_tmp 77 | 78 | :: Do the conversion 79 | call :log "%CUR_DATE% %TIME% !FILE!..." 80 | "%SEVENZIP%" x -y -o"!UNPACK_DIR!" "!FILE!" * >> %LOGPATH%\%LOGFILE% 2>&1 81 | pushd "!UNPACK_DIR!" 82 | "%SEVENZIP%" a -y -r -mmt4 -mx9 -t7z ..\"!NEW_FILE!" * >> %LOGPATH%\%LOGFILE% 2>&1 83 | 84 | :: Make sure we were able to create the .7z archive before deleting the original file 85 | if exist ..\"!NEW_FILE!" ( 86 | del /f /q "!FILE!" >> %LOGPATH%\%LOGFILE% 2>&1 87 | ) else ( 88 | call :log "%CUR_DATE% %TIME% ^^^! Conversion verification of '!FILE!' failed, original not removed." 89 | ) 90 | popd 91 | 92 | :: Cleanup unpack directory 93 | rmdir /s /q "!UNPACK_DIR!" >> %LOGPATH%\%LOGFILE% 2>&1 94 | ) 95 | endlocal 96 | 97 | call :log "%CUR_DATE% %TIME% Conversion complete." 98 | echo. 99 | 100 | 101 | 102 | 103 | ::::::::::::::: 104 | :: FUNCTIONS :: 105 | ::::::::::::::: 106 | :log 107 | echo:%~1 >> "%LOGPATH%\%LOGFILE%" 108 | echo:%~1 109 | goto :eof 110 | -------------------------------------------------------------------------------- /deploy_file_to_systems.bat: -------------------------------------------------------------------------------- 1 | :: Purpose: Deploys a file to remote system(s) 2 | :: Requirements: 1. Administrative rights on the target machines 3 | :: 2. The file you are deploying must be in the same directory as this file 4 | :: 3. The list of systems you are deploying to must be in the same directory as this file 5 | :: Author: vocatus.gate@gmail.com // github.com/bmrf // reddit.com/user/vocatus // PGP: 0x07d1490f82a211a2 6 | :: Usage: Run like this: .\deploy_file_to_systems.bat 7 | :: History: 1.0.1 * Create destination directory if it doesn't already exist 8 | :: + Add more complete logging 9 | :: 1.0.0 + Initial write 10 | 11 | 12 | 13 | ::::::::::::::: 14 | :: VARIABLES :: ---- Set these to your desired values 15 | ::::::::::::::: 16 | :: Rules for variables: 17 | :: * NO quotes! (bad: "%SystemDrive%\directory\path" ) 18 | :: * NO trailing slashes on the path! (bad: %SystemDrive%\directory\ ) 19 | :: * Spaces are okay (okay: %SystemDrive%\my folder\with spaces ) 20 | :: * Network paths are okay (okay: \\server\share name ) 21 | :: ( \\172.16.1.5\share name ) 22 | 23 | :: Log settings 24 | set LOGPATH=%SystemDrive%\logs 25 | set LOGFILE=deploy_file_to_systems.log 26 | 27 | :: Target information 28 | set SYSTEMS=systems.txt 29 | set FILE=Registry.pol 30 | set FILE2=lgpo.exe 31 | 32 | :: PSexec location 33 | :: set PSEXEC=psexec.exe 34 | 35 | 36 | ::::::::::::::::::::: 37 | :: PREP AND CHECKS :: 38 | ::::::::::::::::::::: 39 | @echo off && cls 40 | set FILE_VERSION=1.0.1 41 | set FILE_UPDATED=2020-07-16 42 | :: Get the date into ISO 8601 standard format (yyyy-mm-dd) so we can use it 43 | FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a 44 | set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% 45 | 46 | :: Set title 47 | title Deploying %FILE% to targets... 48 | 49 | :: Make log directory if it doesn't exist 50 | if not exist "%LOGPATH%" mkdir "%LOGPATH%" 51 | 52 | :: Check that the target list exists 53 | if not exist "%SYSTEMS%" ( 54 | echo. 55 | echo ERROR: Cannot find %SYSTEMS% 56 | echo. 57 | echo Place %SYSTEMS% in the same 58 | echo directory as this script. 59 | echo. 60 | pause 61 | goto :eof 62 | ) 63 | 64 | :: Check that our FILE exists 65 | if not exist "%FILE%" ( 66 | echo. 67 | echo ERROR: Cannot find %FILE% 68 | echo. 69 | echo Place %FILE% in the same 70 | echo directory as this script. 71 | echo. 72 | pause 73 | goto :eof 74 | ) 75 | 76 | :: Check that our FILE2 exists 77 | if not exist "%FILE2%" ( 78 | echo. 79 | echo ERROR: Cannot find %FILE2% 80 | echo. 81 | echo Place %FILE2% in the same 82 | echo directory as this script. 83 | echo. 84 | pause 85 | goto :eof 86 | ) 87 | 88 | :: Check that psexec exists 89 | ::if not exist "%PSEXEC%" ( 90 | :: echo. 91 | :: echo ERROR: Cannot find %PSEXEC% 92 | :: echo. 93 | :: echo Place %PSEXEC% in the same 94 | :: echo directory as this script. 95 | :: echo. 96 | :: pause 97 | :: goto :eof 98 | ::) 99 | 100 | 101 | 102 | ::::::::::::: 103 | :: EXECUTE :: 104 | ::::::::::::: 105 | 106 | 107 | echo %CUR_DATE% %TIME% Deploying %FILE% to systems listed in %SYSTEMS%... 108 | echo %CUR_DATE% %TIME% Deploying %FILE% to systems listed in %SYSTEMS%...>> "%LOGPATH%\%LOGFILE%" 2>&1 109 | 110 | :: Upload the file to the remote system(s) 111 | SETLOCAL ENABLEDELAYEDEXPANSION 112 | for /f %%i in (%SYSTEMS%) do ( 113 | ping %%i -n 1 >nul 114 | if /i not !ERRORLEVEL!==0 ( 115 | echo %CUR_DATE% %TIME% ^! %%i seems to be offline, skipping... 116 | echo %CUR_DATE% %TIME% ^! %%i seems to be offline, skipping...>> "%LOGPATH%\%LOGFILE%" 2>&1 117 | ) else ( 118 | if not exist "\\%%i\c$\temp" mkdir "\\%%i\c$\temp" >> "%LOGPATH%\%LOGFILE%" 2>&1 119 | copy %FILE% /y "\\%%i\c$\temp\" >> "%LOGPATH%\%LOGFILE%" 2>&1 120 | copy %FILE2% /y "\\%%i\c$\temp\" >> "%LOGPATH%\%LOGFILE%" 2>&1 121 | echo %CUR_DATE% %TIME% Uploaded to %%i. 122 | echo %CUR_DATE% %TIME% Uploaded to %%i.>> "%LOGPATH%\%LOGFILE%" 2>&1 123 | 124 | :: wait for process to finish - DISABLED, was only used once 125 | :: we use cmd /c prefix to allow us to capture remote system output in the local log file 126 | :: %PSEXEC% -accepteula -nobanner -n 3 \\%%i cmd /c "c:\temp\lgpo.exe /v /m c:\temp\Registry.pol" >> "%LOGPATH%\%LOGFILE%" 2>&1 127 | 128 | :: don't wait for process to finish 129 | :: %PSEXEC% -accepteula -nobanner -n 3 -d \\%%i cmd /c "c:\temp\lgpo.exe /v /m c:\temp\Registry.pol" >> "%LOGPATH%\%LOGFILE%" 2>&1 130 | 131 | :: Cleanup 132 | echo %CUR_DATE% %TIME% Cleaning up on %%i... 133 | echo %CUR_DATE% %TIME% Cleaning up on %%i...>> "%LOGPATH%\%LOGFILE%" 2>&1 134 | del /f /q "\\%%i\c\$\temp\%FILE%" 135 | del /f /q "\\%%i\c\$\temp\%FILE2%" 136 | echo %CUR_DATE% %TIME% Cleanup done, moving to next system. 137 | echo %CUR_DATE% %TIME% Cleanup done, moving to next system.>> "%LOGPATH%\%LOGFILE%" 2>&1 138 | ) 139 | ) 140 | ENDLOCAL 141 | 142 | 143 | :: Done 144 | echo. 145 | echo %CUR_DATE% %TIME% Done. 146 | echo %CUR_DATE% %TIME% Done.>> "%LOGPATH%\%LOGFILE%" 2>&1 147 | 148 | 149 | 150 | 151 | :eof 152 | -------------------------------------------------------------------------------- /disable_shortcut_to_text.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/disable_shortcut_to_text.reg -------------------------------------------------------------------------------- /disable_win_s_hotkey.bat: -------------------------------------------------------------------------------- 1 | reg.exe add HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced /v DisabledHotkeys /t REG_SZ /d S /f 2 | reg.exe add HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\OneNote\Options\Other /v ScreenClippingShortcutKey /t REG_DWORD /d 90 /f -------------------------------------------------------------------------------- /enable_Powershell_scripts_run_by_double-clicking.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/enable_Powershell_scripts_run_by_double-clicking.reg -------------------------------------------------------------------------------- /icehost.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # ARP poison a host to isolate it from the network 4 | # Requires root 5 | # Requires ettercap 6 | 7 | 8 | # Variables - general 9 | version="0.9.0" 10 | updated="2016-04-09" 11 | author="vocatus gate" 12 | 13 | # Variables - script specific 14 | target=$1 15 | 16 | # Error checking 17 | if [[ $# = 0 ]]; then 18 | echo -e "\033[1m Usage\033[0m: ./icehost.sh [target to blackhole]" 19 | exit 1 20 | fi 21 | 22 | 23 | # Execution 24 | echo 25 | echo ARP poisoning $target 26 | echo 27 | ettercap -i eth0 -TqzP isolate //$target// //// 28 | 29 | -------------------------------------------------------------------------------- /keepSystemAwake.ps1: -------------------------------------------------------------------------------- 1 | param($minutes = 3) 2 | 3 | $myshell = New-Object -com "Wscript.Shell" 4 | 5 | for ($i = 0; $i -lt $minutes; $i++) { 6 | Start-Sleep -Seconds 60 7 | $myshell.sendkeys(".") 8 | } -------------------------------------------------------------------------------- /launch_vmware_workstation.bat: -------------------------------------------------------------------------------- 1 | :: Purpose: Starts and stops the services required by VMWare Workstation 2 | :: Frees up roughly 33MB of RAM 3 | :: Requirements: VMware workstation installed 4 | :: Author: reddit.com/user/vocatus ( vocatus.gate at gmail ) // PGP key: 0x07d1490f82a211a2 5 | :: History: 1.1.2 ! Add /y switch to VMwareAuthD stop command to force through prompt 6 | :: 1.1.1 * Converted GOTO's to FOR loops 7 | :: 1.1.0 * Reworked CUR_DATE variable to handle more than one Date/Time format 8 | :: Can now handle all Windows date formats 9 | :: 1.0.0 Initial write 10 | 11 | 12 | 13 | :::::::::: 14 | :: Prep :: 15 | :::::::::: 16 | @echo off 17 | cls 18 | set SCRIPT_VERSION=1.1.2 19 | set SCRIPT_UPDATED=2019-12-19 20 | :: Get the date into ISO 8601 standard format (yyyy-mm-dd) so we can use it 21 | FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a 22 | set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% 23 | 24 | 25 | ::::::::::::: 26 | :: EXECUTE :: 27 | ::::::::::::: 28 | :: If we passed "start" or "stop" to the batch file then just directly run that portion 29 | if /i '%1'=='-stop' set CHOICE=stop && goto evaluate 30 | if /i '%1'=='-start' set CHOICE=start && goto evaluate 31 | 32 | echo. 33 | echo Stops and starts the services required by VMware Workstation. 34 | echo. 35 | set /p CHOICE=Enter 'stop', 'start' or 'exit': 36 | 37 | 38 | :evaluate 39 | if %CHOICE%==stop ( 40 | net stop VMnetDHCP 41 | net stop VMwareHostd 42 | net stop VMAuthdService 43 | net stop "VMware NAT Service" 44 | net stop VMUSBArbService 45 | sc config VMnetDHCP start= disabled 46 | sc config VMwareHostd start= disabled 47 | sc config VMAuthdService start= disabled 48 | sc config "VMware NAT Service" start= disabled 49 | sc config VMUSBArbService start= disabled 50 | ) 51 | 52 | if %CHOICE%==start ( 53 | sc config VMnetDHCP start= demand 54 | sc config VMwareHostd start= demand 55 | sc config VMAuthdService start= demand 56 | sc config "VMware NAT Service" start= demand 57 | sc config VMUSBArbService start= demand 58 | net start VMnetDHCP 59 | net start VMwareHostd 60 | net start "VMware NAT Service" 61 | echo. 62 | echo You can minimize this window, it will stay open until VMware Workstation closes. 63 | echo. 64 | "%ProgramFiles(x86)%\VMware\VMware Workstation\vmware.exe" 65 | net stop VMnetDHCP 66 | net stop VMwareHostd 67 | net stop VMAuthdService /y 68 | net stop "VMware NAT Service" 69 | net stop VMUSBArbService 70 | sc config VMnetDHCP start= disabled 71 | sc config VMwareHostd start= disabled 72 | sc config VMAuthdService start= disabled 73 | sc config "VMware NAT Service" start= disabled 74 | sc config VMUSBArbService start= disabled 75 | ) 76 | 77 | :: These get automatically started for dependencies so there's no need to start them manually 78 | ::net start VMAuthdService 79 | ::net start VMUSBArbService 80 | 81 | :end 82 | -------------------------------------------------------------------------------- /librenms/better_default_alert_template: -------------------------------------------------------------------------------- 1 | 8 | 9 | @if ( $alert->state == 0 ) {{ $alert->title }} 10 | @elseif ( $alert->state == 1 ) 11 | @if ( $alert->severity == "critical" ) {{ $alert->title }} 12 | @else ( $alert->severity == "warning" ) {{ $alert->title }} 13 | @endif 14 | @endif 15 | 16 |
17 |
18 | Hostname: {{$alert->sysName}} ({{ $alert->ip }})
19 | Location: {{ $alert->location }}
20 | Description: {{ $alert->description }}
21 | Device type: {{ $alert->type }}
22 | Hardware: {{ $alert->hardware }}
23 | Uptime: {{ $alert->uptime_long }}
24 | Severity: {{ $alert->severity }}
25 | Timestamp: {{ $alert->timestamp }}
26 | Unique-ID: {{ $alert->uid }}
27 | Rule: @if ($alert->name) {{ $alert->name }} @else {{ $alert->rule }} @endif
28 | @if ($alert->state == 0)Fault duration: {{ $alert->elapsed }} @endif
29 |
30 | 31 | @if ($alert->faults) Faults:
32 | @foreach ($alert->faults as $key => $value) -- #{{ $key }}: {{ $value['string'] }}
33 | @endforeach @endif 34 | -------------------------------------------------------------------------------- /librenms/device_rebooted_template: -------------------------------------------------------------------------------- 1 | 8 | 9 | {{ $alert->title }} 10 |
11 |
12 | Hostname: {{$alert->sysName}} ({{ $alert->ip }})
13 | Location: {{ $alert->location }}
14 | Description: {{ $alert->description }}
15 | Device type: {{ $alert->type }}
16 | Hardware: {{ $alert->hardware }}
17 | Uptime: {{ $alert->uptime_long }}
18 | Severity: {{ $alert->severity }}
19 | Timestamp: {{ $alert->timestamp }}
20 | Unique-ID: {{ $alert->uid }}
21 | Rule: @if ($alert->name) {{ $alert->name }} @else {{ $alert->rule }} @endif
22 | @if ($alert->state == 0)Fault duration: {{ $alert->elapsed }} @endif
23 |
24 | 25 | @if ($alert->faults) Faults:
26 | @foreach ($alert->faults as $key => $value) -- #{{ $key }}: {{ $value['string'] }}
27 | @endforeach @endif 28 | -------------------------------------------------------------------------------- /librenms/disk_space_low_alert_template: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | @if ( $alert->state == 0 ) {{ $alert->title }} 11 | @elseif ( $alert->state == 1 ) 12 | @if ( $alert->severity == "critical" ) {{ $alert->title }} 13 | @else ( $alert->severity == "warning" ) {{ $alert->title }} 14 | @endif 15 | @endif 16 |
17 |
18 | Hostname: {{$alert->sysName}} ({{ $alert->ip }})
19 | Uptime: {{ $alert->uptime_long }}
20 | Location: {{ $alert->location }}
21 | OS: {{ LibreNMS\Config::getOsSetting($alert->os, 'text') }} {{ $alert->version }}
22 | 23 | @if ($alert->hardware) 24 | Hardware: {{ $alert->hardware }}
25 | @endif 26 | 27 | @if ($alert->state == 0) 28 | Fault duration: {{ $alert->elapsed }}
29 | @endif 30 | 31 | Timestamp: {{ $alert->timestamp }}
32 | Unique-ID: {{ $alert->uid }}
33 | 34 | @foreach ($alert->faults as $key => $value) 35 | Drive: {{ $value['storage_descr'] }}
36 | -- Utilization: {{ $value['storage_perc'] }}%
37 | -- Size: {{ number_format($value['storage_size']/1073741824,2) }} GB
38 | -- Free: {{ number_format($value['storage_free']/1073741824,2) }} GB
39 | @endforeach 40 | -------------------------------------------------------------------------------- /librenms/firewall_port_down_template: -------------------------------------------------------------------------------- 1 | 8 | 9 | @if ( $alert->state == 0 ) {{ $alert->title }} 10 | @elseif ( $alert->state == 1 ) 11 | @if ( $alert->severity == "critical" ) {{ $alert->title }} 12 | @else ( $alert->severity == "warning" ) {{ $alert->title }} 13 | @endif 14 | @endif 15 | 16 | @if ( $alert->state == 0 ) {{ $alert->title }} 17 | @elseif ( $alert->state == 1 ) 18 | @if ( $alert->severity == "critical" ) {{ $alert->title }} 19 | @else ( $alert->severity == "warning" ) {{ $alert->title }} 20 | @endif 21 | @endif 22 | 23 |
24 |
25 | Hostname: {{$alert->sysName}} ({{ $alert->ip }})
26 | Location: {{ $alert->location }}
27 | Description: {{ $alert->description }}
28 | Device type: {{ $alert->type }}
29 | Hardware: {{ $alert->hardware }}
30 | Uptime: {{ $alert->uptime_long }}
31 | Severity: {{ $alert->severity }}
32 | Timestamp: {{ $alert->timestamp }}
33 | Unique-ID: {{ $alert->uid }}
34 | Rule: @if ($alert->name) {{ $alert->name }} @else {{ $alert->rule }} @endif
35 | @if ($alert->state == 0)Fault duration: {{ $alert->elapsed }} @endif
36 |
37 | 38 | @if ($alert->faults) Faults:
39 | @foreach ($alert->faults as $key => $value) 40 | -- #{{ $key }}: {{ $value['ifDescr'] }}
41 | @endforeach 42 | @endif 43 | -------------------------------------------------------------------------------- /librenms/microsoft_teams_alert_template: -------------------------------------------------------------------------------- 1 | { 2 | "@context": "https://schema.org/extensions", 3 | "@type": "MessageCard", 4 | "title": "{{ $alert->title }}", 5 | @if ($alert->state === 0) 6 | "themeColor": "00FF00", 7 | @elseif ($alert->state === 1) 8 | "themeColor": "FF0000", 9 | @elseif ($alert->state === 2) 10 | "themeColor": "337AB7", 11 | @elseif ($alert->state === 3) 12 | "themeColor": "FF0000", 13 | @elseif ($alert->state === 4) 14 | "themeColor": "F0AD4E", 15 | @else 16 | "themeColor": "337AB7", 17 | @endif 18 | "summary": "Network Alert", 19 | "sections": [ 20 | { 21 | @if ($alert->name) 22 | "facts": [ 23 | { 24 | "name": "Rule:", 25 | "value": "[{{ $alert->name }}](http://http://10.51.1.213/device/device={{ $alert->device_id }}/tab=alert/)" 26 | }, 27 | @else 28 | { 29 | "name": "Rule:", 30 | "value": "[{{ $alert->rule }}](http://http://10.51.1.213/device/device={{ $alert->device_id }}/tab=alert/)" 31 | }, 32 | @endif 33 | { 34 | "name": "Severity:", 35 | "value": "{{ $alert->severity }}" 36 | }, 37 | { 38 | "name": "Unique-ID:", 39 | "value": "{{ $alert->uid }}" 40 | }, 41 | { 42 | "name": "Timestamp:", 43 | "value": "{{ $alert->timestamp }}" 44 | }, 45 | @if ($alert->state == 0) 46 | { 47 | "name": "Time elapsed:", 48 | "value": "{{ $alert->elapsed }}" 49 | }, 50 | @endif 51 | { 52 | "name": "Hostname:", 53 | "value": "[{{ $alert->hostname }}](http://http://10.51.1.213/device/device={{ $alert->device_id }}/)" 54 | }, 55 | { 56 | "name": "Hardware:", 57 | "value": "{{ $alert->hardware }}" 58 | }, 59 | { 60 | "name": "IP:", 61 | "value": "{{ $alert->ip }}" 62 | }, 63 | { 64 | "name": "Faults:", 65 | "value": " " 66 | } 67 | ] 68 | @if ($alert->faults) 69 | @foreach ($alert->faults as $key => $value) 70 | }, 71 | { 72 | "facts": [ 73 | { 74 | "name": "Port:", 75 | "value": "[{{ $value['ifName'] }}](http://http://10.51.1.213/device/device={{ $alert->device_id }}/tab=port/port={{ $value['port_id'] }}/)" 76 | }, 77 | { 78 | "name": "Description:", 79 | "value": "{{ $value['ifAlias'] }}" 80 | }, 81 | @if ($alert->state != 0) 82 | { 83 | "name": "Status:", 84 | "value": "down" 85 | } 86 | ] 87 | @else 88 | { 89 | "name": "Status:", 90 | "value": "up" 91 | } 92 | ] 93 | @endif 94 | @endforeach 95 | @endif 96 | } 97 | ] 98 | } 99 | -------------------------------------------------------------------------------- /librenms/printer_toner_low_alert_template: -------------------------------------------------------------------------------- 1 | 8 | 9 | @if ( $alert->state == 0 ) {{ $alert->title }} 10 | @elseif ( $alert->state == 1 ) 11 | @if ( $alert->severity == "critical" ) {{ $alert->title }} 12 | @else ( $alert->severity == "warning" ) {{ $alert->title }} 13 | @endif 14 | @endif 15 |
16 |
17 | Hostname: {{$alert->sysName}} ({{ $alert->ip }})
18 | Location: {{ $alert->location }}
19 | Description: {{ $alert->description }}
20 | Device type: {{ $alert->type }}
21 | Hardware: {{ $alert->hardware }}
22 | Uptime: {{ $alert->uptime_long }}
23 | Severity: {{ $alert->severity }}
24 | Timestamp: {{ $alert->timestamp }}
25 | Unique-ID: {{ $alert->uid }}
26 | Rule: @if ($alert->name) {{ $alert->name }} @else {{ $alert->rule }} @endif
27 | @if ($alert->state == 0)Fault duration: {{ $alert->elapsed }} @endif
28 |
29 | 30 | @if ($alert->faults) Faults:
31 | @foreach ($alert->faults as $key => $value) 32 | -- #{{ $key }}: {{ $value['supply_descr'] }}
33 | @endforeach 34 | @endif 35 | -------------------------------------------------------------------------------- /librenms/screenshot_alert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/librenms/screenshot_alert.png -------------------------------------------------------------------------------- /librenms/screenshot_rebooted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/librenms/screenshot_rebooted.png -------------------------------------------------------------------------------- /librenms/screenshot_recovery_alert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/librenms/screenshot_recovery_alert.png -------------------------------------------------------------------------------- /librenms/screenshot_warning_alert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/librenms/screenshot_warning_alert.png -------------------------------------------------------------------------------- /librenms/sensor_fault_condition_template: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | @if ($alert->state == 1){{ $alert->title }} @else {{ $alert->title }} @endif 12 |
13 |
14 | Hostname: {{$alert->sysName}} ({{ $alert->ip }})
15 | Location: {{ $alert->location }}
16 | Description: {{ $alert->description }}
17 | Device type: {{ $alert->type }}
18 | Hardware: {{ $alert->hardware }}
19 | Uptime: {{ $alert->uptime_long }}
20 | Severity: {{ $alert->severity }}
21 | Timestamp: {{ $alert->timestamp }}
22 | Unique-ID: {{ $alert->uid }}
23 | Rule: @if ($alert->name) {{ $alert->name }} @else {{ $alert->rule }} @endif
24 | @if ($alert->state == 0)Fault duration: {{ $alert->elapsed }} @endif
25 |
26 | 27 | @if ($alert->faults) 28 | Faults:
29 | @foreach ($alert->faults as $key => $value) 30 | @php($unit = __("sensors.${value["sensor_class"]}.unit")) 31 |  #{{ $key }}: {{ $value['sensor_descr'] ?? 'Sensor' }} ({{ $value['sensor_current'].$unit }})
32 |         - Previous: {{ $value['sensor_prev'].$unit }}
33 |         - Limit: {{ $value['sensor_limit'].$unit }}
34 |         - Limit (high): {{ $value['sensor_limit_high'].$unit }}
35 |         - Limit (low): {{ $value['sensor_limit_low'].$unit }}
36 | 37 | @endforeach 38 | @endif 39 | -------------------------------------------------------------------------------- /lnk link command lines and batch hints shortcuts.txt: -------------------------------------------------------------------------------- 1 | Shortcut path for "Start Chat Programs" (Skype and Pidgin) 2 | ---------------------------------------------------------- 3 | "C:\root\Scripts\Win32\Communications Control.bat" 4 | 5 | 6 | Shortcut path for Command Prompt 7 | -------------------------------- 8 | 9 | :: Basic shell, start at root of C: 10 | %SystemRoot%\system32\cmd.exe /k cd\ & cls & echo. & echo Welcome %USERNAME%, & uptime & title Shell 11 | 12 | :: Change the color of the terminal (/T:xx command) 13 | %SystemRoot%\system32\cmd.exe /T:8E /k cd\ & cls & echo. & echo Welcome %USERNAME%, & uptime 14 | 15 | :: Standalone system 16 | %SystemRoot%\system32\cmd.exe /k R: & cd r:\unsorted\ & cls & echo. & echo Welcome %USERNAME%, & uptime & title %USERNAME% & prompt %USERNAME%@$T$S$P$_$$$S 17 | 18 | :: Domain admin 19 | %SystemRoot%\system32\cmd.exe /k R: & cd R:\unsorted\ & cls & echo. & echo Welcome %USERNAME%, & uptime & title %USERDOMAIN% & prompt %USERNAME%@$T$S$S$P$_$$$S 20 | 21 | 22 | Shortcut path for Powershell 23 | ---------------------------- 24 | C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -NoExit cd r:\unsorted; cls; write-host "" ; write-host "Welcome $env:username`," ; uptime ; write-host "" 25 | 26 | DropMyRights.exe 27 | ----------------- 28 | C:\WINDOWS\system32\DropMyRights.exe "C:\Program Files\Mozilla Firefox\firefox.exe" 29 | 30 | 31 | Rename a file using the current day, month and year 32 | --------------------------------------------------- 33 | :: Legend: 34 | :: g is year, e is month, f is day 35 | for /f "tokens=1-5 delims=/ " %%d in ("%date%") do ( 36 | rename %DESTINATION%\private.ctc private_%%g-%%e-%%f.ctc.bak 37 | ) 38 | 39 | Assign the output of a command to a variable (in this case called "MARKER"). Notice the escaped pipe (^|) 40 | --------------------------------------------------------------------------------------------------------- 41 | for /f "delims=" %a in ('dir /b ^| findstr "marker_"') do @set MARKER=%a 42 | for /f "delims=" %a in ('ver') do @set MARKER=%a -------------------------------------------------------------------------------- /lottery.bat: -------------------------------------------------------------------------------- 1 | :: Loops through a comparison of %RANDOM% and any time %RANDOM% is less than 3, adds a point to the "tick counter" 2 | :: At STOPTIME the script terminates and displays how many tick hits there were (how many times %RANDOM% was less than 3) 3 | 4 | :: VARIABLES 5 | set LOG=%userprofile%\desktop\lottery.log 6 | set STOPTIME=14:55 7 | 8 | 9 | :: PREP 10 | cls 11 | @echo off 12 | set LAUNCH_TIME=%TIME% 13 | echo %LAUNCH_TIME% Contest start (%username%) 14 | setlocal EnableDelayedExpansion 15 | 16 | 17 | :: TICK LOOP 18 | :loop 19 | if %time:~0,5% equ %STOPTIME% goto :done 20 | set /a "ITERATIONS=%ITERATIONS%+1" 21 | if %RANDOM% LSS 3 ( 22 | color 0a 23 | set /a "HITS=%HITS%+1" 24 | echo %TIME% TICK HIT ^(!HITS! hits, %ITERATIONS% iterations^) 25 | ) 26 | goto :loop 27 | 28 | 29 | :: COMPLETION 30 | :done 31 | echo %TIME% ^! Time limit reached 32 | echo TOTAL ITERATIONS: %ITERATIONS% 33 | echo TOTAL HITS: %HITS% 34 | echo USER: %USERNAME% LAUNCH: %LAUNCH_TIME% FINISH: %TIME% ITERATIONS: %ITERATIONS% HITS: %HITS%>>%LOG% 35 | pause 36 | -------------------------------------------------------------------------------- /map_printers.bat: -------------------------------------------------------------------------------- 1 | :: Purpose: Maps printers when a user logs in 2 | :: Requirements: Specify the target print server and printer names below 3 | :: Author: vocatus.gate@gmail.com // github.com/bmrf // reddit.com/user/vocatus // PGP: 0x07d1490f82a211a2 4 | :: Usage: Place this script in %ProgramData%\Microsoft\Windows\Start Menu\Startup 5 | :: History: 1.0.0 + Initial write 6 | 7 | 8 | 9 | ::::::::::::::: 10 | :: VARIABLES :: ---- Set these to your desired values 11 | ::::::::::::::: 12 | :: Rules for variables: 13 | :: * NO quotes! (bad: "c:\directory\path" ) 14 | :: * NO trailing slashes on the path! (bad: c:\directory\ ) 15 | :: * Spaces are okay (okay: c:\my folder\with spaces ) 16 | :: * Network paths are okay (okay: \\server\share name ) 17 | :: ( \\172.16.1.5\share name ) 18 | 19 | :: Log settings 20 | set LOGPATH=%TEMP% 21 | set LOGFILE=map_printers.log 22 | 23 | :: Printers to map 24 | set PRINT_SERVER=\\blisw6syaaps004 25 | set PRINTER1=DPTMS Bldg 1011 Basement iCafe RICOH MP C4504 26 | set PRINTER2=DPTMS Bldg 1011 Basement iCafe 2 RICOH MP C4504 27 | set PRINTER3=DPTMS Bldg 1011 Rm iCafe 3c RICOH MP C4504 28 | 29 | 30 | ::::::::::::::::::::: 31 | :: PREP AND CHECKS :: 32 | ::::::::::::::::::::: 33 | @echo off && cls 34 | set SCRIPT_VERSION=1.0.0 35 | set SCRIPT_UPDATED=2019-11-14 36 | :: Get the date into ISO 8601 standard format (yyyy-mm-dd) so we can use it 37 | FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a 38 | set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% 39 | 40 | 41 | 42 | ::::::::::::: 43 | :: EXECUTE :: 44 | ::::::::::::: 45 | 46 | :: Map the printers 47 | echo. 48 | echo %CUR_DATE% %TIME% Mapping printers...>> "%LOGPATH%\%LOGFILE%" 49 | echo %CUR_DATE% %TIME% Mapping printers, please don't close this window... 50 | echo. 51 | 52 | 53 | :: Printer 1 54 | echo %CUR_DATE% %TIME% Checking %PRINTER1% online status...>> "%LOGPATH%\%LOGFILE%" 55 | echo %CUR_DATE% %TIME% Checking %PRINTER1% online status... 56 | rundll32 printui.dll,PrintUIEntry /q /Xg /f "%TEMP%\printer_check" /n"%PRINT_SERVER%\%PRINTER1%" >nul 57 | if /i not exist "%TEMP%\printer_check" ( 58 | echo %CUR_DATE% %TIME% "%PRINTER1%" appears to be down, skipping.>> "%LOGPATH%\%LOGFILE%" 59 | echo %CUR_DATE% %TIME% "%PRINTER1%" appears to be down, skipping. 60 | ) else ( 61 | echo %CUR_DATE% %TIME% "%PRINTER1%" online, mapping now...>> "%LOGPATH%\%LOGFILE%" 62 | echo %CUR_DATE% %TIME% "%PRINTER1%" online, mapping now... 63 | rundll32 printui.dll,PrintUIEntry /q /in /n"%PRINT_SERVER%\%PRINTER1%" 64 | echo %CUR_DATE% %TIME% Mapped. 65 | ) 66 | if exist "%TEMP%\printer_check" del /f /q "%TEMP%\printer_check" >nul 67 | 68 | 69 | :: Printer 2 70 | echo %CUR_DATE% %TIME% Checking %PRINTER2% online status...>> "%LOGPATH%\%LOGFILE%" 71 | echo %CUR_DATE% %TIME% Checking %PRINTER2% online status... 72 | rundll32 printui.dll,PrintUIEntry /q /Xg /f "%TEMP%\printer_check" /n"%PRINT_SERVER%\%PRINTER2%" >nul 73 | if /i not exist "%TEMP%\printer_check" ( 74 | echo %CUR_DATE% %TIME% "%PRINTER2%" appears to be down, skipping.>> "%LOGPATH%\%LOGFILE%" 75 | echo %CUR_DATE% %TIME% "%PRINTER2%" appears to be down, skipping. 76 | ) else ( 77 | echo %CUR_DATE% %TIME% "%PRINTER2%" online, mapping now...>> "%LOGPATH%\%LOGFILE%" 78 | echo %CUR_DATE% %TIME% "%PRINTER2%" online, mapping now... 79 | rundll32 printui.dll,PrintUIEntry /q /in /n"%PRINT_SERVER%\%PRINTER2%" 80 | echo %CUR_DATE% %TIME% Mapped. 81 | ) 82 | if exist "%TEMP%\printer_check" del /f /q "%TEMP%\printer_check" >nul 83 | 84 | 85 | :: Printer 3 86 | echo %CUR_DATE% %TIME% Checking "%PRINTER3%"...>> "%LOGPATH%\%LOGFILE%" 87 | echo %CUR_DATE% %TIME% Checking "%PRINTER3%"... 88 | rundll32 printui.dll,PrintUIEntry /q /Xg /f "%TEMP%\printer_check" /n"%PRINT_SERVER%\%PRINTER3%" >nul 89 | if /i not exist "%TEMP%\printer_check" ( 90 | echo %CUR_DATE% %TIME% "%PRINTER3%" appears to be down, skipping.>> "%LOGPATH%\%LOGFILE%" 91 | echo %CUR_DATE% %TIME% "%PRINTER3%" appears to be down, skipping. 92 | ) else ( 93 | echo %CUR_DATE% %TIME% "%PRINTER3%" online, mapping now...>> "%LOGPATH%\%LOGFILE%" 94 | echo %CUR_DATE% %TIME% "%PRINTER3%" online, mapping now... 95 | rundll32 printui.dll,PrintUIEntry /q /in /n"%PRINT_SERVER%\%PRINTER3%" 96 | echo %CUR_DATE% %TIME% Mapped. 97 | ) 98 | if exist "%TEMP%\printer_check" del /f /q "%TEMP%\printer_check" >nul 99 | 100 | 101 | :: Wrap-Up 102 | echo %CUR_DATE% %TIME% Printers mapped.>> "%LOGPATH%\%LOGFILE%" 103 | echo Printers mapped, have a nice day! 104 | echo Please contact the S-6 if you have any questions. 105 | echo This window will close in 3 seconds. 106 | ping -n 5 localhost >nul 107 | -------------------------------------------------------------------------------- /microsoft_offline_update_launcher.bat: -------------------------------------------------------------------------------- 1 | :: Purpose: Installs a pre-downloaded Microsoft offline update package, generated by the WSUS Offline Update tool ( http://download.wsusoffline.net/ ) 2 | :: Requirements: 1. Run this script with Administrator rights 3 | :: 2. The script expects one command-line argument when it's run (via command line/PDQ deploy/SCCM/etc) which is the patch set to apply: 4 | :: Valid patch sets: 5 | :: office_2k7-2k16 6 | :: windows_7_and_server_2008-R2 7 | :: windows_8.1_and_server_2012-R2 8 | :: windows_server_2003 9 | :: 10 | :: If the argument is missing, the installation will fail with error code 1 11 | :: If the variables below point to non-existent sources, the installation will fail error code 2 12 | :: 13 | :: Example: 14 | :: microsoft_offline_update_launcher.bat windows_7_and_server_2008-R2 15 | :: 16 | :: 3. Set the repository variable to point to where the Microsoft offline update packages are. 17 | :: The final variable that gets passed to the copy operation is built like this: 18 | :: \\server\share_name\product\PATCH_DATE 19 | :: e.g. 20 | :: \\server\microsoft_offline_updates\windows_7_and_server_2008-R2\2018-01-18 21 | :: 22 | :: Author: vocatus on reddit.com/r/sysadmin ( vocatus.gate@gmail.com ) // PGP key ID: 0x07d1490f82a211a2 23 | :: Version: 1.7.1 / Minor comment fix 24 | :: 1.7.0 * Remove requirement to pass patch date. This was kind of pointless since we're always wanting to be on the latest patch set anyway 25 | :: / Rename REMOTE_REPOSITORY to REPOSITORY 26 | :: / Rename LOCAL_REPOSITORY to WORKING_DIRECTORY 27 | :: 1.6.2 * Fix incorrect references to %LOGFILENAME% (should be %LOGFILE%). Thanks to reddit.com/user/tastyratz 28 | :: 1.6.1 + Add cleanup of WORKING_DIRECTORY after finishing patch process 29 | :: 30 | :: 1.0 + Initial write 31 | 32 | 33 | ::::::::::::::: 34 | :: VARIABLES :: --------------- Set these to your desired values. -------------------------- :: 35 | ::::::::::::::: 36 | :: Rules for variables: 37 | :: * NO quotes! (bad: "c:\directory\path" ) 38 | :: * NO trailing slashes on the path! (bad: c:\directory\ ) 39 | :: * Spaces are okay (okay: c:\my folder\with spaces ) 40 | :: * Network paths are okay (okay: \\server\share name ) 41 | :: ( \\172.16.1.5\share name ) 42 | 43 | :: Log location and name. Do not use trailing slashes (\) 44 | :: Log max size is in bytes. If it exceeds the max then it gets rotated. 1048576 bytes is one megabyte 45 | set LOGPATH=%SystemDrive%\Logs 46 | set LOGFILE=microsoft_offline_updates.log 47 | set LOG_MAX_SIZE=2097152 48 | 49 | :: Specify the network location where the Microsoft offline update packages are. ( Default: \\server\share\microsoft_offline_updates ) 50 | :: Specify a local directory on the target machine to store the updates in while they install. ( Default: %TEMP%\microsoft_offline_updates ) 51 | set REMOTE_REPOSITORY=\\YOUR-SERVER-NAME\repo\microsoft_offline_updates 52 | set WORKING_DIRECTORY=%TEMP%\microsoft_offline_updates 53 | 54 | 55 | 56 | 57 | :: -------------------------- Don't edit anything below this line -------------------------- :: 58 | 59 | 60 | 61 | 62 | ::::::::::::::::::::: 63 | :: Prep and checks :: 64 | ::::::::::::::::::::: 65 | @echo off 66 | set SCRIPT_VERSION=1.7.1 67 | set SCRIPT_UPDATED=2015-09-15 68 | :: Get the date into ISO 8601 standard date format (yyyy-mm-dd) so we can use it 69 | FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a 70 | set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% 71 | 72 | :: This is useful if we start from a network share; converts CWD to a drive letter 73 | pushd "%~dp0" 2>NUL 74 | cls 75 | 76 | :: These lines build the final source and destination 77 | set PRODUCT=%1 78 | set UPDATE_PACKAGE=%REMOTE_REPOSITORY%\%PRODUCT% 79 | set WORKING_FOLDER=%WORKING_DIRECTORY%\%PRODUCT% 80 | 81 | :: Error checks. Throw error if it fails 82 | echo. 83 | if '%1%'=='' echo ERROR You didn't specify a product name. Edit this batch file with a text editor to configure it correctly. && exit /B 1 84 | if not exist %UPDATE_PACKAGE% echo ERROR Couldn't find the update package you specified, check your path. && exit /B 2 85 | 86 | 87 | ::::::::::::::::::::::: 88 | :: LOG FILE HANDLING :: 89 | ::::::::::::::::::::::: 90 | :: Make the logfile if it doesn't exist 91 | if not exist "%LOGPATH%" mkdir "%LOGPATH%" 92 | if not exist %LOGPATH%\%LOGFILE% echo. > %LOGPATH%\%LOGFILE% 93 | 94 | :: Check log size. If it's less than our max, then jump to the cleanup section 95 | for %%R in (%LOGPATH%\%LOGFILE%) do IF %%~zR LSS %LOG_MAX_SIZE% goto installation 96 | 97 | :: If the log was too big, go ahead and rotate it. 98 | pushd %LOGPATH% 99 | del %LOGFILE%.oldest 2>NUL 100 | rename %LOGFILE%.older %LOGFILE%.oldest 2>NUL 101 | rename %LOGFILE%.old %LOGFILE%.older 2>NUL 102 | rename %LOGFILE% %LOGFILE%.old 2>NUL 103 | popd 104 | 105 | 106 | :::::::::::::::::: 107 | :: INSTALLATION :: 108 | :::::::::::::::::: 109 | :installation 110 | :: Preclear the download area 111 | IF EXIST %WORKING_DIRECTORY% rmdir /S /Q %WORKING_DIRECTORY% 112 | 113 | :: Pull down the update package from the server and store it locally (on the target system) 114 | robocopy "%UPDATE_PACKAGE%" "%WORKING_FOLDER%" /FFT /MIR /Z /NP /LOG+:"%LOGPATH%\%LOGFILE%" 115 | 116 | :: Log file formatting 117 | echo. >> "%LOGPATH%\%LOGFILE%" 118 | 119 | :: Install the package from the local directory 120 | call "%WORKING_FOLDER%\cmd\DoUpdate.cmd" >> "%LOGPATH%\%LOGFILE%" 121 | 122 | :: Pop back to original directory. This isn't necessary in stand-alone runs of the script, but is needed when called from another script 123 | popd 124 | 125 | :: Clean up 126 | rmdir /s /q "%WORKING_DIRECTORY%" 127 | 128 | :: Return exit code to SCCM/PDQ Deploy/etc 129 | exit /B %EXIT_CODE% 130 | 131 | :eof 132 | -------------------------------------------------------------------------------- /microsoft_silverlight_nuker.bat: -------------------------------------------------------------------------------- 1 | :: Purpose: Removes all versions of Microsoft Silverlight from a system. Saves a log to c:\logs by default 2 | :: Requirements: Run this script with an admin account 3 | :: Author: vocatus on reddit.com/r/sysadmin ( vocatus.gate@gmail.com ) // PGP key ID: 0x82A211A2 4 | :: History: 1.0.0 + Initial write 5 | SETLOCAL 6 | 7 | 8 | ::::::::::::::: 9 | :: VARIABLES :: ---- Set these to your desired values. The defaults should work fine though ------ :: 10 | ::::::::::::::: 11 | :: Rules for variables: 12 | :: * NO quotes! (bad: "%SYSTEMDRIVE%\directory\path" ) 13 | :: * NO trailing slashes on the path! (bad: %SYSTEMDRIVE%\directory\ ) 14 | :: * Spaces are okay (okay: %SYSTEMDRIVE%\my folder\with spaces ) 15 | :: * Network paths are okay (okay: \\server\share name ) 16 | :: ( \\172.16.1.5\share name ) 17 | 18 | :: Log location and name. Do not use trailing slashes (\) 19 | set LOGPATH=%SystemDrive%\Logs 20 | set LOGFILE=%COMPUTERNAME%_microsoft_silverlight_nuker.log 21 | 22 | :: Force-close processes that might be using Silverlight? Recommend leaving this set to 'yes' unless you 23 | :: specifically want to abort the script if the target machine might possibly be using Silverlight. 24 | :: If you change this to 'no', the script will exit with an error code if it thinks Silverlight could be in use. 25 | set FORCE_CLOSE_PROCESSES=yes 26 | :: Exit code to use when FORCE_CLOSE_PROCESSES is "no" and a potential Silverlight-dependent process is detected 27 | set FORCE_CLOSE_PROCESSES_EXIT_CODE=1618 28 | 29 | 30 | 31 | :: =============================================================================================== :: 32 | :: ====== Think of everything below this line like a feral badger: Look, but Do Not Touch ====== :: 33 | :: =============================================================================================== :: 34 | 35 | 36 | 37 | ::::::::::::::::::::: 38 | :: PREP AND CHECKS :: 39 | ::::::::::::::::::::: 40 | @echo off && cls 41 | set SCRIPT_VERSION=1.0.0 42 | set SCRIPT_UPDATED=2019-10-17 43 | :: Get the date into ISO 8601 standard format (yyyy-mm-dd) so we can use it 44 | FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a 45 | set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% 46 | 47 | :: This is useful if we start from a network share; converts CWD to a drive letter 48 | pushd "%~dp0" 49 | 50 | :: Create the log directory if it doesn't exist 51 | if not exist %LOGPATH% mkdir %LOGPATH% 52 | 53 | :: Check if we're on XP. This affects some commands later, because XP uses slightly 54 | :: different binaries for reg.exe and various other Windows utilities 55 | set OS_VERSION=OTHER 56 | ver | find /i "XP" >NUL 57 | IF %ERRORLEVEL%==0 set OS_VERSION=XP 58 | 59 | title Silverlight Nuker v%SCRIPT_VERSION% (%SCRIPT_UPDATED%) 60 | 61 | 62 | ::::::::::::::::::::::::::: 63 | :: FORCE-CLOSE PROCESSES :: -- Do we want to kill Silverlight before running? If so, this is where it happens 64 | ::::::::::::::::::::::::::: 65 | if %FORCE_CLOSE_PROCESSES%==yes ( 66 | REM Kill all browsers and running Silverlight instances 67 | call :log "%CUR_DATE% %TIME% Looking for and closing all running browsers and Silverlight instances..." 68 | if %OS_VERSION%==XP ( 69 | REM XP version of the task killer 70 | REM this loop contains the processes we should kill 71 | for %%i in (battle,chrome,firefox,silverlight,iexplore,iexplorer,opera,palemoon,plugin-container,skype,steam,yahoo) do ( 72 | echo Searching for %%i.exe... 73 | %WINDIR%\system32\tskill.exe /a /v %%i* >> "%LOGPATH%\%LOGFILE%" 2>NUL 74 | ) 75 | ) else ( 76 | REM 7/8/2008/2008R2/2012/etc version of the task killer 77 | REM this loop contains the processes we should kill 78 | FOR %%i in (battle.net,chrome,firefox,Silverlight,iexplore,iexplorer,opera,palemoon,plugin-container,skype,steam,yahoo) do ( 79 | echo Searching for %%i.exe... 80 | %WINDIR%\system32\taskkill.exe /f /fi "IMAGENAME eq %%i*" /T >> "%LOGPATH%\%LOGFILE%" 2>NUL 81 | ) 82 | ) 83 | ) 84 | 85 | :: If we DON'T want to force-close Silverlight, then check for possible running Silverlight processes and abort the script if we find any 86 | if %FORCE_CLOSE_PROCESSES%==no ( 87 | call :log "%CUR_DATE% %TIME% Variable FORCE_CLOSE_PROCESSES is set to '%FORCE_CLOSE_PROCESSES%'. Checking for running processes before execution..." 88 | 89 | REM Don't ask... 90 | REM Okay so basically we loop through this list of processes, and for each one we dump the result of the search in the '%%a' variable. 91 | REM Then we check that variable, and if it's not null (e.g. FIND.exe found something) we abort the script, returning the exit code 92 | REM specified at the beginning of the script. Normally you'd use ERRORLEVEL for this, but because it is very flaky (it doesn't 93 | REM always get set, even when it should) we instead resort to using this method of dumping the results in a variable and checking it. 94 | for %%i IN (battle.net,chrome,firefox,silverlight,iexplore,iexplorer,opera,palemoon,plugin-container,skype,steam,yahoo) do ( 95 | call :log "%CUR_DATE% %TIME% Searching for %%i.exe... 96 | for /f "delims=" %%a in ('tasklist ^| find /i "%%i"') do ( 97 | if not [%%a]==[] ( 98 | call :log "%CUR_DATE% %TIME% ! ERROR: Process '%%i' is currently running, aborting." 99 | exit /b %FORCE_CLOSE_PROCESSES_EXIT_CODE% 100 | ) 101 | ) 102 | ) 103 | REM If we made it this far, we didn't find anything, so we can go ahead 104 | call :log "%CUR_DATE% %TIME% All clear, no Silverlight-related processes found. Going ahead with removal..." 105 | ) 106 | 107 | 108 | 109 | 110 | ::::::::::::: 111 | :: EXECUTE :: 112 | ::::::::::::: 113 | :: Log that we started 114 | call :log "%CUR_DATE% %TIME% Beginning removal of Silverlight, all versions..." 115 | 116 | 117 | 118 | ::::::::::::::::::::::::: 119 | :: UNINSTALLER SECTION :: -- Here we just brute-force every "normal" method for removing 120 | ::::::::::::::::::::::::: Silverlight, then resort to more painstaking methods later 121 | 122 | :: Attempt WMIC by name, this should usually catch most installations 123 | call :log "%CUR_DATE% %TIME% Attempting removal via WMIC name wildcard..." 124 | wmic product where "name like 'Silverlight%%'" uninstall /nointeractive >> "%LOGPATH%\%LOGFILE%" 125 | call :log "%CUR_DATE% %TIME% Done." 126 | 127 | :: Attempt WMIC by specific GUID listing 128 | call :log "%CUR_DATE% %TIME% Attempting removal via specific GUID listing..." 129 | :: Silverlight ActiveX ProductCodes 130 | :: Silverlight 131 | MsiExec.exe /uninstall {A1591282-1198-4647-A2B1-27E5FF5F6F3B} /quiet /norestart 132 | :: Silverlight v5.1.41212.0 133 | MsiExec.exe /uninstall {89F4137D-6C26-4A84-BDB8-2E5A4BB71E00} /quiet /norestart 134 | call :log "%CUR_DATE% %TIME% Done." 135 | 136 | 137 | 138 | 139 | :::::::::::::::::::::::::::::::: 140 | :: FILE AND DIRECTORY CLEANUP :: 141 | :::::::::::::::::::::::::::::::: 142 | call :log "%CUR_DATE% %TIME% Launching manual purge of leftover files..." 143 | 144 | :: JOB: Directories 145 | call :log "%CUR_DATE% %TIME% Removing directories..." 146 | if exist "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Microsoft Silverlight" rmdir "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Microsoft Silverlight" /s /q >> "%LOGPATH%\%LOGFILE%" 2>NUL 147 | if exist "%ProgramFiles%\Microsoft Silverlight" rmdir "%ProgramFiles%\Microsoft Silverlight" /s /q >> "%LOGPATH%\%LOGFILE%" 2>NUL 148 | if exist "%ProgramFiles(x86)%\Microsoft Silverlight" rmdir "%ProgramFiles(x86)%\Microsoft Silverlight" /s /q >> "%LOGPATH%\%LOGFILE%" 2>NUL 149 | call :log "%CUR_DATE% %TIME% Done." 150 | 151 | 152 | :: JOB: Prefetch and cache files 153 | call :log "%CUR_DATE% %TIME% Purging prefetch and cache files..." 154 | if exist "%WINDIR%\Prefetch\SILVERLIGHT*.pf" del "%WINDIR%\Prefetch\SILVERLIGHT*.pf" >> "%LOGPATH%\%LOGFILE%" 2>NUL 155 | call :log "%CUR_DATE% %TIME% Done." 156 | 157 | 158 | :: JOB: Registry entries 159 | call :log "%CUR_DATE% %TIME% Purging registry entries..." 160 | reg delete HKLM\Software\Microsoft\Silverlight /f >> "%LOGPATH%\%LOGFILE%" 2>NUL 161 | reg delete HKEY_CLASSES_ROOT\Installer\Products\D7314F9862C648A4DB8BE2A5B47BE100 /f >> "%LOGPATH%\%LOGFILE%" 2>NUL 162 | reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products\D7314F9862C648A4DB8BE2A5B47BE100 /f >> "%LOGPATH%\%LOGFILE%" 2>NUL 163 | reg delete HKEY_CLASSES_ROOT\TypeLib\{283C8576-0726-4DBC-9609-3F855162009A} /f >> "%LOGPATH%\%LOGFILE%" 2>NUL 164 | reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\install.exe /f >> "%LOGPATH%\%LOGFILE%" 2>NUL 165 | reg delete HKEY_CLASSES_ROOT\AgControl.AgControl /f >> "%LOGPATH%\%LOGFILE%" 2>NUL 166 | reg delete HKEY_CLASSES_ROOT\AgControl.AgControl.5.1 /f >> "%LOGPATH%\%LOGFILE%" 2>NUL 167 | reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{89F4137D-6C26-4A84-BDB8-2E5A4BB71E00} /f >> "%LOGPATH%\%LOGFILE%" 2>NUL 168 | call :log "%CUR_DATE% %TIME% Done." 169 | 170 | 171 | call :log "%CUR_DATE% %TIME% Removal complete. Recommend rebooting immediately." 172 | 173 | REM Return exit code to SCCM/PDQ Deploy/etc 174 | exit /B %EXIT_CODE% 175 | 176 | 177 | 178 | 179 | 180 | 181 | ::::::::::::::: 182 | :: FUNCTIONS :: 183 | ::::::::::::::: 184 | :log 185 | echo:%~1 >> "%LOGPATH%\%LOGFILE%" 186 | echo:%~1 187 | goto :eof 188 | -------------------------------------------------------------------------------- /pingup.bat: -------------------------------------------------------------------------------- 1 | :: Purpose: Simple script to check if a host is online and turn the window green (up) or red (down) based on the result. Also logs the result to a file 2 | :: Requirements: Windows XP and up 3 | :: Author: reddit.com/user/vocatus ( vocatus.gate at gmail ) // PGP key: 0x07d1490f82a211a2 4 | :: Version: 1.2.1 ! Fix date not correctly updating at start of each check 5 | :: 1.2.0 * Rework CUR_DATE to use function we call instead of static conversion 6 | :: 1.1.0 * Reworked CUR_DATE variable to handle more than one Date/Time format 7 | :: Can now handle all Windows date formats 8 | :: 1.0.0 Initial write 9 | 10 | 11 | :::::::::: 12 | :: Prep :: -- Don't change anything in this section 13 | :::::::::: 14 | @echo off 15 | set SCRIPT_VERSION=1.2.1 16 | set SCRIPT_UPDATED=2020-07-16 17 | cls 18 | call :set_cur_date 19 | 20 | ::::::::::::::: 21 | :: VARIABLES :: -- Set these to your desired values 22 | ::::::::::::::: 23 | :: Set host to check here 24 | ::set HOST=72.201.99.26 25 | set HOST=8.8.4.4 26 | set DISPLAY_NAME=GoogleDNS 27 | set LOGPATH=%SystemDrive%\logs 28 | set LOGFILE=pingup_%DISPLAY_NAME%.log 29 | set PINGS_PER_CHECK=3 30 | set RECHECK_COOLDOWN_DELAY=30 31 | 32 | :: make the log directory if it doesn't exist 33 | if not exist "%LOGPATH%" mkdir "%LOGPATH%" >nul 34 | 35 | 36 | ::::::::::::: 37 | :: EXECUTE :: 38 | ::::::::::::: 39 | echo %CUR_DATE% %TIME% Initializng PINGUP monitoring script 40 | echo Executing as %USERDOMAIN%\%USERNAME% on '%COMPUTERNAME%' 41 | echo Monitoring: %HOST% ^(%DISPLAY_NAME%^) 42 | echo Logging to: %LOGPATH%\%LOGFILE% 43 | echo Pings per check: %PINGS_PER_CHECK% 44 | echo Recheck cooldown: %RECHECK_COOLDOWN_DELAY% 45 | 46 | :: This block creates the log entries 47 | echo %CUR_DATE% %TIME% Initializng PINGUP monitoring script >> "%LOGPATH%\%LOGFILE%" 48 | echo Executing as %USERDOMAIN%\%USERNAME% on '%COMPUTERNAME%' >> "%LOGPATH%\%LOGFILE%" 49 | echo Monitoring: %HOST% (%DISPLAY_NAME%) >> "%LOGPATH%\%LOGFILE%" 50 | echo Logging to: %LOGPATH%\%LOGFILE% >> "%LOGPATH%\%LOGFILE%" 51 | echo Pings per check: %PINGS_PER_CHECK% >> "%LOGPATH%\%LOGFILE%" 52 | echo Recheck cooldown: %RECHECK_COOLDOWN_DELAY% >> "%LOGPATH%\%LOGFILE%" 53 | 54 | echo. 55 | echo %CUR_DATE% %TIME% Performing initial test... 56 | echo %CUR_DATE% %TIME% Performing initial test... >> "%LOGPATH%\%LOGFILE%" 57 | echo. 58 | 59 | 60 | :start 61 | call :set_cur_date 62 | ping %HOST% -n %PINGS_PER_CHECK% | find /i "TTL" > nul 63 | 64 | 65 | ::::::::::::: 66 | :: HOST UP :: 67 | ::::::::::::: 68 | :: Host is UP: Black text on green background 69 | if %ERRORLEVEL%==0 ( 70 | title UP: %HOST% 71 | color a0 72 | echo %CUR_DATE% %TIME% %DISPLAY_NAME% ^(%HOST%^) up. 73 | echo %CUR_DATE% %TIME% %DISPLAY_NAME% ^(%HOST%^) up. >> "%LOGPATH%\%LOGFILE%" 74 | ) ELSE ( 75 | REM Host is DOWN: Black text on red background 76 | title DWN: %HOST% 77 | color c0 78 | echo %CUR_DATE% %TIME% ! %DISPLAY_NAME% ^(%HOST%^) down. 79 | echo %CUR_DATE% %TIME% ! %DISPLAY_NAME% ^(%HOST%^) down. >> "%LOGPATH%\%LOGFILE%" 80 | ) 81 | 82 | 83 | :: Cooldown until next check 84 | ping localhost -n %RECHECK_COOLDOWN_DELAY% >NUL 85 | goto start 86 | 87 | 88 | 89 | 90 | 91 | ::::::::::::::: 92 | :: FUNCTIONS :: 93 | ::::::::::::::: 94 | :: Get the date into ISO 8601 standard format (yyyy-mm-dd) so we can use it 95 | :set_cur_date 96 | for /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a 97 | set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% 98 | goto :eof 99 | -------------------------------------------------------------------------------- /registry/Add_Take_Ownership_to_context_menu.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ; Created by: Shawn Brink 4 | ; http://www.tenforums.com 5 | ; Tutorial: http://www.tenforums.com/tutorials/3841-take-ownership-add-context-menu-windows-10-a.html 6 | 7 | 8 | [-HKEY_CLASSES_ROOT\*\shell\runas] 9 | 10 | [HKEY_CLASSES_ROOT\*\shell\runas] 11 | @="Take Ownership" 12 | "HasLUAShield"="" 13 | "NoWorkingDirectory"="" 14 | "Position"="middle" 15 | 16 | [HKEY_CLASSES_ROOT\*\shell\runas\command] 17 | @="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant *S-1-5-32-544:F /c /l" 18 | "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant *S-1-5-32-544:F /c /l" 19 | 20 | 21 | [-HKEY_CLASSES_ROOT\Directory\shell\runas] 22 | 23 | [HKEY_CLASSES_ROOT\Directory\shell\runas] 24 | @="Take Ownership" 25 | "HasLUAShield"="" 26 | "NoWorkingDirectory"="" 27 | "Position"="middle" 28 | 29 | [HKEY_CLASSES_ROOT\Directory\shell\runas\command] 30 | @="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant *S-1-5-32-544:F /t /c /l /q" 31 | "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant *S-1-5-32-544:F /t /c /l /q" 32 | 33 | 34 | [-HKEY_CLASSES_ROOT\dllfile\shell\runas] 35 | 36 | [HKEY_CLASSES_ROOT\dllfile\shell\runas] 37 | @="Take Ownership" 38 | "HasLUAShield"="" 39 | "NoWorkingDirectory"="" 40 | "Position"="middle" 41 | 42 | [HKEY_CLASSES_ROOT\dllfile\shell\runas\command] 43 | @="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant *S-1-5-32-544:F /c /l" 44 | "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant *S-1-5-32-544:F /c /l" 45 | 46 | 47 | [-HKEY_CLASSES_ROOT\Drive\shell\runas] 48 | 49 | [HKEY_CLASSES_ROOT\Drive\shell\runas] 50 | @="Take Ownership" 51 | "HasLUAShield"="" 52 | "NoWorkingDirectory"="" 53 | "Position"="middle" 54 | 55 | [HKEY_CLASSES_ROOT\Drive\shell\runas\command] 56 | @="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant *S-1-5-32-544:F /t /c /l /q" 57 | "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant *S-1-5-32-544:F /t /c /l /q" 58 | 59 | [-HKEY_CLASSES_ROOT\exefile\shell\runas] 60 | 61 | [HKEY_CLASSES_ROOT\exefile\shell\runas] 62 | "HasLUAShield"="" 63 | 64 | [HKEY_CLASSES_ROOT\exefile\shell\runas\command] 65 | @="\"%1\" %*" 66 | "IsolatedCommand"="\"%1\" %*" -------------------------------------------------------------------------------- /registry/Tweak_Office_Excel_Add_Open In New Excel Instance Right-Click Option.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/registry/Tweak_Office_Excel_Add_Open In New Excel Instance Right-Click Option.reg -------------------------------------------------------------------------------- /registry/Tweak_Office_Excel_Add_Open In New Excel Instance Right-Click Option_UNDO.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/registry/Tweak_Office_Excel_Add_Open In New Excel Instance Right-Click Option_UNDO.reg -------------------------------------------------------------------------------- /registry/Tweak_Office_Excel_open in new instance by default.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/registry/Tweak_Office_Excel_open in new instance by default.reg -------------------------------------------------------------------------------- /registry/Tweak_Office_Excel_open in new instance by default_UNDO.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/registry/Tweak_Office_Excel_open in new instance by default_UNDO.reg -------------------------------------------------------------------------------- /registry/Tweak_Office_Outlook_stop_auto-compressing_images.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | 4 | ; Prevent Outlook 2007 from auto-compressing images inserted in email body's via the "Image --> Insert" command 5 | [HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Word\Data] 6 | "SettingsWordMail"=- 7 | 8 | ; Prevent Outlook 2010 from auto-compressing images inserted in email body's via the "Image --> Insert" command 9 | [HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Word\Data] 10 | "SettingsWordMail"=- 11 | 12 | ; Prevent Outlook 2013 from auto-compressing images inserted in email body's via the "Image --> Insert" command 13 | [HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Word\Data] 14 | "SettingsWordMail"=- 15 | 16 | ; Prevent Outlook 2016 from auto-compressing images inserted in email body's via the "Image --> Insert" command 17 | [HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Word\Data] 18 | "SettingsWordMail"=- 19 | -------------------------------------------------------------------------------- /registry/Tweak_Office_Visio_open_files_in_separate_windows.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/registry/Tweak_Office_Visio_open_files_in_separate_windows.reg -------------------------------------------------------------------------------- /registry/Windows_Server_disable_shutdown_event_tracker.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Reliability] 4 | "ShutdownReasonOn"=dword:00000000 -------------------------------------------------------------------------------- /registry/add_Take_Ownership_to_context_menu.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ; Created by: Shawn Brink 4 | ; http://www.tenforums.com 5 | ; Tutorial: http://www.tenforums.com/tutorials/3841-take-ownership-add-context-menu-windows-10-a.html 6 | 7 | 8 | [-HKEY_CLASSES_ROOT\*\shell\runas] 9 | 10 | [HKEY_CLASSES_ROOT\*\shell\runas] 11 | @="Take Ownership" 12 | "HasLUAShield"="" 13 | "NoWorkingDirectory"="" 14 | "Position"="middle" 15 | 16 | [HKEY_CLASSES_ROOT\*\shell\runas\command] 17 | @="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant *S-1-5-32-544:F /c /l" 18 | "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant *S-1-5-32-544:F /c /l" 19 | 20 | 21 | [-HKEY_CLASSES_ROOT\Directory\shell\runas] 22 | 23 | [HKEY_CLASSES_ROOT\Directory\shell\runas] 24 | @="Take Ownership" 25 | "HasLUAShield"="" 26 | "NoWorkingDirectory"="" 27 | "Position"="middle" 28 | 29 | [HKEY_CLASSES_ROOT\Directory\shell\runas\command] 30 | @="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant *S-1-5-32-544:F /t /c /l /q" 31 | "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant *S-1-5-32-544:F /t /c /l /q" 32 | 33 | 34 | [-HKEY_CLASSES_ROOT\dllfile\shell\runas] 35 | 36 | [HKEY_CLASSES_ROOT\dllfile\shell\runas] 37 | @="Take Ownership" 38 | "HasLUAShield"="" 39 | "NoWorkingDirectory"="" 40 | "Position"="middle" 41 | 42 | [HKEY_CLASSES_ROOT\dllfile\shell\runas\command] 43 | @="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant *S-1-5-32-544:F /c /l" 44 | "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant *S-1-5-32-544:F /c /l" 45 | 46 | 47 | [-HKEY_CLASSES_ROOT\Drive\shell\runas] 48 | 49 | [HKEY_CLASSES_ROOT\Drive\shell\runas] 50 | @="Take Ownership" 51 | "HasLUAShield"="" 52 | "NoWorkingDirectory"="" 53 | "Position"="middle" 54 | 55 | [HKEY_CLASSES_ROOT\Drive\shell\runas\command] 56 | @="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant *S-1-5-32-544:F /t /c /l /q" 57 | "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant *S-1-5-32-544:F /t /c /l /q" 58 | 59 | [-HKEY_CLASSES_ROOT\exefile\shell\runas] 60 | 61 | [HKEY_CLASSES_ROOT\exefile\shell\runas] 62 | "HasLUAShield"="" 63 | 64 | [HKEY_CLASSES_ROOT\exefile\shell\runas\command] 65 | @="\"%1\" %*" 66 | "IsolatedCommand"="\"%1\" %*" -------------------------------------------------------------------------------- /registry/ask_user_instead_of_silently_installing_minor_updates.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ; Ask the user instead of silently installing "minor" updates. 4 | ; https://technet.microsoft.com/en-us/library/cc708449%28v=ws.10%29.aspx 5 | [HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU] 6 | "AutoInstallMinorUpdates"=dword:00000000 -------------------------------------------------------------------------------- /registry/disable_Adobe_Shockwave_Autoupdate.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/registry/disable_Adobe_Shockwave_Autoupdate.reg -------------------------------------------------------------------------------- /registry/disable_Adobe_Shockwave_Stats_Collection.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/registry/disable_Adobe_Shockwave_Stats_Collection.reg -------------------------------------------------------------------------------- /registry/disable_Java_Auto-Update.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ; Disable all Java irritations 4 | 5 | ; For matching architecture Java installations on matching architecture version of Windows 6 | [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Update\Policy] 7 | "EnableJavaUpdate"=dword:00000000 8 | "NotifyDownload"=dword:00000000 9 | "EnableAutoUpdateCheck"=dword:00000000 10 | "NotifyInstall"=dword:00000000 11 | "Frequency"=dword:01110000 12 | "UpdateSchedule"=dword:00000000 13 | "PromptAutoUpdateCheck"=- 14 | 15 | ; For 32-bit Java installations on a 64-bit version of Windows 16 | [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Update\Policy] 17 | "EnableJavaUpdate"=dword:00000000 18 | "NotifyDownload"=dword:00000000 19 | "EnableAutoUpdateCheck"=dword:00000000 20 | "PromptAutoUpdateCheck"=- 21 | 22 | ; More madness. Deletes the Startup task (if it exists) 23 | [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run] 24 | "SunJavaUpdateSched"=- 25 | 26 | ; Deletes the Startup task (if it exists) 27 | [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run] 28 | "SunJavaUpdateSched"=- 29 | 30 | ; Disable all "Sponsor" tag-along installers (McAfee, Google toolbar, etc), for matching architecture Java installations on matching architecture version of Windows 31 | [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft] 32 | "SPONSORS"="DISABLE" 33 | 34 | ; Disable all "Sponsor" tag-along installers (McAfee, Google toolbar, etc), for 32-bit Java installations on a 64-bit version of Windows 35 | [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft] 36 | "SPONSORS"="DISABLE" 37 | 38 | ; Disables Java browser integration 39 | ;[-HKEY_LOCAL_MACHINE\Software\Wow6432Node\JavaSoft\Java Plug-in] -------------------------------------------------------------------------------- /registry/disable_NCSI_phone-home_Internet_connectivity_check.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/registry/disable_NCSI_phone-home_Internet_connectivity_check.reg -------------------------------------------------------------------------------- /registry/disable_Tray_Balloon_Notifcations.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ; Disable Popup Balloon Notifications in the Windows Vista/7 system tray (by the clock) 4 | ; Windows Guides mintywhite.com 5 | 6 | [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced] 7 | "EnableBalloonTips"=dword:00000000 8 | "StartButtonBalloonTip"=dword:00000000 9 | "FolderContentsInfoTip"=dword:00000000 10 | 11 | [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced] 12 | "EnableBalloonTips"=dword:00000000 13 | "StartButtonBalloonTip"=dword:00000000 14 | "FolderContentsInfoTip"=dword:00000000 -------------------------------------------------------------------------------- /registry/disable_Windows_Update_Auto-Reboot.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/registry/disable_Windows_Update_Auto-Reboot.reg -------------------------------------------------------------------------------- /registry/disable_shortcut_to_text.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/registry/disable_shortcut_to_text.reg -------------------------------------------------------------------------------- /registry/disable_telemetry_registry_entries.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ; GPO option to disable telemetry 4 | [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DataCollection] 5 | "AllowTelemetry"=dword:00000000 6 | 7 | ; GPO option to disable telemetry 8 | [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\DataCollection] 9 | "AllowTelemetry"=dword:00000000 10 | 11 | ; Keylogger 12 | [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\AutoLogger-Diagtrack-Listener] 13 | "Start"=dword:00000000 14 | 15 | ; Wifi sense; this is a nasty one, privacy-wise 16 | [hkey_local_machine\software\microsoft\wcmsvc\wifinetworkmanager] 17 | "wifisensecredshared"=dword:00000000 18 | "wifisenseopen"=dword:00000000 19 | 20 | ; Windows Defender sample reporting 21 | [hkey_local_machine\software\microsoft\windows defender\spynet] 22 | "spynetreporting"=dword:00000000 23 | "submitsamplesconsent"=dword:00000000 24 | 25 | ; SkyDrive 26 | [hkey_local_machine\software\policies\microsoft\windows\skydrive] 27 | "disablefilesync"=dword:00000001 28 | 29 | ; Kill OneDrive from hooking into Explorer even when disabled 30 | [HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}] 31 | "System.IsPinnedToNameSpaceTree"=dword:00000000 32 | 33 | ; Kill OneDrive from hooking into Explorer even when disabled 34 | [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}] 35 | "System.IsPinnedToNameSpaceTree"=dword:00000000 36 | 37 | ; DiagTrack service 38 | [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DiagTrack] 39 | "Start"=dword:00000004 40 | 41 | ; "WAP Push Message Routing Service" 42 | [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\dmwappushservice] 43 | "Start"=dword:00000004 -------------------------------------------------------------------------------- /registry/disable_use_web_service_to_find_the_correct_program.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ; Disable useless "Use the Web Service to find the correct program" dialog. 4 | [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer] 5 | "NoInternetOpenWith"=dword:00000001 -------------------------------------------------------------------------------- /registry/disable_windows_10_upgrade_registry_entries.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ; "DisableOSUpgrade" disables/hides the taskbar app to prevent users from making a reservation and upgrading manually 4 | ; However, user can still get updated automatically with KB3146449 5 | [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate] 6 | "DisableOSUpgrade"=dword:00000001 7 | 8 | ; "AllowOSUpgrade" is the holy grail that will actually prevent the upgrade from happening, even if Win10 is sitting in the update folder. 9 | ; You can make a reservation, download it via updates, enable this option and windows will never automatically/manually update to Win10. 10 | ; "ReservationsAllowed" is a little more heavy handed and may not be neccessary. This actually prevents the user (or windows) from making a reservation and downloading the upgrade even remotely possible...but the upgrade can still happen if it's already downloaded. Usually done on new installs as an extra preventative measure. The default value for this is 2. Setting it to 0 makes reservations impossible. 11 | [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade] 12 | "AllowOSUpgrade"=dword:00000000 13 | "ReservationsAllowed"=dword:00000000 14 | 15 | ; "DisableGWX" is just the upgrade nagger/popup 16 | [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\GWX] 17 | "DisableGWX"=dword:00000001 18 | 19 | ; Disable automatic update 20 | ;[hkey_local_machine\software\microsoft\windows\currentversion\windowsupdate\auto update] 21 | ;"auoptions"=dword:00000002 22 | ;"includerecommendedupdates"=dword:00000000 23 | ;"enablefeaturedsoftware"=dword:00000000 -------------------------------------------------------------------------------- /registry/enable_Powershell_scripts_run_by_double-clicking.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/registry/enable_Powershell_scripts_run_by_double-clicking.reg -------------------------------------------------------------------------------- /registry/enable_command-prompt_auto-complete.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/registry/enable_command-prompt_auto-complete.reg -------------------------------------------------------------------------------- /registry/enable_command-prompt_use_of_systems_mapped_drives.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System] 4 | "EnableLinkedConnections"=dword:00000001 -------------------------------------------------------------------------------- /registry/enable_standard_RunAs_on_Vista.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | [HKEY_CLASSES_ROOT\exefile\shell\runas\command] 4 | @="runas /user:domain\username "%1"" 5 | "IsolatedCommand"="runas /user:domain\username "%1"" 6 | 7 | ;alternate method, we run both just to be sure 8 | [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\System] 9 | "ConsentPromptbehaviorAdmin"=dword:00000001 -------------------------------------------------------------------------------- /registry/force_NumLock_on_at_startup.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | [HKEY_USERS\.DEFAULT\Control Panel\Keyboard] 4 | "InitialKeyboardIndicators"="2" -------------------------------------------------------------------------------- /registry/remove_old_unused_drivers.ps1: -------------------------------------------------------------------------------- 1 | # Removes old and unused versions of drivers from the Windows driver store 2 | 3 | # Script source: 4 | # https://www.itechtics.com/remove-old-drivers/ 5 | 6 | #Spacing/tabbing is messed up but I've tested the script and it works as of 2020-01-08 7 | 8 | $dismOut = dism /online /get-drivers 9 | $Lines = $dismOut | select -Skip 10 10 | 11 | $Operation = "theName" 12 | $Drivers = @() 13 | 14 | 15 | foreach ( $Line in $Lines ) { 16 | $tmp = $Line 17 | $txt = $($tmp.Split( ':' ))[1] 18 | switch ($Operation) { 19 | 20 | 'theName' { $Name = $txt 21 | $Operation = 'theFileName' 22 | break 23 | } 24 | 25 | 'theFileName' { $FileName = $txt.Trim() 26 | $Operation = 'theEntr' 27 | break 28 | } 29 | 'theEntr' { $Entr = $txt.Trim() 30 | $Operation = 'theClassName' 31 | break 32 | } 33 | 34 | 'theClassName' { $ClassName = $txt.Trim() 35 | 36 | $Operation = 'theVendor' 37 | 38 | break 39 | 40 | } 41 | 42 | 'theVendor' { $Vendor = $txt.Trim() 43 | $Operation = 'theDate' 44 | break 45 | } 46 | 47 | 'theDate' { # change the date format for easy sorting 48 | $tmp = $txt.split( '.' ) 49 | $txt = "$($tmp[2]).$($tmp[1]).$($tmp[0].Trim())" 50 | $Date = $txt 51 | $Operation = 'theVersion' 52 | break 53 | } 54 | 55 | 'theVersion' { $Version = $txt.Trim() 56 | 57 | $Operation = 'theNull' 58 | $params = [ordered]@{ 'FileName' = $FileName 59 | 'Vendor' = $Vendor 60 | 'Date' = $Date 61 | 'Name' = $Name 62 | 'ClassName' = $ClassName 63 | 'Version' = $Version 64 | 'Entr' = $Entr 65 | } 66 | 67 | 68 | $obj = New-Object -TypeName PSObject -Property $params 69 | $Drivers += $obj 70 | 71 | 72 | break 73 | 74 | } 75 | 'theNull' { $Operation = 'theName' 76 | break 77 | } 78 | } 79 | } 80 | 81 | 82 | Write-Host "All installed third-party drivers" 83 | 84 | $Drivers | sort Filename | ft 85 | 86 | Write-Host "Different versions" 87 | $last = '' 88 | $NotUnique = @() 89 | 90 | foreach ( $Dr in $($Drivers | sort Filename) ) { 91 | if ($Dr.FileName -eq $last ) { $NotUnique += $Dr } 92 | $last = $Dr.FileName 93 | } 94 | 95 | $NotUnique | sort FileName | ft 96 | Write-Host "Outdated drivers" 97 | 98 | $list = $NotUnique | select -ExpandProperty FileName -Unique 99 | $ToDel = @() 100 | 101 | foreach ( $Dr in $list ) { 102 | Write-Host "duplicate found" -ForegroundColor Yellow 103 | $sel = $Drivers | where { $_.FileName -eq $Dr } | sort date -Descending | select -Skip 1 104 | $sel | ft 105 | $ToDel += $sel 106 | } 107 | 108 | 109 | Write-Host "Drivers to remove" -ForegroundColor Red 110 | 111 | $ToDel | ft 112 | 113 | # removing old drivers 114 | foreach ( $item in $ToDel ) { 115 | $Name = $($item.Name).Trim() 116 | Write-Host "deleting $Name" -ForegroundColor Yellow 117 | Write-Host "pnputil.exe -d $Name" -ForegroundColor Yellow 118 | Invoke-Expression -Command "pnputil.exe -d $Name" 119 | } -------------------------------------------------------------------------------- /registry/show_windows_version_on_desktop.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ;Display the Build Number on the desktop 4 | [HKEY_CURRENT_USER\Control Panel\Desktop] 5 | "PaintDesktopVersion"=dword:00000001 -------------------------------------------------------------------------------- /registry/tweak_office_excel_Add_Open In New Excel Instance Right-Click Option.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/registry/tweak_office_excel_Add_Open In New Excel Instance Right-Click Option.reg -------------------------------------------------------------------------------- /registry/tweak_office_excel_open in new instance by default.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/registry/tweak_office_excel_open in new instance by default.reg -------------------------------------------------------------------------------- /registry/tweak_office_visio_open_files_in_separate_windows.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/registry/tweak_office_visio_open_files_in_separate_windows.reg -------------------------------------------------------------------------------- /registry/vista_StopHijackingMySleepButton.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/registry/vista_StopHijackingMySleepButton.reg -------------------------------------------------------------------------------- /registry/win10_annoyance_remove_stupid_folders_in_MyPC (Videos, Pictures, etc).reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/registry/win10_annoyance_remove_stupid_folders_in_MyPC (Videos, Pictures, etc).reg -------------------------------------------------------------------------------- /registry/win10_disable_annoying_lock_screen.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ; Disable useless "touch optimized" lock screen that makes you hit Enter before logging in. 4 | ; This has no effect on Win+L locking, auto lock timer, etc. 5 | [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Personalization] 6 | "NoLockScreen"=dword:00000001 -------------------------------------------------------------------------------- /registry/win10_disable_libraries_in_navigation_pane.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/registry/win10_disable_libraries_in_navigation_pane.reg -------------------------------------------------------------------------------- /registry/win10_enable_legacy_incoming_remote_desktop_security (allow Linux clients to connect).reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/registry/win10_enable_legacy_incoming_remote_desktop_security (allow Linux clients to connect).reg -------------------------------------------------------------------------------- /registry/win10_force_folder_views_not_to_change.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/registry/win10_force_folder_views_not_to_change.reg -------------------------------------------------------------------------------- /registry/win10_powershell_enable_double-clicking_ps1_files_to_launch.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/registry/win10_powershell_enable_double-clicking_ps1_files_to_launch.ps1 -------------------------------------------------------------------------------- /registry/win10_prevent_wifi_credential_sharing.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ; Prevent credentials leak if WiFiSense is re-enabled by accident/update. 4 | [HKEY_LOCAL_MACHINE\Software\Microsoft\WcmSvc\wifinetworkmanager] 5 | "WiFiSenseCredShared"=dword:00000000 6 | "WiFiSenseOpen"=dword:00000000 -------------------------------------------------------------------------------- /registry/win10_show_window_contents_while_dragging.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | [HKEY_CURRENT_USER\Control Panel\Desktop] "DragFullWindows"="1" 4 | 5 | [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Control Panel\Desktop] "DragFullWindows"="1" -------------------------------------------------------------------------------- /registry/win7-10_disable_wallpaper_compression.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ; Disable Windows stupid automatic compression of wallpaper images. Thanks to /u/Neqsis 4 | ; original thread: https://www.reddit.com/r/pcgaming/comments/6kry64/protip_windows_automatically_compresses_wallpaper/ 5 | [HKEY_CURRENT_USER\Control Panel\Desktop] 6 | "JPEGImportQuality"=dword:00000064 -------------------------------------------------------------------------------- /registry/win7-8.1_disable_uncancellable_auto_restart_notification.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ; Disable uncancellable auto restart notifications (XP through 8.1, ignored on 10) 4 | [HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WindowsUpdate\AU] 5 | "NoAutoRebootWithLoggedOnUsers"=dword:00000001 -------------------------------------------------------------------------------- /registry/win7_disable_libraries.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ;Created by Vishal Gupta for AskVG.com 4 | 5 | [-HKEY_CLASSES_ROOT\CLSID\{031E4825-7B94-4dc3-B131-E946B44C8DD5}] 6 | 7 | [-HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{031E4825-7B94-4dc3-B131-E946B44C8DD5}] 8 | 9 | [-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{031E4825-7B94-4dc3-B131-E946B44C8DD5}] 10 | 11 | [-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{2112AB0A-C86A-4ffe-A368-0DE96E47012E}] 12 | 13 | [-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{491E922F-5643-4af4-A7EB-4E7A138D8174}] 14 | 15 | [-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{7b0db17d-9cd2-4a93-9733-46cc89022e7c}] 16 | 17 | [-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{A302545D-DEFF-464b-ABE8-61C8648D939B}] 18 | 19 | [-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{A990AE9F-A03B-4e80-94BC-9912D7504104}] 20 | 21 | [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel] 22 | "{031E4825-7B94-4dc3-B131-E946B44C8DD5}"=- 23 | -------------------------------------------------------------------------------- /registry/win7_enable_tcpipv6.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/registry/win7_enable_tcpipv6.reg -------------------------------------------------------------------------------- /registry/win7_shrink_window_borders.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/registry/win7_shrink_window_borders.reg -------------------------------------------------------------------------------- /registry/win8_remove_pin-to-start_right_click_option.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ; Apply system-wide 4 | [HKEY_LOCAL_MACHINE\Software\Classes\Folder\shell\pintostartscreen] 5 | "AppliesTo"="NOT System.ParsingName:=\"::{645FF040-5081-101B-9F08-00AA002F954E}\"" 6 | 7 | ; Apply only to current user 8 | ;[HKEY_CURRENT_USER\Software\Classes\Folder\shell\pintostartscreen] 9 | ;"AppliesTo"="NOT System.ParsingName:=\"::{645FF040-5081-101B-9F08-00AA002F954E}\"" -------------------------------------------------------------------------------- /registry/winVista_win7_prevent_Welcome_Center_running_for_each_new_user.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ; Prevent "Welcome Center" (Vista) and "Getting Started" (7) from running on first login for each new user. 4 | [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer] 5 | "RestrictWelcomeCenter"=dword:00000001 -------------------------------------------------------------------------------- /registry/winXP-10_disable_all_balloon_notification_tips.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ; Disable all balloon tips (XP through Win10). 4 | ; These include Security/Action Center, device found, desktop cleanup, "faster USB" notifications, and the tour. 5 | ; Note: this does not effect metro push notifications (for that use NoToastApplicationNotification) 6 | ; current user 7 | [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced] 8 | "EnableBalloonTips"=dword:00000000 9 | ; all users 10 | [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced] 11 | "EnableBalloonTips"=dword:00000000 12 | ; (and/or with the Group Policy) 13 | [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer] 14 | "TaskbarNoNotification"=dword:00000001 -------------------------------------------------------------------------------- /registry/winXP-10_disable_all_balloon_tips.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ; Disable all balloon tips (XP through Win10). 4 | ; These include Security/Action Center, device found, desktop cleanup, "faster USB" notifications, and the tour. 5 | ; Note: this does not effect metro push notifications (for that use NoToastApplicationNotification) 6 | ; current user 7 | [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced] 8 | "EnableBalloonTips"=dword:00000000 9 | ; all users 10 | [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced] 11 | "EnableBalloonTips"=dword:00000000 12 | ; (and/or with the Group Policy) 13 | [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer] 14 | "TaskbarNoNotification"=dword:00000001 -------------------------------------------------------------------------------- /remove_all_printers_and_unused_drivers_and_ports.bat: -------------------------------------------------------------------------------- 1 | :: WARNING!!! This script will remove EVERY installed printer, their ports, and the unused drivers. 2 | :: Use with caution. 3 | :: You have been warned. 4 | :: Source: http://www.reddit.com/r/usefulscripts/comments/1c0698/batch_remove_all_printers_unused_drivers_and/ 5 | 6 | 7 | cd %SystemDrive%\Windows\System32 8 | setLocal EnableDelayedExpansion 9 | CLS 10 | 11 | :: Stop the spooler service 12 | net stop spooler 13 | 14 | :: Determine OS 15 | If exist "%SystemDrive%\Users\Default\NTUSER.DAT" goto Win7 16 | If exist "%SystemDrive%\Documents and Settings\All Users\NTUSER.DAT" goto WinXP 17 | 18 | :WinXP 19 | cls 20 | Echo Removing all printers 21 | :: Printer deletion 22 | CSCRIPT /nologo %windir%\System32\prnmngr.vbs -x 23 | 24 | :: Delete TCP/IP port 25 | if exist %TEMP%\IPPorts.txt del %TEMP%\IPPorts.txt 26 | if exist %TEMP%\IPPorts2.txt del %TEMP%\IPPorts2.txt 27 | if exist %TEMP%\IPPorts3.txt del %TEMP%\IPPorts3.txt 28 | cls 29 | 30 | CSCRIPT /nologo %windir%\System32\prnport.vbs -l > %TEMP%\IPPorts.txt 31 | type %TEMP%\IPPorts.txt | findstr IP_ > %TEMP%\IPPorts2.txt 32 | for /f "tokens=* delims=" %%c in ('type %TEMP%\IPPorts2.txt') do ( 33 | set LINE=%%c 34 | >> %TEMP%\IPPorts3.txt echo !LINE:~10! 35 | ) 36 | for /f "delims=" %%x in (%TEMP%\IPPorts3.txt) do CSCRIPT /nologo %windir%\System32\prnport.vbs -d -r %%x 37 | 38 | del %TEMP%\IPPorts.txt 39 | del %TEMP%\IPPorts2.txt 40 | del %TEMP%\IPPorts3.txt 41 | 42 | :: Delete all un-used printer drivers 43 | CSCRIPT /nologo %windir%\System32\prndrvr.vbs -x 44 | 45 | goto Exit 46 | 47 | :Win7 48 | cls 49 | Echo Removing all printers 50 | :: Printer deletion 51 | CSCRIPT /nologo %windir%\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs -x 52 | 53 | :: Delete TCP/IP port 54 | if exist %TEMP%\IPPorts.txt del %TEMP%\IPPorts.txt 55 | if exist %TEMP%\IPPorts2.txt del %TEMP%\IPPorts2.txt 56 | if exist %TEMP%\IPPorts3.txt del %TEMP%\IPPorts3.txt 57 | if exist %TEMP%\IPPorts4.txt del %TEMP%\IPPorts4.txt 58 | cls 59 | 60 | CSCRIPT /nologo %windir%\System32\Printing_Admin_Scripts\en-US\prnport.vbs -l > %TEMP%\IPPorts.txt 61 | type %TEMP%\IPPorts.txt | findstr 172.20 > %TEMP%\IPPorts2.txt 62 | type %TEMP%\IPPorts2.txt | findstr Port > %TEMP%\IPPorts3.txt 63 | for /f "tokens=* delims=" %%c in ('type %TEMP%\IPPorts3.txt') do ( 64 | set LINE=%%c 65 | >> %TEMP%\IPPorts4.txt echo !LINE:~10! 66 | ) 67 | for /f "delims=" %%x in (%TEMP%\IPPorts4.txt) do CSCRIPT /nologo %windir%\System32\Printing_Admin_Scripts\en-US\prnport.vbs -d -r %%x 68 | 69 | del %TEMP%\IPPorts.txt 70 | del %TEMP%\IPPorts2.txt 71 | del %TEMP%\IPPorts3.txt 72 | del %TEMP%\IPPorts4.txt 73 | 74 | :: Delete all used printer drivers 75 | CSCRIPT /nologo %windir%\System32\Printing_Admin_Scripts\en-US\prndrvr.vbs -x 76 | 77 | goto Exit 78 | 79 | :Exit 80 | net start spooler -------------------------------------------------------------------------------- /remove_libraries_icon_from_desktop.bat: -------------------------------------------------------------------------------- 1 | :: Purpose: Remove the "Libraries" icon that appears on the desktop after certain Windows Updates are applied 2 | :: Requirements: Run this script as an Administrator 3 | :: Author: reddit.com/user/vocatus ( vocatus.gate at gmail ) // PGP key: 0x07d1490f82a211a2 4 | :: Version: 1.0.0 Initial write 5 | SETLOCAL 6 | 7 | 8 | ::::::::::::::: 9 | :: VARIABLES :: -------------- These are the defaults. Change them if you so desire. --------- :: 10 | ::::::::::::::: 11 | :: No user-set variables for this script 12 | 13 | :: --------------------------- Don't edit anything below this line --------------------------- :: 14 | 15 | ::::::::::::::::::::: 16 | :: PREP AND CHECKS :: 17 | ::::::::::::::::::::: 18 | @echo off 19 | %SystemDrive% && cls 20 | set SCRIPT_VERSION=1.0.0 21 | set SCRIPT_UPDATED=2015-08-27 22 | :: Get the date into ISO 8601 standard format (yyyy-mm-dd) so we can use it 23 | FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a 24 | set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% 25 | 26 | title [Remove desktop "Libraries" Icon v%SCRIPT_VERSION%] 27 | 28 | ::::::::::::: 29 | :: EXECUTE :: 30 | ::::::::::::: 31 | reg delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{031E4825-7B94-4dc3-B131-E946B44C8DD5} /f 32 | -------------------------------------------------------------------------------- /remove_old_unused_drivers.ps1: -------------------------------------------------------------------------------- 1 | # Removes old and unused versions of drivers from the Windows driver store 2 | 3 | # Script source: 4 | # https://www.itechtics.com/remove-old-drivers/ 5 | 6 | #Spacing/tabbing is messed up but I've tested the script and it works as of 2020-01-08 7 | 8 | $dismOut = dism /online /get-drivers 9 | $Lines = $dismOut | select -Skip 10 10 | 11 | $Operation = "theName" 12 | $Drivers = @() 13 | 14 | 15 | foreach ( $Line in $Lines ) { 16 | $tmp = $Line 17 | $txt = $($tmp.Split( ':' ))[1] 18 | switch ($Operation) { 19 | 20 | 'theName' { $Name = $txt 21 | $Operation = 'theFileName' 22 | break 23 | } 24 | 25 | 'theFileName' { $FileName = $txt.Trim() 26 | $Operation = 'theEntr' 27 | break 28 | } 29 | 'theEntr' { $Entr = $txt.Trim() 30 | $Operation = 'theClassName' 31 | break 32 | } 33 | 34 | 'theClassName' { $ClassName = $txt.Trim() 35 | 36 | $Operation = 'theVendor' 37 | 38 | break 39 | 40 | } 41 | 42 | 'theVendor' { $Vendor = $txt.Trim() 43 | $Operation = 'theDate' 44 | break 45 | } 46 | 47 | 'theDate' { # change the date format for easy sorting 48 | $tmp = $txt.split( '.' ) 49 | $txt = "$($tmp[2]).$($tmp[1]).$($tmp[0].Trim())" 50 | $Date = $txt 51 | $Operation = 'theVersion' 52 | break 53 | } 54 | 55 | 56 | 'theVersion' { $Version = $txt.Trim() 57 | 58 | $Operation = 'theNull' 59 | $params = [ordered]@{ 'FileName' = $FileName 60 | 'Vendor' = $Vendor 61 | 'Date' = $Date 62 | 'Name' = $Name 63 | 'ClassName' = $ClassName 64 | 'Version' = $Version 65 | 'Entr' = $Entr 66 | } 67 | 68 | 69 | $obj = New-Object -TypeName PSObject -Property $params 70 | $Drivers += $obj 71 | 72 | 73 | break 74 | 75 | } 76 | 'theNull' { $Operation = 'theName' 77 | break 78 | } 79 | } 80 | } 81 | 82 | 83 | Write-Host "All installed third-party drivers" 84 | 85 | $Drivers | sort Filename | ft 86 | 87 | Write-Host "Different versions" 88 | 89 | $last = '' 90 | $NotUnique = @() 91 | 92 | 93 | foreach ( $Dr in $($Drivers | sort Filename) ) { 94 | if ($Dr.FileName -eq $last ) { $NotUnique += $Dr } 95 | $last = $Dr.FileName 96 | } 97 | 98 | $NotUnique | sort FileName | ft 99 | 100 | Write-Host "Outdated drivers" 101 | 102 | $list = $NotUnique | select -ExpandProperty FileName -Unique 103 | 104 | $ToDel = @() 105 | 106 | foreach ( $Dr in $list ) { 107 | Write-Host "duplicate found" -ForegroundColor Yellow 108 | $sel = $Drivers | where { $_.FileName -eq $Dr } | sort date -Descending | select -Skip 1 109 | $sel | ft 110 | $ToDel += $sel 111 | } 112 | 113 | 114 | Write-Host "Drivers to remove" -ForegroundColor Red 115 | 116 | $ToDel | ft 117 | 118 | # removing old drivers 119 | foreach ( $item in $ToDel ) { 120 | $Name = $($item.Name).Trim() 121 | Write-Host "deleting $Name" -ForegroundColor Yellow 122 | Write-Host "pnputil.exe -d $Name" -ForegroundColor Yellow 123 | Invoke-Expression -Command "pnputil.exe -d $Name" 124 | } 125 | -------------------------------------------------------------------------------- /repair_windows_update.bat: -------------------------------------------------------------------------------- 1 | :: Purpose: Attempts to repair a broken Windows Update 2 | :: Requirements: 3 | :: Author: reddit.com/user/vocatus ( vocatus.gate at gmail ) // PGP key: 0x07d1490f82a211a2 and reddit.com/r/usefulscripts 4 | :: Version: 1.0.0 Initial write 5 | :: 6 | SETLOCAL 7 | 8 | 9 | 10 | ::::::::::::::: 11 | :: VARIABLES :: -------------- These are the defaults. Change them if you so desire. --------- :: 12 | ::::::::::::::: 13 | :: Rules for variables: 14 | :: * NO quotes! (bad: "c:\directory\path" ) 15 | :: * NO trailing slashes on the path! (bad: c:\directory\ ) 16 | :: * Spaces are okay (okay: c:\my folder\with spaces ) 17 | :: * Network paths are okay (okay: \\server\share name ) 18 | :: ( \\172.16.1.5\share name ) 19 | 20 | :: no user-set variables for this script 21 | 22 | :: --------------------------- Don't edit anything below this line --------------------------- :: 23 | 24 | 25 | ::::::::::::::::::::: 26 | :: PREP AND CHECKS :: 27 | ::::::::::::::::::::: 28 | @echo off 29 | set SCRIPT_VERSION=1.0.0 30 | set SCRIPT_UPDATED=2015-08-28 31 | 32 | 33 | ::::::::::::: 34 | :: EXECUTE :: 35 | ::::::::::::: 36 | echo. 37 | echo Attempt to repair Windows Update? 38 | echo. 39 | pause 40 | 41 | :: Start the repair 42 | net stop bits 2>NUL 43 | net stop wuauserv 2>NUL 44 | net stop cryptsvc 2>NUL 45 | 46 | :: Cleanup directories 47 | Del "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat" 48 | Rmdir "%Windir%\SoftwareDistribution\Download" /s /q 49 | Rmdir "%systemroot%\SoftwareDistribution\DataStore" /s /q 50 | Rmdir "%systemroot%\system32\catroot2" /s /q 51 | 52 | :: Windows XP & 2003 - Delete %systemroot%\SoftwareDistribution\ as well 53 | ver | findstr /i "5\.1\." > nul 54 | IF %ERRORLEVEL% EQU 0 rmdir "%Windir%\SoftwareDistribution" /s /q 55 | ver | findstr /i "5\.2\." > nul 56 | IF %ERRORLEVEL% EQU 0 rmdir "%Windir%\SoftwareDistribution" /s /q 57 | 58 | sc.exe sdset bits D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU) 59 | sc.exe sdset wuauserv D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU) 60 | pushd /d %windir%\system32 61 | 62 | for %%i in (vbscript,mshtml,msjava,jscript,msxml,actxprxy,shdocvw) do ( 63 | regsvr32 c:\windows\system32\%%i.dll /s 64 | ) 65 | 66 | for %%i in (wuapi,wuaueng1,wuaueng,wucltui,wups2,wups,wuweb,Softpub,Mssip32,Initpki,softpub,wintrust,initpki,dssenh,rsaenh,gpkcsp,sccbase,slbcsp,cryptdlg,Urlmon,Shdocvw,Msjava,Actxprxy,Oleaut32,Mshtml,msxml,msxml2,msxml3,Browseui,shell32,wuapi,wuaueng,wuaueng1,wucltui,wups,wuweb,jscript,atl,Mssip32) do ( 67 | regsvr32 %%i.dll /s 68 | ) 69 | 70 | netsh reset winsock 71 | proxycfg.exe -d 72 | 73 | :: Restart services 74 | net start wuauserv 75 | net start bits 76 | net start cryptsvc 77 | 78 | bitsadmin.exe /reset /allusers 79 | wuauclt /resetauthorization /detectnow 80 | 81 | popd -------------------------------------------------------------------------------- /repair_wmi.bat: -------------------------------------------------------------------------------- 1 | :: Purpose: Rebuilds and repairs WMI on a system 2 | :: Requirements: A broken WMI configuration 3 | :: Author: akp982 at http://community.spiceworks.com/scripts/show/113-rebuild-wmi 4 | :: .bat-wrapped by reddit.com/user/vocatus ( vocatus.gate at gmail ) // PGP key: 0x07d1490f82a211a2 5 | :: Version: 1.0.0 Initial write 6 | 7 | 8 | ::::::::::::::: 9 | :: VARIABLES :: -- Set these to your desired values 10 | ::::::::::::::: 11 | :: Set where to save the logfile here 12 | set LOGPATH=%SystemDrive%\Logs 13 | set LOGFILE=%COMPUTERNAME%_WMI_repair.log 14 | 15 | 16 | :::::::::: 17 | :: Prep :: -- Don't change anything in this section 18 | :::::::::: 19 | @echo off 20 | SETLOCAL 21 | set SCRIPT_VERSION=1.0.0 22 | set SCRIPT_UPDATED=2015-02-11 23 | :: Get the date into ISO 8601 standard format (yyyy-mm-dd) so we can use it 24 | FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a 25 | set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% 26 | 27 | 28 | ::::::::::::: 29 | :: EXECUTE :: 30 | ::::::::::::: 31 | echo. 32 | echo Rebuilding WMI.....Please wait. > "%LOGPATH%\%LOGFILE%" 33 | echo Rebuilding WMI.....Please wait. 34 | echo. 35 | 36 | net stop sharedaccess >> "%LOGPATH%\%LOGFILE%" 37 | net stop winmgmt /y >> "%LOGPATH%\%LOGFILE%" 38 | 39 | pushd %SystemRoot%\system32\wbem >> "%LOGPATH%\%LOGFILE%" 40 | for %%i in (*.dll) do RegSvr32 -s %%i 41 | tskill wbemtest /a 2>NUL 42 | scrcons.exe /RegServer 43 | unsecapp.exe /RegServer 44 | wmiadap.exe /RegServer 45 | wmiapsrv.exe /RegServer 46 | wmiprvse.exe /RegServer 47 | start "" wbemtest.exe /RegServer 48 | tskill wbemtest /a 2>NUL 49 | tskill wbemtest /a 2>NUL 50 | del /Q Repository >> "%LOGPATH%\%LOGFILE%" 51 | mofcomp cimwin32.mof >> "%LOGPATH%\%LOGFILE%" 52 | mofcomp cimwin32.mfl >> "%LOGPATH%\%LOGFILE%" 53 | mofcomp rsop.mof >> "%LOGPATH%\%LOGFILE%" 54 | mofcomp rsop.mfl >> "%LOGPATH%\%LOGFILE%" 55 | for /f %%s in ('dir /b /s *.dll') do regsvr32 /s %%s >> "%LOGPATH%\%LOGFILE%" 56 | for /f %%s in ('dir /b *.mof') do mofcomp %%s >> "%LOGPATH%\%LOGFILE%" 57 | for /f %%s in ('dir /b *.mfl') do mofcomp %%s >> "%LOGPATH%\%LOGFILE%" 58 | mofcomp exwmi.mof >> "%LOGPATH%\%LOGFILE%" 59 | mofcomp -n:root\cimv2\applications\exchange wbemcons.mof >> "%LOGPATH%\%LOGFILE%" 60 | mofcomp -n:root\cimv2\applications\exchange smtpcons.mof >> "%LOGPATH%\%LOGFILE%" 61 | mofcomp exmgmt.mof >> "%LOGPATH%\%LOGFILE%" 62 | net stop winmgmt >> "%LOGPATH%\%LOGFILE%" 63 | net start winmgmt >> "%LOGPATH%\%LOGFILE%" 64 | :: Most aggressive option 65 | winmgmt.exe /resetrepository 66 | :: Less aggressive option 67 | :: winmgmt.exe /salvagerepository /resyncperf 68 | 69 | :: Get 64-bit stuff 70 | if exist %SystemRoot%\SysWOW64\wbem ( 71 | pushd %SystemRoot%\SysWOW64\wbem 72 | for %%j in (*.dll) do RegSvr32 -s %%j 73 | :: Most aggressive option 74 | winmgmt.exe /resetrepository 75 | :: Less aggressive option 76 | :: winmgmt.exe /salvagerepository /resyncperf 77 | wmiadap.exe /RegServer 78 | wmiprvse.exe /RegServer 79 | popd 80 | ) 81 | popd 82 | 83 | 84 | :: finished 85 | echo. 86 | echo WMI rebuild finished, recommend rebooting now.>> "%LOGPATH%\%LOGFILE%" 87 | echo WMI rebuild finished, recommend rebooting now. 88 | echo. 89 | pause 90 | -------------------------------------------------------------------------------- /send_popup_message_to_multiple_systems.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Purpose: Trigger a pop-up message window on a list of systems 3 | Requirements: Admin rights on the target machines 4 | Author: S-6 5 | History: 1.0.0 Initial write 6 | Usage: Edit the variables below to target the OU you want, and specify where psexec is 7 | #> 8 | 9 | 10 | 11 | ############# 12 | # VARIABLES # (set these to your values) 13 | ############# 14 | 15 | # OU containing desktops to target 16 | $DesktopOU = "OU=MB,OU=Desktops,OU=DPTMS,OU=IMCOM,OU=Bliss,OU=Installations,DC=nasw,DC=ds,DC=army,DC=mil" 17 | 18 | # OU containing laptops to target 19 | $LaptopOU = "OU=MB,OU=Laptops,OU=DPTMS,OU=IMCOM,OU=Bliss,OU=Installations,DC=nasw,DC=ds,DC=army,DC=mil" 20 | 21 | # Message to send 22 | #$message = "Please save your work and restart your computer ASAP. Thanks, S-6." 23 | $MessageToSend = "This is a test of the S-6 notification system, please disregard this message." 24 | 25 | # Location of psexec (if using the psexec method vs. the Powershell Invoke-Command method) $psexec = c:\windows\system32\psexec.exe 26 | 27 | 28 | 29 | 30 | ######## 31 | # PREP # 32 | ######## 33 | $SCRIPT_VERSION = "1.0.0" 34 | $SCRIPT_UPDATED = "2020-02-21" 35 | 36 | 37 | 38 | 39 | ########### 40 | # EXECUTE # 41 | ########### 42 | # The wrest of the script is wrapped in the "main" function, just so we can put the logging function at the bottom 43 | function main() { 44 | 45 | # Pull in the list of computers we're targeting 46 | $DesktopList=(get-adcomputer -searchbase "$DesktopOU" -filter * | select -expand Name) 47 | $LaptopList=(get-adcomputer -searchbase "$LaptopOU" -filter * | select -expand Name) 48 | 49 | # for testing against specific systems 50 | #$DesktopList = 'BLISW6CLAAWKPT2', 51 | #'BLISWKMAD1HQ604', 52 | #'BLISWkmad1hq602' 53 | 54 | #$LaptopList = 'BLISW6CLAAWKPT2', 55 | #'BLISWKMAD1HQ604', 56 | #'BLISWkmad1hq602' 57 | 58 | 59 | # Count how many in each OU 60 | $DesktopCount = $DesktopList.Count 61 | $LaptopCount = $LaptopList.Count 62 | $TotalCount = $DesktopCount + $LaptopCount 63 | 64 | 65 | 66 | # Notify what we're doing 67 | log " Message sending script v$SCRIPT_VERSION ($SCRIPT_UPDATED)" green 68 | log " Message to send: '$MessageToSend'" white 69 | log " Desktop OU: ($DesktopCount hosts) '$DesktopOU'" 70 | log " Laptop OU: ($LaptopCount hosts) '$LaptopOU'" 71 | 72 | 73 | # Prompt to launch 74 | "" 75 | write-host " Message will be sent to a total of $TotalCount hosts." -f white 76 | "" 77 | write-host " Are you sure?" -f red 78 | "" 79 | pause 80 | "" 81 | 82 | 83 | # Loop through and send the message (Desktop OU) 84 | log " Sending to hosts in the Desktop OU..." green 85 | 86 | foreach ( $computer in $DesktopList ) { 87 | 88 | # Check to see if the system is online before sending 89 | if (test-Connection -count 1 -Cn $computer -quiet) { 90 | 91 | # Using Psexec to connect 92 | # & $psexec \\$computer -i msg * "$MessageToSend" 93 | 94 | # Using Powershell to connect 95 | Invoke-Command -ComputerName $computer -ScriptBlock { msg * "$using:MessageToSend" } -ea SilentlyContinue # the "$using:" method only works on PS v3 and up 96 | log " $computer sent." 97 | 98 | } else { 99 | log " ! $computer not online, skipping." yellow 100 | } 101 | 102 | } 103 | log " Done." darkgreen 104 | 105 | 106 | 107 | 108 | # Loop through and send the message (Laptop OU) 109 | log " Sending to hosts in the Laptop OU..." green 110 | 111 | foreach ( $computer in $LaptopList ) { 112 | # Check to see if the system is online before sending 113 | if (test-Connection -count 1 -Cn $computer -quiet) { 114 | 115 | # Using Psexec to connect 116 | # & $psexec \\$computer -i msg * "$MessageToSend" 117 | 118 | # Using Powershell to connect 119 | Invoke-Command -ComputerName $computer -ScriptBlock { msg * "$using:MessageToSend" } -ea SilentlyContinue # the "$using:" method only works on PS v3 and up 120 | log " $computer sent." 121 | 122 | } else { 123 | log " ! $computer not online, skipping." yellow 124 | } 125 | 126 | } 127 | log " Done." darkgreen 128 | 129 | } # Close out the main function. End of script 130 | 131 | 132 | 133 | 134 | ############# 135 | # FUNCTIONS # 136 | ############# 137 | function log($message, $color) 138 | { 139 | if ($color -eq $null) {$color = "gray"} 140 | # log to console 141 | write-host (get-date -f "yyyy-MM-dd hh:mm:ss") -n -f darkgray; write-host "$message" -f $color 142 | } 143 | 144 | 145 | 146 | # Call the main function (script). Script won't function without this line 147 | main -------------------------------------------------------------------------------- /setip.bat: -------------------------------------------------------------------------------- 1 | :: Purpose: Allows you to quickly change your IP address without using the GUI 2 | :: Requirements: Windows XP and up 3 | :: Author: reddit.com/user/vocatus ( vocatus.gate at gmail ) // PGP key: 0x07d1490f82a211a2 4 | :: Version: 3.6.3 * Improve robustness of IPCONFIG output 5 | :: 3.6.2 * Updated preloaded DNS servers to use dns.watch's DNS instead of Google's 6 | :: 3.6.1 * Updated preloaded DNS servers to use Google's DNS instead of OpenDNS due to their stupid DNS hijacking 7 | :: - Removed some TITLE commands 8 | :: 3.6.0 * Reworked CUR_DATE variable to handle more than one Date/Time format 9 | :: Can now handle ISO standard dates (yyyy-mm-dd) and Windows default dates (e.g. "Fri 01/24/2014") 10 | :: 3.5.0 * Major re-write: 11 | :: -- Updated command-line argument ability. Can now specify DHCP or static after adapter name 12 | :: -- Added help section that will spit out when run from the command line 13 | :: -- Code cleanup and restructure 14 | :: 3.1.0 - Removed warning, fixed error when deleting temp file 15 | :: 3.0.0 * Major re-write: 16 | :: -- Added support for command-line invocation, with [optional] name of adapter to be changed 17 | :: -- Combined both scripts into one, and added warning to the beginning 18 | :: -- Script can now be invoked with adapter name to be changed. If not it will prompt for it. 19 | :: -- Re-wrote entire menu structure and added new options (DHCP, Quit) 20 | :: -- Now using %TEMP% variable for storing the working text files (for menus) instead of C:\ 21 | :: -- Script now offers to use the OpenDNS servers as backup to the default gateway (for DNS) 22 | :: 2.0.0 / Changed hard-coded adapter name to a script-wide variable and cleaned up menus 23 | :: 1.5.0 + Created basic (ugly) menu structure 24 | :: 1.0.0 Initial write 25 | @echo off 26 | SETLOCAL 27 | 28 | 29 | ::::::::::::::: 30 | :: VARIABLES :: --------------- These are the defaults. Change them if you so desire. -------- :: 31 | ::::::::::::::: 32 | :: Rules for variables: 33 | :: * NO quotes! (bad: "c:\directory\path" ) 34 | :: * NO trailing slashes on the path! (bad: c:\directory\ ) 35 | :: * Spaces are okay (okay: c:\my folder\with spaces ) 36 | :: * Network paths are okay (okay: \\server\share name ) 37 | :: ( \\172.16.1.5\share name ) 38 | :: \/ The first argument passed to the script becomes the adapter to be changed. \/ 39 | set ADAPTER_NAME=%1 40 | set IP= 41 | set GATEWAY= 42 | set MASK= 43 | set DNS1= 44 | set DNS2=84.200.69.80 45 | set DNS3=84.200.70.40 46 | 47 | 48 | 49 | 50 | :: --------------------------- Don't edit anything below this line --------------------------- :: 51 | 52 | 53 | 54 | ::::::::::::::::::::: 55 | :: Prep and checks :: 56 | ::::::::::::::::::::: 57 | 58 | set SCRIPT_VERSION=3.6.3 59 | set SCRIPT_UPDATED=2020-07-16 60 | :: Get the date into ISO 8601 standard format (yyyy-mm-dd) so we can use it 61 | FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a 62 | set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% 63 | 64 | :: Get IP information (excluding VMware adapters) 65 | if exist "%TEMP%\temp_ethernet_adapter_config1.txt" del /f /q "%TEMP%\temp_ethernet_adapter_config1.txt" >nul 66 | if exist "%TEMP%\temp_ethernet_adapter_config.txt" del /f /q "%TEMP%\temp_ethernet_adapter_config.txt" >nul 67 | if exist "%TEMP%\tmpip.txt" del /f /q "%TEMP%\tmpip.txt" >nul 68 | :: Get all non-VMWare adapters 69 | netsh interface show interface | findstr /v VMware | findstr Enabled > "%TEMP%\tmpip.txt" && @for /f "tokens=4" %%a in (%TEMP%\tmpip.txt) do @netsh interface ip show config name=%%a >> "%TEMP%\temp_ethernet_adapter_config1.txt" 70 | :: Strip out the terms "metric" "WINS" and "suffix" 71 | findstr /i /v "metric WINS suffix" <"%TEMP%\temp_ethernet_adapter_config1.txt" >"%TEMP%\temp_ethernet_adapter_config.txt" 72 | 73 | 74 | ::::::::::::::::::::: 75 | :: Check arguments :: 76 | ::::::::::::::::::::: 77 | :: Catch the most common "help" arguments 78 | if '%1%'=='h' goto help 79 | if '%1%'=='-h' goto help 80 | if '%1%'=='/h' goto help 81 | if '%1%'=='?' goto help 82 | if '%1%'=='-?' goto help 83 | if '%1%'=='/?' goto help 84 | 85 | 86 | :: Normal Argument catching 87 | :: 1. Did the user pass an argument upon invocation? If not, go to the menu 88 | :: 2. Did the user say to use DHCP? If so, skip directly to DHCP 89 | :: 3. Did the user say to use Static? If so, skip directly to asking for the values 90 | if '%1%'=='' goto specify_adapter 91 | if '%2%'=='dhcp' goto dhcp 92 | if '%2%'=='static' goto enter_values 93 | goto start 94 | 95 | 96 | :::::::::: 97 | :: Help :: 98 | :::::::::: 99 | :help 100 | echo. 101 | echo %~nx0 v%SCRIPT_VERSION% -- Set your IP address from the command line. 102 | echo. 103 | echo USAGE: 104 | echo %~nx0 ^["adapter name"^] ^[dhcp ^| static^] 105 | echo. 106 | echo where: 107 | echo adapter name -- Optional: specify which adapter to modify 108 | echo dhcp -- Optional: specify to attempt to get an IP address via DHCP 109 | echo static -- Optional: specify you want to set a static IP address 110 | echo. 111 | echo If you run the script with no arguments it will go to the interactive menu. 112 | echo If the adapter name has spaces in it, surround it with quotes "like this" 113 | echo. 114 | goto end 115 | 116 | 117 | ::::::::::::::::::::: 118 | :: Specify Adapter :: - Only called if the user didn't pass an adapter name as the first argument 119 | ::::::::::::::::::::: 120 | :specify_adapter 121 | cls 122 | title TCP/IP Configuration for LAN 123 | 124 | echo. 125 | echo ------------------------------ 126 | echo Current TCP/IP Configuration 127 | echo ------------------------------ 128 | type "%TEMP%\temp_ethernet_adapter_config.txt" 129 | echo. 130 | echo ************************************************************ 131 | echo Which adapter do you want to change? (eth0, wlan0, etc) 132 | echo. 133 | echo (To save time, run the script with the name of the adapter 134 | echo you want changed) 135 | echo. 136 | echo Examples: %~nx0 "Local Area Connection 1" 137 | echo %~nx0 eth0 static 138 | echo %~nx0 eth1 dhcp 139 | echo ************************************************************ 140 | echo. 141 | set /p ADAPTER_NAME=Enter the name of the ADAPTER to change: 142 | goto start 143 | 144 | 145 | ::::::::::::::::: 146 | :: Main Screen :: 147 | ::::::::::::::::: 148 | :start 149 | title TCP/IP Config for "%ADAPTER_NAME%" & cls 150 | echo. 151 | echo ------------------------------ 152 | echo Current TCP/IP Configuration 153 | echo ------------------------------ 154 | echo. 155 | type "%TEMP%\temp_ethernet_adapter_config.txt" 156 | echo. 157 | echo. 158 | echo Adapter to be changed is: "%ADAPTER_NAME%" 159 | echo ----------------------------------- 160 | echo Enter "1" to change the IP address manually. 161 | echo Enter "2" to set the adapter to DHCP and attempt to acquire an address. 162 | echo Enter "3" to pick a different adapter to change. 163 | echo Enter "4" to quit. 164 | :menu 165 | set choice= 166 | echo. 167 | set /p choice=Choice: 168 | if not '%choice%'=='' set choice=%choice:~0,1% 169 | if '%choice%'=='1' goto enter_values 170 | if '%choice%'=='2' goto dhcp 171 | if '%choice%'=='3' goto specify_adapter 172 | if '%choice%'=='4' goto cancel 173 | echo. 174 | echo "%choice%" is not valid, please try again 175 | echo. 176 | goto menu 177 | pause 178 | 179 | :::::::::::::::::: 180 | :: Enter Values :: 181 | :::::::::::::::::: 182 | :enter_values 183 | echo. 184 | echo Modifying adapter "%ADAPTER_NAME%" 185 | echo. 186 | set /p IP=Enter the new IP address: 187 | set /p MASK=Enter the new subnet mask: 188 | set /p GATEWAY=Enter the new default gateway: 189 | set DNS1=%GATEWAY% 190 | 191 | echo. 192 | echo These default DNS servers will be loaded: 193 | echo Primary: %GATEWAY% (default gateway) 194 | echo Secondary: %DNS2% (OpenDNS) 195 | echo Tertiary: %DNS3% (OpenDNS) 196 | echo. 197 | set /p CHOICE=Is this okay? [Y/n]: 198 | if '%CHOICE%'=='y' goto execute_prompt 199 | if '%CHOICE%'=='n' goto enter_dns 200 | 201 | ::::::::::::: 202 | :: EXECUTE :: 203 | ::::::::::::: 204 | :execute_prompt 205 | color f0 206 | cls 207 | echo. 208 | echo About to apply this configuration: 209 | echo. 210 | echo IP Address: %IP% 211 | echo Subnet Mask: %MASK% 212 | echo Default Gateway: %GATEWAY% 213 | echo DNS Servers: %DNS1% (Primary) 214 | echo %DNS2% 215 | echo %DNS3% 216 | echo. 217 | set /p CHOICE=Apply this configuration? [Y/n]: 218 | if '%CHOICE%'=='y' goto execute_do 219 | if '%CHOICE%'=='n' goto start 220 | 221 | :execute_do 222 | color & cls 223 | echo. 224 | echo Applying the TCP/IP configuration. 225 | echo This could take up to 30 seconds, please be patient... 226 | echo. 227 | echo Setting IP address to %IP%... 228 | netsh interface ip set address name="%ADAPTER_NAME%" source=static %IP% %MASK% %GATEWAY% 1 229 | echo Setting the default gateway %GATEWAY% as primary DNS... 230 | netsh interface ip set dns name="%ADAPTER_NAME%" static %DNS1% primary 231 | echo Setting %DNS2% and %DNS3% as the alternate DNS servers... 232 | netsh interface ip add dns name="%ADAPTER_NAME%" %DNS2% index=2 233 | netsh interface ip add dns name="%ADAPTER_NAME%" %DNS3% index=3 234 | goto done 235 | 236 | 237 | :::::::::: 238 | :: DHCP :: 239 | :::::::::: 240 | :dhcp 241 | echo. 242 | echo Using DHCP to acquire IP address for adapter "%ADAPTER_NAME%"... 243 | echo. 244 | netsh interface ip set address name="%ADAPTER_NAME%" source=dhcp 245 | echo Using DHCP to acquire DNS servers... 246 | netsh interface ip set dns name="%ADAPTER_NAME%" source=dhcp 247 | ipconfig /renew 248 | goto done 249 | 250 | 251 | :::::::::::::::: 252 | :: Manual DNS :: Only used when user isn't okay with default DNS settings. Is skipped most of the time. 253 | :::::::::::::::: 254 | :enter_dns 255 | set /p DNS1=Enter IP address of first DNS server: 256 | set /p DNS2=Enter IP address of second DNS server: 257 | set /p DNS3=Enter IP address of third DNS server: 258 | goto execute_prompt 259 | 260 | :::::::::: 261 | :: DONE :: 262 | :::::::::: 263 | :done 264 | cls 265 | :: Show user the results. We output IP config information to a file, strip out some stuff, then present the results. Finally, we delete the temp file. 266 | echo. 267 | echo Results: 268 | echo -------- 269 | ipconfig /all > "%TEMP%\tempLANconfig.txt" 270 | findstr /R "IPv4 IPv6 Subnet DHCP Dhcp IP.A Default Ethernet DNS.Ser" <"%TEMP%\tempLANconfig.txt" >"%TEMP%\tempLANconfig2.txt" 271 | echo. 272 | type "%TEMP%\temp_ethernet_adapter_config.txt" 273 | echo. 274 | if exist "%TEMP%\temp_ethernet_adapter_config1.txt" del /f /q "%TEMP%\temp_ethernet_adapter_config1.txt" >nul 275 | if exist "%TEMP%\temp_ethernet_adapter_config.txt" del /f /q "%TEMP%\temp_ethernet_adapter_config.txt" >nul 276 | if exist "%TEMP%\tmpip.txt" del /f /q "%TEMP%\tmpip.txt" >nul 277 | pause 278 | goto end 279 | 280 | :cancel 281 | cls 282 | echo. 283 | echo Canceled! Goodbye. 284 | 285 | :end 286 | if exist "%TEMP%\temp_ethernet_adapter_config1.txt" del /f /q "%TEMP%\temp_ethernet_adapter_config1.txt" >nul 287 | if exist "%TEMP%\temp_ethernet_adapter_config.txt" del /f /q "%TEMP%\temp_ethernet_adapter_config.txt" >nul 288 | if exist "%TEMP%\tmpip.txt" del /f /q "%TEMP%\tmpip.txt" >nul 289 | ENDLOCAL 290 | -------------------------------------------------------------------------------- /setip_basic.bat: -------------------------------------------------------------------------------- 1 | :: Purpose: Allows you to quickly change your IP address without using the GUI 2 | :: Requirements: Windows XP and up 3 | :: Author: reddit.com/user/vocatus ( vocatus.gate at gmail ) // PGP key: 0x07d1490f82a211a2 4 | :: Version: 1.0.0 Initial write 5 | @echo off 6 | 7 | 8 | ::::::::::::::: 9 | :: VARIABLES :: --------------- These are the defaults. Change them if you so desire. -------- :: 10 | ::::::::::::::: 11 | :: Rules for variables: 12 | :: * NO quotes! (bad: "c:\directory\path" ) 13 | :: * NO trailing slashes on the path! (bad: c:\directory\ ) 14 | :: * Spaces are okay (okay: c:\my folder\with spaces ) 15 | :: * Network paths are okay (okay: \\server\share name ) 16 | :: ( \\172.16.1.5\share name ) 17 | 18 | :: Static IP config 19 | set ADAPTER_NAME=eth1 20 | set IP=192.168.100.10 21 | set MASK=255.255.255.0 22 | set GATEWAY=192.168.100.1 23 | set DNS1= 24 | set DNS2=84.200.69.80 25 | set DNS3=84.200.70.40 26 | 27 | 28 | 29 | 30 | :: --------------------------- Don't edit anything below this line --------------------------- :: 31 | 32 | 33 | 34 | :: Prep and checks 35 | set SCRIPT_VERSION=1.0.0 36 | set SCRIPT_UPDATED=2020-07-16 37 | :: Get the date into ISO 8601 standard format (yyyy-mm-dd) so we can use it 38 | FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a 39 | set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2% 40 | 41 | 42 | 43 | 44 | 45 | 46 | :: Ask whether DHCP or static 47 | echo. 48 | echo Quick IP change script v%SCRIPT_VERSION% 49 | echo ----------------------------- 50 | echo Static config (if loaded): 51 | echo. 52 | echo Adapter name: %ADAPTER_NAME% 53 | echo IP: %IP% 54 | echo Subnet: %MASK% 55 | echo Gateway: %GATEWAY% 56 | echo DNS servers: %DNS1% 57 | echo %DNS2% 58 | echo %DNS3% 59 | echo ----------------------------- 60 | echo. 61 | :choice_prompt 62 | set choice=a 63 | set /p choice=Enter 'a' for auto (DHCP) or 'b' to load the static config above [A/b]: 64 | if not '%choice%'=='' set choice=%choice:~0,1% 65 | if '%choice%'=='a' goto auto_dhcp 66 | if '%choice%'=='b' goto manual_static 67 | echo. 68 | echo "%choice%" is not valid, please try again 69 | echo. 70 | goto choice_prompt 71 | 72 | 73 | 74 | :: Manual/static 75 | :manual_static 76 | echo. 77 | echo Applying the static TCP/IP configuration. 78 | echo This could take up to 30 seconds, please be patient... 79 | echo. 80 | echo Setting IP address to %IP%... 81 | netsh interface ip set address name=%ADAPTER_NAME% source=static %IP% %MASK% %GATEWAY% 1 > NUL 2>&1 82 | echo Setting the default gateway %GATEWAY% as primary DNS... 83 | netsh interface ip set dns name=%ADAPTER_NAME% static %DNS1% primary > NUL 2>&1 84 | echo Setting %DNS2% and %DNS3% as the alternate DNS servers... 85 | netsh interface ip add dns name=%ADAPTER_NAME% %DNS2% index=2 > NUL 2>&1 86 | netsh interface ip add dns name=%ADAPTER_NAME% %DNS3% index=3 > NUL 2>&1 87 | goto end 88 | 89 | 90 | :: Auto DHCP 91 | :auto_dhcp 92 | echo. 93 | echo Using DHCP to acquire IP address for adapter %ADAPTER_NAME%... 94 | echo. 95 | netsh interface ip set address name=%ADAPTER_NAME% source=dhcp > NUL 2>&1 96 | echo Using DHCP to acquire DNS servers... 97 | netsh interface ip set dns name=%ADAPTER_NAME% source=dhcp > NUL 2>&1 98 | ipconfig /renew "%ADAPTER_NAME%" > NUL 2>&1 99 | 100 | 101 | 102 | :end 103 | del "%TEMP%\tempLANconfig.txt" /Q 2>nul 104 | del "%TEMP%\tempLANconfig2.txt" /Q 2>nul -------------------------------------------------------------------------------- /show_windows_version_on_desktop.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | ;Display the Build Number on the desktop 4 | [HKEY_CURRENT_USER\Control Panel\Desktop] 5 | "PaintDesktopVersion"=dword:00000001 -------------------------------------------------------------------------------- /simple_backup_script.bat: -------------------------------------------------------------------------------- 1 | :: Purpose: Performs an update-backup operation on two folders, mirroring changes from one to the other 2 | :: Requirements: None 3 | :: Author: reddit.com/user/vocatus ( vocatus.gate at gmail ) // PGP key: 0x07d1490f82a211a2 4 | :: Version: 1.0.0 5 | :: Usage: run from a Windows shortcut or command-line. First argument is source, second argument is destination, third argument (if present, "yes") skips a purge backup (don't delete extra files) 6 | 7 | :: --Switches Used-- 8 | :: --robocopy-- 9 | :: /V Verbose logging 10 | :: /L List files but don't write/copy/touch them 11 | :: /PURGE Delete files that no longer exist in source 12 | :: /E Copy all directories (including sub-dirs) 13 | :: /LOG+: Stick a logfile here [ path ], and append+ any new stuff to the end 14 | :: /XD " " Exlude any directory containing this string [ "string" ] 15 | :: /COPY: DAT Copy only Data (the file), attributes (read-only, etc), and Timestamps 16 | :: /NP No progress (don't display progress) 17 | :: /MT:8 Use 8 threads to copy 18 | :: 19 | :: --findstr-- 20 | :: /I Search is NOT case-sensitive 21 | :: /V Include any line that does NOT match the search string (I.E. "don't find this") 22 | :: "john doe" Multiple search strings separated by a space 23 | 24 | :: Prepare the environment 25 | @echo off 26 | pushd %~dp0 27 | 28 | :: Source and destination 29 | set SOURCE=%1 30 | set DESTINATION=%2 31 | set SKIP_PURGE=no 32 | if "%3"=="yes" (set SKIP_PURGE=yes) 33 | 34 | 35 | :: Log file 36 | set LOGPATH=%SystemDrive%\logs 37 | set LOGFILE=simple_backup.log 38 | 39 | 40 | :: Build log directories if they don't exist 41 | for %%D in ("%LOGPATH%","%DESTINATION%") do ( 42 | if not exist %%D mkdir %%D 43 | ) 44 | 45 | 46 | 47 | 48 | cls 49 | title Backing up %source%... 50 | echo. 51 | echo %TIME% Backup started. 52 | echo. 53 | echo Source: %SOURCE% 54 | echo Destination: %DESTINATION% 55 | echo. 56 | 57 | :: 58 | :: Do the copy 59 | :: 60 | title Copying files... 61 | :: robocopy "%source%" "%destination%" /E /NP /PURGE /ZB /LOG:"%LOGPATH%\%LOGFILE%" 62 | 63 | if %SKIP_PURGE%==yes ( 64 | robocopy "%source%" "%destination%" /E /ZB /FFT /MT:8 /R:2 /W:5 65 | ) else ( 66 | robocopy "%source%" "%destination%" /E /PURGE /ZB /FFT /MT:8 /R:2 /W:5 67 | ) 68 | -------------------------------------------------------------------------------- /tron_parse_incoming_guids.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Purpose: Parses a list of user-submitted GUIDs against Tron's by_GUID list. 3 | Removes all lines that are already in the by_GUID list, then outputs new unique lines to a new file 4 | Requirements: Specify path to master GUID file, incoming file to check against, and output file 5 | Author: reddit.com/user/vocatus ( vocatus.gate@gmail.com ) // PGP key: 0x07d1490f82a211a2 6 | History: 1.0.3 * Simply whitespace removal block, use regex instead of multiple repetitive statements 7 | + Add extraction of "Intel" entries into separate file 8 | 1.0.2 + Add extraction of common entries ("CCC", "Microsoft" etc) into separate files for easy review 9 | 1.0.1 + Add auto compilation and cleanup of incoming GUID lists 10 | 1.0.0 Initial write 11 | Usage: Make sure paths are specified correctly (variables below) then run the script 12 | #> 13 | 14 | 15 | ############# 16 | # VARIABLES # -- Set these to your desired values or supply from the shell ---------------------- # 17 | ############# 18 | # Rules for variables: 19 | # * Quotes are required (e.g.: "c:\directory\path" ) 20 | # * NO trailing slashes on paths! (bad: "c:\directory\" ) 21 | # * Spaces are okay (okay: "c:\my folder\with spaces" ) 22 | # * Network paths are okay (okay: "\\server\share name" ) 23 | # ( "\\172.16.1.5\share name" ) 24 | param ( 25 | # Path to master file 26 | [string] $byGUIDListFile = "r:\utilities\security\cleanup-repair\tron\tron\resources\stage_2_de-bloat\oem\programs_to_target_by_GUID.txt", 27 | 28 | # Path to toolbar/BHO file 29 | [string] $toolbarBHOListFile = "r:\utilities\security\cleanup-repair\tron\tron\resources\stage_2_de-bloat\oem\toolbars_BHOs_to_target_by_GUID.txt", 30 | 31 | # Path to GUID whitelist file 32 | [string] $whitelistGUIDPath = "r:\scripts\blackmesa\tron_guid_whitelist.txt", 33 | 34 | # Path to candidate (new) file 35 | [string] $candidateListFile = "$env:temp\tron_parse_incoming_guids_candidateListFile.txt", 36 | 37 | # Path to directory containing incoming GUID dump files 38 | [string] $incomingGUIDDirectory = "r:\unsorted", 39 | 40 | # Path to output directory 41 | [string] $outputFile = "r:\unsorted\guid_parsed_dump.txt" 42 | 43 | ) 44 | 45 | 46 | 47 | 48 | 49 | # ----------------------------- Don't edit anything below this line ----------------------------- # 50 | 51 | 52 | 53 | 54 | ######## 55 | # PREP # 56 | ######## 57 | $SCRIPT_VERSION = "1.0.3" 58 | $SCRIPT_UPDATED = "2022-12-21" 59 | 60 | 61 | ############# 62 | # EXECUTION # 63 | ############# 64 | function main() { 65 | 66 | # pre-run cleanup in case there are leftovers from another run 67 | ri "$outputFile" -ea SilentlyContinue 68 | ri "$env:temp\tron_parse_incoming_guids_working_file_1_duplicates_removed.txt" -ea silentlycontinue 69 | ri "$env:temp\tron_parse_incoming_guids_candidateListFile.txt.txt" -ea silentlycontinue 70 | ri "$env:temp\parse_incoming_guids_working_file_2_toolbar_bho_removed.txt" -ea silentlycontinue 71 | ri "$env:temp\tron_parse_incoming_guids_temp1.txt" -ea silentlycontinue 72 | ri "$env:temp\tron_parse_incoming_guids_temp2.txt" -ea silentlycontinue 73 | 74 | 75 | # Notify that we're starting 76 | log " Removing whitelisted and pre-existing GUIDs from candidate list..." white 77 | log " master: $byGUIDListFile" darkgray 78 | log " toolbar_bho: $toolbarBHOListFile" darkgray 79 | log " whitelist: $whitelistGUIDPath" darkgray 80 | log " output: $outputFile" darkgray 81 | 82 | 83 | # STAGE 0/4: Compile incoming GUID lists into a by_GUID list and clean it for parsing 84 | dir $incomingGUIDDirectory\* -include GUID_dump*.txt -rec | gc | out-file $env:temp\tron_parse_incoming_guids_temp1.txt 85 | 86 | log " Compiled new candidate list. Now processing, please wait..." 87 | 88 | # Strip out lines containing "IdentifyingNumber" 89 | gc "$env:temp\tron_parse_incoming_guids_temp1.txt" | Where-Object {$_ -notmatch 'IdentifyingNumber'} | sc "$env:temp\tron_parse_incoming_guids_temp2.txt" 90 | 91 | # Condense whitespace (replace multiple spaces with one) 92 | $trimSpaces = gc "$env:temp\tron_parse_incoming_guids_temp2.txt" 93 | $trimSpaces = $trimSpaces -replace '\s{2,}', ' ' 94 | $trimSpaces | sc "$env:temp\tron_parse_incoming_guids_temp2.txt" 95 | 96 | # Sort remaining contents and remove duplicates 97 | gc "$env:temp\tron_parse_incoming_guids_temp2.txt" | sort | get-unique > $candidateListFile 98 | 99 | # Notify how many duplicates were removed 100 | $raw = $(gc "$env:temp\tron_parse_incoming_guids_temp1.txt" -total -1).count 101 | $parsed = $(gc "$candidateListFile" -total -1).count 102 | $duplicatesRemoved = $raw - $parsed 103 | if ( $duplicatesRemoved -gt 0 ) { 104 | log " Removed $duplicatesRemoved duplicate lines from candidate list" 105 | } else { 106 | log " No duplicate lines found" darkgray 107 | } 108 | 109 | 110 | 111 | 112 | # STAGE 1/4: Compare against by_GUID list 113 | $candidateListContents = gc $candidateListFile 114 | $byGUIDListContents = gc $byGUIDListFile 115 | foreach ( $row in $candidateListContents ) { 116 | $found = $false 117 | # Do a regex match to find GUIDs, since they always follow this format. Note: will not work if the hyphens have been removed 118 | if ( $row -match "........\-....\-....\-....\-............" ) { $firstGUID = $MATCHES[0] 119 | foreach ( $line in $byGUIDListContents ) { 120 | if ( $line -match "........\-....\-....\-....\-............" ) { $newGUID = $MATCHES[0] } 121 | if ( $firstGUID -eq $newGUID ) { $found = $true } 122 | } 123 | } 124 | if ( -not $found ) { echo $row | out-file $env:temp\tron_parse_incoming_guids_working_file_1_duplicates_removed.txt -append -encoding default } 125 | } 126 | 127 | # Tell us how many items were removed 128 | $raw = $(gc "$candidateListFile" -total -1).count 129 | $parsed = $(gc "$env:temp\tron_parse_incoming_guids_working_file_1_duplicates_removed.txt" -total -1).count 130 | $byGUIDRemoved = $raw - $parsed 131 | if ( $byGUIDRemoved -gt 0 ) { 132 | log " Matched $byGUIDRemoved lines from by_GUID list" 133 | } else { 134 | log " No matches against by_GUID list" darkgray 135 | } 136 | 137 | 138 | 139 | 140 | # STAGE 2/4: Compare against toolbar/BHO list 141 | $candidateListContents = gc $env:temp\tron_parse_incoming_guids_working_file_1_duplicates_removed.txt 142 | $toolbarBHOListContents = gc $toolbarBHOListFile 143 | foreach ( $row in $candidateListContents ) { 144 | $found = $false 145 | # Do a regex match to find GUIDs, since they always follow this format. Note: will not work if the hyphens have been removed 146 | if ( $row -match "........\-....\-....\-....\-............" ) { $firstGUID = $MATCHES[0] 147 | foreach ( $line in $toolbarBHOListContents ) { 148 | if ( $line -match "........\-....\-....\-....\-............" ) { $newGUID = $MATCHES[0] } 149 | if ( $firstGUID -eq $newGUID ) { $found = $true } 150 | } 151 | } 152 | if ( -not $found ) { echo $row | out-file $env:temp\parse_incoming_guids_working_file_2_toolbar_bho_removed.txt -append -encoding default } 153 | } 154 | 155 | # Tell us how many items were removed 156 | $raw = $(gc "$env:temp\tron_parse_incoming_guids_working_file_1_duplicates_removed.txt" -total -1).count 157 | $parsed = $(gc "$env:temp\parse_incoming_guids_working_file_2_toolbar_bho_removed.txt" -total -1).count 158 | $toolbarBHORemoved = $raw - $parsed 159 | if ( $toolbarBHORemoved -gt 0 ) { 160 | log " Matched $toolbarBHORemoved lines from toolbar/BHO list" 161 | } else { 162 | log " No matches against toolbar/BHO list" darkgray 163 | } 164 | 165 | 166 | 167 | 168 | # STAGE 3/4: Compare against whitelist 169 | $candidateListContents = gc $env:temp\parse_incoming_guids_working_file_2_toolbar_bho_removed.txt 170 | $whitelistGUIDContents = gc $whitelistGUIDPath 171 | foreach ( $row in $candidateListContents ) { 172 | $found = $false 173 | # Do a regex match to find GUIDs, since they always follow this format. Note: will not work if the hyphens have been removed 174 | if ( $row -match "........\-....\-....\-....\-............" ) { $firstGUID = $MATCHES[0] 175 | foreach ( $line in $whitelistGUIDContents ) { 176 | if ( $line -match "........\-....\-....\-....\-............" ) { $newGUID = $MATCHES[0] } 177 | if ( $firstGUID -eq $newGUID ) { $found = $true } 178 | } 179 | } 180 | if ( -not $found ) { echo $row | out-file $outputFile -append -encoding default } 181 | } 182 | 183 | # Tell us how many items were removed 184 | $raw = $(gc "$env:temp\parse_incoming_guids_working_file_2_toolbar_bho_removed.txt" -total -1).count 185 | $parsed = $(gc "$outputFile" -total -1).count 186 | $whitelistedRemoved = $raw - $parsed 187 | if ( $whitelistedRemoved -gt 0 ) { 188 | log " Matched $whitelistedRemoved lines from whitelist" 189 | } else { 190 | log " No matches against whitelist" darkgray 191 | } 192 | 193 | 194 | 195 | # STAGE 4/4: Extract common items that show up every run (CCC, "Microsoft" anything, etc) 196 | type $outputFile | find /i `"CCC `" > $incomingGUIDDirectory\guid_parsed_dump_ccc.txt 197 | type $outputFile | find /v /i `"CCC `" > $incomingGUIDDirectory\temp1111.txt 198 | type $incomingGUIDDirectory\temp1111.txt > $outputFile 199 | ri "$incomingGUIDDirectory\temp1111.txt" -ea silentlycontinue 200 | 201 | type $outputFile | find /i `"Microsoft`" > $incomingGUIDDirectory\guid_parsed_dump_microsoft.txt 202 | type $outputFile | find /v /i `"Microsoft`" > $incomingGUIDDirectory\temp1111.txt 203 | type $incomingGUIDDirectory\temp1111.txt > $outputFile 204 | ri "$incomingGUIDDirectory\temp1111.txt" -ea silentlycontinue 205 | 206 | type $outputFile | find /i `"Windows`" > $incomingGUIDDirectory\guid_parsed_dump_windows.txt 207 | type $outputFile | find /v /i `"Windows`" > $incomingGUIDDirectory\temp1111.txt 208 | type $incomingGUIDDirectory\temp1111.txt > $outputFile 209 | ri "$incomingGUIDDirectory\temp1111.txt" -ea silentlycontinue 210 | 211 | type $outputFile | find /i `"Intel`" > $incomingGUIDDirectory\guid_parsed_dump_windows.txt 212 | type $outputFile | find /v /i `"Intel`" > $incomingGUIDDirectory\temp1111.txt 213 | type $incomingGUIDDirectory\temp1111.txt > $outputFile 214 | ri "$incomingGUIDDirectory\temp1111.txt" -ea silentlycontinue 215 | 216 | 217 | log " Extracted common bulk items into separate files" 218 | 219 | 220 | 221 | # Clean up after ourselves 222 | ri "$env:temp\tron_parse_incoming_guids_working_file_1_duplicates_removed.txt" -ea silentlycontinue 223 | ri "$env:temp\parse_incoming_guids_working_file_2_toolbar_bho_removed.txt" -ea silentlycontinue 224 | ri "$env:temp\tron_parse_incoming_guids_candidateListFile.txt" -ea silentlycontinue 225 | ri "$env:temp\tron_parse_incoming_guids_temp1.txt" -ea silentlycontinue 226 | ri "$env:temp\tron_parse_incoming_guids_temp2.txt" -ea silentlycontinue 227 | ri "$incomingGUIDDirectory\GUID_dump_*.txt" -ea silentlycontinue 228 | ri "$incomingGUIDDirectory\tron*.log" -ea silentlycontinue 229 | ri "$env:appdata\Microsoft\Recent\tron_parse_incoming_guids.ps1.lnk" -ea silentlycontinue 230 | 231 | # Currently I'm wiping screenshots since I don't care about them 232 | ri "$incomingGUIDDirectory\tron_*.png" -ea silentlycontinue 233 | 234 | 235 | 236 | # Tally up and report 237 | $tally = $duplicatesRemoved + $byGUIDRemoved + $whitelistedRemoved + $toolbarBHORemoved 238 | $remaining = (gc $outputFile -total -1).count 239 | if ( $tally -gt 0 ) { 240 | log " ------------------------------------------------------" 241 | log " $tally duplicate or pre-existing lines removed" 242 | log " $remaining lines remain for manual review" green 243 | } else { 244 | log " No candidate list entry matches" white 245 | } 246 | log " Done" darkgray 247 | 248 | 249 | pause 250 | } # /script 251 | 252 | 253 | 254 | 255 | 256 | ############# 257 | # FUNCTIONS # 258 | ############# 259 | function log($message, $color) 260 | { 261 | if ($color -eq $null) {$color = "gray"} 262 | write-host (get-date -f "yyyy-MM-dd hh:mm:ss") -n -f darkgray; write-host "$message" -f $color 263 | } 264 | 265 | 266 | # call the main script 267 | main 268 | -------------------------------------------------------------------------------- /tron_parse_incoming_metro_apps.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Purpose: Parses a list of user-submitted Metro apps against Tron's master lists 3 | Removes all lines that are already in the master list, then outputs new unique lines to a new file 4 | Requirements: Specify path to master list files, incoming file to check against, and output file 5 | Author: reddit.com/user/vocatus ( vocatus.gate@gmail.com ) // PGP key: 0x07d1490f82a211a2 6 | History: 1.0.2 * Finally get working parsing code 7 | 1.0.1 ! Fix egregious bugs in search syntax 8 | 1.0.0 Initial port from GUID dump parsing script 9 | Usage: Make sure paths are specified correctly (variables below) then run the script 10 | #> 11 | 12 | 13 | ############# 14 | # VARIABLES # -- Set these to your desired values or supply from the shell ---------------------- # 15 | ############# 16 | # Rules for variables: 17 | # * Quotes are required (e.g.: "c:\directory\path" ) 18 | # * NO trailing slashes on paths! (bad: "c:\directory\" ) 19 | # * Spaces are okay (okay: "c:\my folder\with spaces" ) 20 | # * Network paths are okay (okay: "\\server\share name" ) 21 | # ( "\\172.16.1.5\share name" ) 22 | param ( 23 | # Path to master 3rd party 24 | [string] $metro3rdPartyListFile = "R:\utilities\security\cleanup-repair\tron\tron\resources\stage_2_de-bloat\metro\metro_3rd_party_modern_apps_to_target_by_name.ps1", 25 | 26 | # Path to master Microsoft list 27 | [string] $metroMicrosoftListFile = "R:\utilities\security\cleanup-repair\tron\tron\resources\stage_2_de-bloat\metro\metro_Microsoft_modern_apps_to_target_by_name.ps1", 28 | 29 | # Path to Metro app whitelist file 30 | [string] $metroWhitelistFile = "R:\scripts\blackmesa\tron_metro_whitelist.txt", 31 | 32 | # Path to candidate (new) file 33 | [string] $candidateListFile = "$env:temp\tron_parse_incoming_metro_apps_candidateListFile.txt", 34 | 35 | # Path to directory containing incoming dump files 36 | [string] $incomingMetroDirectory = "r:\unsorted", 37 | 38 | # Path to output directory 39 | [string] $outputFile = "r:\unsorted\metro_parsed_dump.txt" 40 | 41 | ) 42 | 43 | 44 | 45 | 46 | 47 | # ----------------------------- Don't edit anything below this line ----------------------------- # 48 | 49 | 50 | 51 | 52 | ######## 53 | # PREP # 54 | ######## 55 | $SCRIPT_VERSION = "1.0.2" 56 | $SCRIPT_UPDATED = "2018-07-17" 57 | 58 | 59 | ############# 60 | # EXECUTION # 61 | ############# 62 | function main() { 63 | 64 | # pre-run cleanup in case there are leftovers from another run 65 | ri "$outputFile" -ea SilentlyContinue 66 | ri "$env:temp\tron_parse_incoming_metro_apps_working_file_1_duplicates_removed.txt" -ea silentlycontinue 67 | ri "$env:temp\tron_parse_incoming_metro_apps_candidateListFile.txt" -ea silentlycontinue 68 | ri "$env:temp\parse_incoming_metro_apps_working_file_2_microsoft_removed.txt" -ea silentlycontinue 69 | ri "$env:temp\tron_parse_incoming_metro_apps_temp1.txt" -ea silentlycontinue 70 | ri "$env:temp\tron_parse_incoming_metro_apps_temp2.txt" -ea silentlycontinue 71 | 72 | 73 | # Notify that we're starting 74 | log " Removing whitelisted and pre-existing Metro apps from candidate list..." white 75 | log " metro3rdparty: $metro3rdPartyListFile" darkgray 76 | log " metroMicrosoft: $metroMicrosoftListFile" darkgray 77 | log " whitelist: $metroWhitelistFile" darkgray 78 | log " output: $outputFile" darkgray 79 | 80 | 81 | # STAGE 0/3: Compile incoming lists into a master list and clean it for parsing 82 | dir $incomingMetroDirectory\* -include Metro_app_dump*.txt -rec | gc | out-file $env:temp\tron_parse_incoming_metro_apps_temp1.txt 83 | 84 | log " Compiled new candidate list. Now processing, please wait..." 85 | 86 | # Strip out lines containing "IdentifyingNumber" 87 | gc "$env:temp\tron_parse_incoming_metro_apps_temp1.txt" | Where-Object {$_ -notmatch 'Name'} | sc "$env:temp\tron_parse_incoming_metro_apps_temp2.txt" 88 | 89 | # Strip out lines containing "----" 90 | gc "$env:temp\tron_parse_incoming_metro_apps_temp2.txt" | Where-Object {$_ -notmatch '----'} | sc "$env:temp\tron_parse_incoming_metro_apps_temp3.txt" 91 | 92 | # Remove all whitespace 93 | (gc "$env:temp\tron_parse_incoming_metro_apps_temp3.txt").replace(' ', '') | sc "$env:temp\tron_parse_incoming_metro_apps_temp3.txt" 94 | 95 | # Sort remaining contents and remove duplicates 96 | gc "$env:temp\tron_parse_incoming_metro_apps_temp3.txt" | sort | get-unique > $candidateListFile 97 | 98 | # Notify how many duplicates were removed 99 | $raw = $(gc "$env:temp\tron_parse_incoming_metro_apps_temp1.txt" -total -1).count 100 | $parsed = $(gc "$candidateListFile" -total -1).count 101 | $duplicatesRemoved = $raw - $parsed 102 | if ( $duplicatesRemoved -gt 0 ) { 103 | log " Removed $duplicatesRemoved duplicate lines from candidate list" 104 | } else { 105 | log " No duplicate lines found" darkgray 106 | } 107 | 108 | 109 | 110 | 111 | # STAGE 1/3: Compare against 3rd party list 112 | $candidateListContents = gc $candidateListFile 113 | $metro3rdPartyListContents = gc $metro3rdPartyListFile 114 | foreach ( $line in $candidateListContents ) { 115 | $rowexists = $false 116 | foreach ( $row in $Metro3rdPartyListcontents ) { 117 | if ( $row -cmatch $line ) { $rowexists = $true } 118 | } 119 | 120 | if ( $rowexists -cmatch $false ) { 121 | echo $line | out-file "$env:temp\tron_parse_incoming_metro_apps_working_file_1_duplicates_removed.txt" -append -encoding default 122 | } 123 | } 124 | 125 | # Tell us how many items were removed 126 | $raw = $(gc "$candidateListFile" -total -1).count 127 | $parsed = $(gc "$env:temp\tron_parse_incoming_metro_apps_working_file_1_duplicates_removed.txt" -total -1).count 128 | $metro3rdPartyRemoved = $raw - $parsed 129 | if ( $metro3rdPartyRemoved -gt 0 ) { 130 | log " Matched $metro3rdPartyRemoved lines from 3rd Party list" 131 | } else { 132 | log " No matches against 3rd Party list" darkgray 133 | } 134 | 135 | 136 | 137 | 138 | # STAGE 2/3: Compare against Microsoft list 139 | $candidateListContents = gc $env:temp\tron_parse_incoming_metro_apps_working_file_1_duplicates_removed.txt 140 | $metroMicrosoftListContents = gc $metroMicrosoftListFile 141 | foreach ( $line in $candidateListContents ) { 142 | $rowexists = $false 143 | foreach ( $row in $metroMicrosoftListContents ) { 144 | if ( $row -cmatch $line ) { $rowexists = $true } 145 | } 146 | 147 | if ( $rowexists -eq $false ) { 148 | echo $line | out-file "$env:temp\parse_incoming_metro_apps_working_file_2_microsoft_removed.txt" -append -encoding default 149 | } 150 | } 151 | 152 | # Tell us how many items were removed 153 | $raw = $(gc "$env:temp\tron_parse_incoming_metro_apps_working_file_1_duplicates_removed.txt" -total -1).count 154 | $parsed = $(gc "$env:temp\parse_incoming_metro_apps_working_file_2_microsoft_removed.txt" -total -1).count 155 | $metroMicrosoftRemoved = $raw - $parsed 156 | if ( $metroMicrosoftRemoved -gt 0 ) { 157 | log " Matched $metroMicrosoftRemoved lines from Microsoft list" 158 | } else { 159 | log " No matches against Microsoft list" darkgray 160 | } 161 | 162 | 163 | 164 | 165 | # STAGE 3/3: Compare against whitelist 166 | $candidateListContents = gc $env:temp\parse_incoming_metro_apps_working_file_2_microsoft_removed.txt 167 | $whitelistMetroContents = gc $metroWhitelistFile 168 | foreach ( $line in $candidateListContents ) { 169 | $rowexists = $false 170 | foreach ( $row in $whitelistMetroContents ) { 171 | if ( $row -cmatch $line ) { $rowexists = $true } 172 | } 173 | if ( $rowexists -cmatch $false ) { echo $line | out-file "$outputFile" -append -encoding default } 174 | } 175 | 176 | # Tell us how many items were removed 177 | $raw = $(gc "$env:temp\parse_incoming_metro_apps_working_file_2_microsoft_removed.txt" -total -1).count 178 | $parsed = $(gc "$outputFile" -total -1).count 179 | $whitelistedRemoved = $raw - $parsed 180 | if ( $whitelistedRemoved -gt 0 ) { 181 | log " Matched $whitelistedRemoved lines from whitelist" 182 | } else { 183 | log " No matches against whitelist" darkgray 184 | } 185 | 186 | 187 | 188 | # Clean up after ourselves 189 | ri "$env:temp\tron_parse_incoming_metro_apps_working_file_1_duplicates_removed.txt" -ea silentlycontinue 190 | ri "$env:temp\parse_incoming_metro_apps_working_file_2_microsoft_removed.txt" -ea silentlycontinue 191 | ri "$env:temp\tron_parse_incoming_metro_apps_temp1.txt" -ea silentlycontinue 192 | ri "$env:temp\tron_parse_incoming_metro_apps_temp2.txt" -ea silentlycontinue 193 | ri "$env:temp\tron_parse_incoming_metro_apps_temp3.txt" -ea silentlycontinue 194 | ri "$incomingMetroDirectory\Metro_app_dump_*.txt" -ea silentlycontinue 195 | ri "$incomingMetroDirectory\tron*.log" -ea silentlycontinue 196 | 197 | # Currently I'm wiping screenshots since I don't care about them 198 | ri "$incomingMetroDirectory\tron_*.png" -ea silentlycontinue 199 | 200 | 201 | 202 | # Tally up and report 203 | $tally = $duplicatesRemoved + $metro3rdPartyRemoved + $whitelistedRemoved + $metroMicrosoftRemoved 204 | $remaining = (gc $outputFile -total -1).count 205 | if ( $tally -gt 0 ) { 206 | log " ------------------------------------------------------" 207 | log " $tally duplicate or pre-existing lines removed" 208 | log " $remaining lines remain for manual review" green 209 | } else { 210 | log " No candidate list entry matches" white 211 | } 212 | log " Done" darkgray 213 | 214 | 215 | pause 216 | } # /script 217 | 218 | 219 | 220 | 221 | 222 | ############# 223 | # FUNCTIONS # 224 | ############# 225 | function log($message, $color) 226 | { 227 | if ($color -eq $null) {$color = "gray"} 228 | write-host (get-date -f "yyyy-MM-dd hh:mm:ss") -n -f darkgray; write-host "$message" -f $color 229 | } 230 | 231 | 232 | # call the main script 233 | main 234 | -------------------------------------------------------------------------------- /unblock_downloaded_files.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Purpose: Recursively removes the "this file was downloaded from the Internet" flag from all files 3 | Requirements: Place script in the directory you want to start from 4 | Author: reddit.com/user/vocatus ( vocatus.gate@gmail.com ) // PGP key: 0x07d1490f82a211a2 5 | Version: 1.0.0 6 | #> 7 | 8 | 9 | 10 | ############# 11 | # VARIABLES # ---------------------- Set these to match your environment ------------------------ # 12 | ############# 13 | # Rules for variables: 14 | # * NO trailing slashes on paths! (bad: c:\directory\ ) 15 | # * Spaces are okay (okay: c:\my folder\with spaces ) 16 | # * Network paths are okay (okay: \\server\share name ) 17 | param ( 18 | # Logging information (currently unused, the unblock-file command doesn't output any text 19 | [string]$logpath = "c:\logs", 20 | [string]$logfile = "unblock_downloaded_files.log" 21 | ) 22 | 23 | 24 | 25 | 26 | 27 | 28 | # ----------------------------- Don't edit anything below this line ----------------------------- # 29 | 30 | 31 | 32 | 33 | 34 | 35 | ################### 36 | # PREP AND CHECKS # 37 | ################### 38 | $SCRIPT_VERSION = "1.0.0" 39 | $SCRIPT_UPDATED = "2024-05-28" 40 | $CUR_DATE=get-date -f "yyyy-MM-dd" 41 | 42 | 43 | 44 | 45 | ########### 46 | # EXECUTE # 47 | ########### 48 | dir "." -recurse | unblock-file 49 | -------------------------------------------------------------------------------- /wget v1.20.3 x86.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/wget v1.20.3 x86.exe -------------------------------------------------------------------------------- /wget v1.20.3.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bmrf/standalone_scripts/6a30e266cf75ea5354fa1aac78aaf4c0145dade0/wget v1.20.3.exe -------------------------------------------------------------------------------- /win8_remove_default_metro_apps.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Purpose: Removes built-in default Metro bloatware in Windows 8/8.1/Server 2012 and up 3 | Requirements: Administrator rights; Powershell scripts enabled 4 | Author: vocatus on reddit.com/r/sysadmin ( vocatus.gate@gmail.com ) // PGP key ID: 0x82A211A2 5 | History: 1.0.0 Initial write 6 | 7 | Usage: Run the script with admin rights 8 | #> 9 | 10 | ######## 11 | # Prep # 12 | ######## 13 | $SCRIPT_VERSION="1.0.0" 14 | $SCRIPT_UPDATED="2014-09-17" 15 | $CUR_DATE=get-date -f "yyyy-MM-dd" 16 | 17 | ############# 18 | # VARIABLES # -- Set these to your desired values 19 | ############# 20 | # no user-set variables for this script 21 | 22 | 23 | ############# 24 | # EXECUTION # 25 | ############# 26 | # Remove provisioned (in-image) packages 27 | Get-AppXProvisionedPackage -online | Remove-AppxProvisionedPackage -online 28 | 29 | # Remove "installed" packages 30 | Get-AppxPackage -AllUsers | Remove-AppxPackage 31 | --------------------------------------------------------------------------------