Skip to content
Snippets Groups Projects
Commit e1c29036 authored by Andreas Lindemark's avatar Andreas Lindemark
Browse files

Lots of changes and additions

parent 1cd63dab
No related branches found
No related tags found
No related merge requests found
Showing
with 122 additions and 29 deletions
...@@ -3,4 +3,5 @@ ...@@ -3,4 +3,5 @@
Code Snippets Code Snippets
Run these snippets on your own risk! 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
Set-ExecutionPolicy Unrestricted
\ No newline at end of file
# 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
# 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
# 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
DISM.exe /Online /Cleanup-image /Restorehealth DISM.exe /Online /Cleanup-image /Restorehealth
pause
\ No newline at end of file PAUSE
\ No newline at end of file
sc delete DiagTrack SC delete DiagTrack
echo "" > C:\ProgramData\Microsoft\Diagnosis\ETLLogs\AutoLogger\AutoLogger-Diagtrack-Listener.etl 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 REG add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v AllowTelemetry /t REG_DWORD /d 0 /f
sc delete dmwappushservice SC delete dmwappushservice
\ No newline at end of file \ No newline at end of file
: 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
CLS
Get-AppxPackage | Select Name, PackageFullName
\ No newline at end of file
Clear-Host
Get-AppxPackage | Select-Object Name, PackageFullName
\ No newline at end of file
# 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
CLS Clear-Host
$AppsList = $AppsList =
......
...@@ -8,22 +8,22 @@ GOTO :EOF ...@@ -8,22 +8,22 @@ GOTO :EOF
:32BIT :32BIT
:: Terminate any process of OneDrive and Uninstall OneDrive on 32-bit Windows 10 :: 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 %SystemRoot%\System32\OneDriveSetup.exe /uninstall
:64BIT :64BIT
:: Terminate any process of OneDrive and Uninstall OneDrive on 64-bit Windows 10 :: 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 %SystemRoot%\SysWOW64\OneDriveSetup.exe /uninstall
:: Turn off OneDrive everywhere completely via the Registry :: 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 REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\OneDrive" /v DisableFileSyncNGSC /t REG_DWORD /d 1 /f
:: Cleaning and Removing OneDrive Remnants :: Cleaning and Removing OneDrive Remnants
rd "%UserProfile%\OneDrive" /Q /S RD "%UserProfile%\OneDrive" /Q /S
rd "%LocalAppData%\Microsoft\OneDrive" /Q /S RD "%LocalAppData%\Microsoft\OneDrive" /Q /S
rd "%ProgramData%\Microsoft OneDrive" /Q /S RD "%ProgramData%\Microsoft OneDrive" /Q /S
rd "C:\OneDriveTemp" /Q /S RD "C:\OneDriveTemp" /Q /S
:: Delete and Remove OneDrive in File Explorer Folder Tree Registry Key :: Delete and Remove OneDrive in File Explorer Folder Tree Registry Key
REG DELETE "HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f REG DELETE "HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f
......
SFC /scannow SFC /scannow
pause
\ No newline at end of file PAUSE
\ No newline at end of file
:: Stop Services :: Stop Services
net stop bits NET stop bits
net stop cryptsvc NET stop cryptsvc
net stop wuauserv NET stop wuauserv
:: Delete Registry keys :: Delete Registry keys
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v AccountDomainSid /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 PingID /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientId /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 SusClientIDValidation /f
:: Delete Directories :: Delete Directories
rd /s /q "C:\WINDOWS\SoftwareDistribution" RD /s /q "C:\WINDOWS\SoftwareDistribution"
rd /s /q "C:\WINDOWS\System32\catroot2" RD /s /q "C:\WINDOWS\System32\catroot2"
:: Start Services :: Start Services
net start bits NET start bits
net start cryptsvc NET start cryptsvc
net start wuauserv NET start wuauserv
:: Force a detection event to the assinged WSUS server :: Force a detection event to the assinged WSUS server
wuauclt /resetauthorization /detectnow WUAUCLT /resetauthorization /detectnow
:: Force Windows Update to contact the WSUS server :: Force Windows Update to contact the WSUS server
PowerShell.exe (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow() PowerShell.exe (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
:: Report to WSUS (if there is something to report) :: Report to WSUS (if there is something to report)
wuauclt /reportnow WUAUCLT /reportnow
\ No newline at end of file \ No newline at end of file
:: Force a detection event to the assinged WSUS server :: Force a detection event to the assinged WSUS server
wuauclt /resetauthorization /detectnow WUAUCLT /resetauthorization /detectnow
:: Force Windows Update to contact the WSUS server :: Force Windows Update to contact the WSUS server
PowerShell.exe (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow() PowerShell.exe (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
:: Report to WSUS (if there is something to report) :: Report to WSUS (if there is something to report)
wuauclt /reportnow WUAUCLT /reportnow
\ No newline at end of file \ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment