diff --git a/README.md b/README.md index 7593423532fea0f873dd2fd3ff00d5e6a53b8d21..3d4bbfdd4228cd0a2afabd725fbd2fbaf6f4b33d 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,5 @@ Code Snippets Run these snippets on your own risk! -It's your responsibility to understand what these snippets do. \ No newline at end of file + +It's your own responsibility to understand what these snippets do. \ No newline at end of file diff --git a/Windows/Activate_PowerShell_Scripts.ps1 b/Windows/Activate_PowerShell_Scripts.ps1 new file mode 100644 index 0000000000000000000000000000000000000000..4d10bbc4e11c367e5412c5df22d8691de80dc4cc --- /dev/null +++ b/Windows/Activate_PowerShell_Scripts.ps1 @@ -0,0 +1 @@ +Set-ExecutionPolicy Unrestricted \ No newline at end of file diff --git a/Windows/Choco_Check_Outdated_and_Upgrade.ps1 b/Windows/Choco_Check_Outdated_and_Upgrade.ps1 new file mode 100644 index 0000000000000000000000000000000000000000..f878d69cbf923855bfbf6865f0bee9c4375e7295 --- /dev/null +++ b/Windows/Choco_Check_Outdated_and_Upgrade.ps1 @@ -0,0 +1,8 @@ +# Chocolatey check which programs that is outdated and can be upgraded +choco outdated + +# Chocolatey dry-run upgrade all programs (dry run = no upgrade is done) +choco upgrade -y all --noop + +# Chocolatey upgrade all programs +choco upgrade -y all \ No newline at end of file diff --git a/Windows/Choco_Install_Chocolatey.ps1 b/Windows/Choco_Install_Chocolatey.ps1 new file mode 100644 index 0000000000000000000000000000000000000000..9626bdc4f2091ae948f75ce3d0c475c8fee2e80f --- /dev/null +++ b/Windows/Choco_Install_Chocolatey.ps1 @@ -0,0 +1,2 @@ +# Install Chocolatey +Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) \ No newline at end of file diff --git a/Windows/Choco_Install_Misc_Programs.ps1 b/Windows/Choco_Install_Misc_Programs.ps1 new file mode 100644 index 0000000000000000000000000000000000000000..d4dd9ccdc6804e8b69f1fa109f44ef45ab6302b6 --- /dev/null +++ b/Windows/Choco_Install_Misc_Programs.ps1 @@ -0,0 +1,33 @@ +# Install programs with the help from Chocolatey +# Enable/Disable what you what to install or not + +# Install 7zip +choco install -y 7zip.install + +# Install Adobe Reader +choco install -y adobereader + +# Install ShutUp10 +choco install -y shutup10 + +# Install Veeam Agent +choco install -y veeam-agent + +# Install VNC-connect +choco install -y vnc-connect + +# Install VNC-connect +choco install -y vnc-viewer + +# Install the Zabbix Agent via Chocolatey +choco Install -y zabbix-agent --force + +# Configure the Zabbix Agent service +Set-Service -Name "Zabbix Agent" -StartupType Automatic +SC.exe failure "Zabbix Agent" actions= restart/60000/restart/60000/restart/60000 reset= 0 + +# Start the Zabbix Agent service if it's not running +Start-Service -Name "Zabbix Agent" + +# Check the Zabbix Agent service status +Get-Service "Zabbix Agent" | Select-Object -Property Name, StartType, Status \ No newline at end of file diff --git a/Windows/DISM_online_cleanup-image_restorehealth.cmd b/Windows/DISM_online_cleanup-image_restorehealth.cmd index 201a5e8cd9dfb6883cb6eb28bca8a8a89b7ebac2..6b80ebf58c7b8928868ac4cbf448dab1e657a891 100644 --- a/Windows/DISM_online_cleanup-image_restorehealth.cmd +++ b/Windows/DISM_online_cleanup-image_restorehealth.cmd @@ -1,2 +1,3 @@ DISM.exe /Online /Cleanup-image /Restorehealth -pause \ No newline at end of file + +PAUSE \ No newline at end of file diff --git a/Windows/Disable Telemetry and Data Collection.cmd b/Windows/Disable Telemetry and Data Collection.cmd deleted file mode 100644 index b6b9c37e4db2ee48dd1600dac8cebdc4bdaa7eef..0000000000000000000000000000000000000000 --- a/Windows/Disable Telemetry and Data Collection.cmd +++ /dev/null @@ -1,4 +0,0 @@ -sc delete DiagTrack -echo "" > C:\ProgramData\Microsoft\Diagnosis\ETLLogs\AutoLogger\AutoLogger-Diagtrack-Listener.etl -reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v AllowTelemetry /t REG_DWORD /d 0 /f -sc delete dmwappushservice \ No newline at end of file diff --git a/Windows/Disable_Telemetry_and_Data_Collection.cmd b/Windows/Disable_Telemetry_and_Data_Collection.cmd new file mode 100644 index 0000000000000000000000000000000000000000..24c01dc7bdeb81a8079e30be79e5e27dd349be3d --- /dev/null +++ b/Windows/Disable_Telemetry_and_Data_Collection.cmd @@ -0,0 +1,4 @@ +SC delete DiagTrack +ECHO "" > C:\ProgramData\Microsoft\Diagnosis\ETLLogs\AutoLogger\AutoLogger-Diagtrack-Listener.etl +REG add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v AllowTelemetry /t REG_DWORD /d 0 /f +SC delete dmwappushservice \ No newline at end of file diff --git a/Windows/Install_dotNET_FrameWork_3.5.cmd b/Windows/Install_dotNET_FrameWork_3.5.cmd new file mode 100644 index 0000000000000000000000000000000000000000..d9b8668c96bc66bfb498664ea3656c1f58c3205e --- /dev/null +++ b/Windows/Install_dotNET_FrameWork_3.5.cmd @@ -0,0 +1,22 @@ +: Specify path to \sources\sxs (for the right version of Windows 10) +SET PATH="%1" + +: Check that \sources\sxs exist +IF NOT EXIST %PATH% GOTO :FAILED + +: Check that \sources\sxs\*netfx3* and \sources\sxs\*NetFx3* exist +IF NOT EXIST %PATH%\*netfx3* GOTO :FAILED +IF NOT EXIST %PATH%\*NetFx3* GOTO :FAILED + +: Install .NET Framework 3.5 (incl. 2.0 and 3.0) +DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:%PATH% +GOTO :END + +:FAILED +ECHO Something went wrong! +EXIT /B 99 + +:END +EXIT /B 0 + +:EOF \ No newline at end of file diff --git a/Windows/List Microsoft Apps & Bloatware.ps1 b/Windows/List Microsoft Apps & Bloatware.ps1 deleted file mode 100644 index f735c82f8e1e729683e8bd739dac3581c9fd2588..0000000000000000000000000000000000000000 --- a/Windows/List Microsoft Apps & Bloatware.ps1 +++ /dev/null @@ -1,3 +0,0 @@ -CLS - -Get-AppxPackage | Select Name, PackageFullName \ No newline at end of file diff --git a/Windows/List_Microsoft_Apps_and_Bloatware.ps1 b/Windows/List_Microsoft_Apps_and_Bloatware.ps1 new file mode 100644 index 0000000000000000000000000000000000000000..d9cdd64e4a3ad517df878eda55196c73fd068d8d --- /dev/null +++ b/Windows/List_Microsoft_Apps_and_Bloatware.ps1 @@ -0,0 +1,3 @@ +Clear-Host + +Get-AppxPackage | Select-Object Name, PackageFullName \ No newline at end of file diff --git a/Windows/OS-info_Windows10.ps1 b/Windows/OS-info_Windows10.ps1 new file mode 100644 index 0000000000000000000000000000000000000000..16f819b70158f215b4766637b03b2827dbbe72fe --- /dev/null +++ b/Windows/OS-info_Windows10.ps1 @@ -0,0 +1,20 @@ +# Windows 10 procuct lifecycle info, comes from these Microsoft support pages... +# https://support.microsoft.com/en-us/help/13853/windows-lifecycle-fact-sheet +# https://support.microsoft.com/en-us/lifecycle/search/ + +$Computer = "localhost" +$os = Get-WmiObject -class Win32_OperatingSystem -ComputerName $Computer | Select-Object Caption,Version +switch($os.Version){ +'10.0.10240'{$update="1507"; $supported_until="2017-05-09"} +'10.0.10586'{$update="1511"; $supported_until="2017-10-10"} +'10.0.14393'{$update="1607"; $supported_until="2019-04-09"} +'10.0.15063'{$update="1703"; $supported_until="2019-10-08"} +'10.0.16299'{$update="1709"; $supported_until="2020-04-14"} +'10.0.17134'{$update="1803"; $supported_until="2020-11-10"} +'10.0.17763'{$update="1809"; $supported_until="2021-05-11"} +'10.0.18362'{$update="1903"; $supported_until="2020-12-08"} +'10.0.18363'{$update="1909"; $supported_until="2022-05-10"} +} +Write-Output "$($os.Caption) $update" +Write-Output "$($os.Version)" +Write-Output "$supported_until" \ No newline at end of file diff --git a/Windows/Remove Microsoft Bloatware.ps1 b/Windows/Remove_Microsoft_Apps_and_Bloatware.ps1 similarity index 99% rename from Windows/Remove Microsoft Bloatware.ps1 rename to Windows/Remove_Microsoft_Apps_and_Bloatware.ps1 index f07363afdd3503091f924f7e01839e305f0637d9..df24fa1811d0b116b62db97fdeb51a8b4f906416 100644 --- a/Windows/Remove Microsoft Bloatware.ps1 +++ b/Windows/Remove_Microsoft_Apps_and_Bloatware.ps1 @@ -1,4 +1,4 @@ -CLS +Clear-Host $AppsList = diff --git a/Windows/Remove Microsoft OneDrive.cmd b/Windows/Remove_Microsoft_OneDrive.cmd similarity index 82% rename from Windows/Remove Microsoft OneDrive.cmd rename to Windows/Remove_Microsoft_OneDrive.cmd index c6974b37a048a7ca9fe99838473232ebd9de1ae7..80ac6f09b64d05ca960300e81b6cac4575c04d77 100644 --- a/Windows/Remove Microsoft OneDrive.cmd +++ b/Windows/Remove_Microsoft_OneDrive.cmd @@ -8,22 +8,22 @@ GOTO :EOF :32BIT :: Terminate any process of OneDrive and Uninstall OneDrive on 32-bit Windows 10 -taskkill /f /im OneDrive.exe +TASKKILL /f /im OneDrive.exe %SystemRoot%\System32\OneDriveSetup.exe /uninstall :64BIT :: Terminate any process of OneDrive and Uninstall OneDrive on 64-bit Windows 10 -taskkill /f /im OneDrive.exe +TASKKILL /f /im OneDrive.exe %SystemRoot%\SysWOW64\OneDriveSetup.exe /uninstall :: Turn off OneDrive everywhere completely via the Registry REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\OneDrive" /v DisableFileSyncNGSC /t REG_DWORD /d 1 /f :: Cleaning and Removing OneDrive Remnants -rd "%UserProfile%\OneDrive" /Q /S -rd "%LocalAppData%\Microsoft\OneDrive" /Q /S -rd "%ProgramData%\Microsoft OneDrive" /Q /S -rd "C:\OneDriveTemp" /Q /S +RD "%UserProfile%\OneDrive" /Q /S +RD "%LocalAppData%\Microsoft\OneDrive" /Q /S +RD "%ProgramData%\Microsoft OneDrive" /Q /S +RD "C:\OneDriveTemp" /Q /S :: Delete and Remove OneDrive in File Explorer Folder Tree Registry Key REG DELETE "HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f diff --git a/Windows/SFC_scannow.cmd b/Windows/SFC_scannow.cmd index 3d0a0c9bbb632a555052c3d2d5e83dd5f9a54ba2..a24c6979bb9b5f4b6eb4a3d0ce28b2a9d1fa9809 100644 --- a/Windows/SFC_scannow.cmd +++ b/Windows/SFC_scannow.cmd @@ -1,2 +1,3 @@ SFC /scannow -pause \ No newline at end of file + +PAUSE \ No newline at end of file diff --git a/Windows/WSUS_fix.cmd b/Windows/WSUS_fix.cmd index 2e13c9c09a1a18a2ddf3c23238b0eb0177dc28f1..e0e4bbd512460707e8fe7981d6f3d3e297cb8c01 100644 --- a/Windows/WSUS_fix.cmd +++ b/Windows/WSUS_fix.cmd @@ -1,28 +1,28 @@ :: Stop Services -net stop bits -net stop cryptsvc -net stop wuauserv +NET stop bits +NET stop cryptsvc +NET stop wuauserv :: Delete Registry keys -reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v AccountDomainSid /f -reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v PingID /f -reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientId /f -reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientIDValidation /f +REG delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v AccountDomainSid /f +REG delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v PingID /f +REG delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientId /f +REG delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientIDValidation /f :: Delete Directories -rd /s /q "C:\WINDOWS\SoftwareDistribution" -rd /s /q "C:\WINDOWS\System32\catroot2" +RD /s /q "C:\WINDOWS\SoftwareDistribution" +RD /s /q "C:\WINDOWS\System32\catroot2" :: Start Services -net start bits -net start cryptsvc -net start wuauserv +NET start bits +NET start cryptsvc +NET start wuauserv :: Force a detection event to the assinged WSUS server -wuauclt /resetauthorization /detectnow +WUAUCLT /resetauthorization /detectnow :: Force Windows Update to contact the WSUS server PowerShell.exe (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow() :: Report to WSUS (if there is something to report) -wuauclt /reportnow \ No newline at end of file +WUAUCLT /reportnow \ No newline at end of file diff --git a/Windows/WSUS_run.cmd b/Windows/WSUS_run.cmd index e32f65ab760803b8dc982ad1ff08254239f5cf19..dfa4b8de93f31fb70fd526be4bdfbaedba17c909 100644 --- a/Windows/WSUS_run.cmd +++ b/Windows/WSUS_run.cmd @@ -1,8 +1,8 @@ :: Force a detection event to the assinged WSUS server -wuauclt /resetauthorization /detectnow +WUAUCLT /resetauthorization /detectnow :: Force Windows Update to contact the WSUS server PowerShell.exe (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow() :: Report to WSUS (if there is something to report) -wuauclt /reportnow \ No newline at end of file +WUAUCLT /reportnow \ No newline at end of file