This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Run this script as admin, auto-elevate if not ran as admin | |
Write-Host "[INFO] Elevating script to admin..." | |
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit } | |
Pause | |
Write-Host "[INFO] Start time:" -ForegroundColor Yellow | |
$StartTime = Get-Date | |
Write-Host $StartTime | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DISM /Online /Cleanup-Image /CheckHealth; DISM /Online /Cleanup-Image /ScanHealth; DISM /Online /Cleanup-Image /RestoreHealth; SFC /scannow; cleanmgr.exe; dfrgui; chkdsk /f /r c: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOGLOCATION="/var/log/example.log" | |
DATE=$(date) | |
MESSAGE="Your message here" | |
echo $DATE $MESSAGE >> $LOGLOCATION | |
echo "----------------------------" >> $LOGLOCATION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This script will automatically restart the docker containers held within | |
#It is customized to my docker configuration but can easily be modified to work with any other docker setup | |
echo "" >> /var/log/apt_updates.log | |
date >> /var/log/apt_updates.log | |
echo "-----APT UPDATES RAN-----" >> /var/log/apt_updates.log | |
echo "" | |
echo "-----UPDATE-----" | |
apt update | |
echo "" |