New
#50
@Paul Black
Thank you very much
@Paul Black
Thank you very much
@DMD, I just looked at the first part of your code. The following (simplified version) is my suggestion:
Just double-click to run it. When it asks "Do you want to start? (Y/N):", press a key that is NOT (Y/N), and you will hear a beep.Code:@echo off (Net session >nul 2>&1)||(PowerShell start """%~0""" -verb RunAs & Exit /B) Color 2f :: ---------------- Detect Windows version ---------------------- For /f "tokens=2 delims==" %%# in ('"wmic path Win32_OperatingSystem get Version /value"') Do ( Set Build=%%#) echo ================================================ echo. echo Clear Windows Update history echo for Windows %Build% echo Restore Windows Update Components echo. echo ================================================ echo. echo. echo Do you want to start? (Y/N): CHOICE /C "YN" /M "Your choice?:" >nul 2>&1 if %errorlevel%==2 (Exit) :avvio cls :: ---------------- Decision dependent on the version of Windows ----------------------
I will look at the rest tomorrow.
@Matthew Wai
Thanks for your interest.
The above code was added by Brink at my suggestion: Reset Windows Update in Windows 10
However, this code is redundant and can be deleted if you use my suggestion in post #54 above.
PassThru option, Write-Host Success message and pause are optional.Code:if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:: GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) { Start-Process PowerShell "-File ""$PSCommandPath""" -Verb RunAs exit } Stop-Service "UsoSvc","wuauserv" -PassThru Remove-Item "C:\Windows\SoftwareDistribution\DataStore\Logs\edb.log" Remove-Item "C:\ProgramData\USOPrivate\UpdateStore\*.*" if ($Error.Count -eq 0) { Write-Host "`n`nSUCCESS: Windows Update History was cleared.`n" } Start-Service "UsoSvc","wuauserv" -PassThru | Out-Host UsoClient.exe RefreshSettings pause
Hello @Matthew Wai,
A couple of quick questions please.
I use your Script to control WU's.
However, I have.etl
files in BOTH of the following folders . . .
C:\ProgramData\USOShared\Logs\System
C:\ProgramData\USOShared\Logs\User
- If I was to run EITHER of the Scripts in Post #1 [ attached below ], would that interfere with your Script to control WU's as it uses
net start wuauserv
?
Code:PowerShell -WindowStyle Hidden -Command "Start-Process cmd -ArgumentList '/s, /c, net stop wuauserv & del %SystemRoot%\SoftwareDistribution\DataStore\Logs\edb.log & net start wuauserv' -Verb RunAs"
Code:PowerShell -WindowStyle Hidden -Command "Start-Process cmd -ArgumentList '/s, /c, net stop usosvc & net stop wuauserv & del %SystemRoot%\SoftwareDistribution\DataStore\Logs\edb.log & del /f /q C:\ProgramData\USOPrivate\UpdateStore\* & net start usosvc & net start wuauserv & UsoClient.exe RefreshSettings' -Verb RunAs"
- To your knowledge, can ALL the files in the TWO
USOShared\Logs
folders be SAFELYDeleted
?
Thank you.
No interference. None of my scripts touches "wuauserv", which has never been disabled on my Windows 10. In fact, "Check_for_updates.vbs" and "WDD_Updates.vbs" use "wuauserv" every day.
So do I. The files do not seem to have interfered with my scripts.
I am not knowledgeable enough to answer the question. I have never touched the files.