Если служба обновлений Windows работает не корректно, обновления не загружаются или не устанавливаются, то самый простой и эффективней способ решить проблему со службой Windows Update – восстановить ее исходные настройки. В этой статье мы покажем, как сбросить конфигурацию агента и службы обновлений Windows Update.
Содержание:
- Средство устранения неполадок Центра обновления Windows
- Сброс настроек Windows Update с помощью PowerShell
- Утилита Reset Windows Update Tool
- Восстановление исходных настроек Windows Update из командной строки
Обычно для отладки и дебага ошибок службы обновления Windows администратору необходимо проанализировать коды ошибок в файле журнала обновлений %windir%\WindowsUpdate.log (в Windows 10 и 11 получить файл WindowsUpdate.log можно таким способом). Количество возможных ошибок, с которыми может столкнуться администратор при анализе журнала обновлений исчисляется десятками (список всех ошибок Windows Update) и процесс их разрешения в основном нетривиальный. В некоторых случаях вместо детального анализа ошибок Windows Update гораздо быстрее и проще сначала произвести полный сброс настроек службы Windows Update. После сброса Windows Update вы можете выполнить сканирование и поиск обновлений.
Средство устранения неполадок Центра обновления Windows
Прежде чем перейти к сбросу конфигурации центра обновления Windows, настоятельно рекомендуем сначала попробовать более встроенное средство для автоматического исправления проблем в службе обновления Windows – средство устранения неполадок Центра обновления Windows (Windows Update Troubleshooter).
В Windows 10 и 11 Windows Update Troubleshooter уже встроен в современную панель Settings. Для предыдущих версий Windows его придется скачать вручную по ссылкам ниже:
- Windows 11 — Settings -> System -> Troubleshooter -> Other Troubleshooter -> Windows Update;
- Windows 10 – скачите wu10.diagcab по ссылке https://aka.ms/wudiag , либо запустите локальную версию инструмента: Пуск -> Параметры -> Обновления и безопасность -> Устранение неполадок -> Центр обновлений Windows (Start -> Settings -> Updates and Security -> Troubleshoot -> Additional Troubleshooters-> Windows Updates – resolve problems that prevent you from updating windows);
Для быстрого доступа к средствам исправления неполадок Windows можно использовать команду ms-settings:
ms-settings:troubleshoot
- Windows 7 и Windows 8.1 — WindowsUpdate.diagcab (https://aka.ms/diag_wu).
Дождитесь пока средство устранения неполадок Центра обновления Windows просканирует систему и попытается автоматически исправить все ошибки в службе Windows Update и связанных компонентах.
В моем случае была обнаружена и исправлена потенциальная ошибка в базе данных Центра обновления Windows. После этого перезагрузите компьютер и попробуйте выполнить поиск обновлений. Если обновления не загружаются или не устанавливаются, перейдите к следующему этапу.
Сброс настроек Windows Update с помощью PowerShell
Вы можете использовать PowerShell модуль PSWindowsUpdate для сброса настроек агента и службы Windows Update.
Установите модуль на свой компьютер из галереи скриптов PSGallery:
Install-Module -Name PSWindowsUpdate
Разрешите запуск PowerShell скриптов:
Set-ExecutionPolicy –ExecutionPolicy RemoteSigned -force
Выполните команду:
Reset-WUComponents –verbose
Команда Reset-WUComponents выполняет действия, по остановке служб, перерегистрации dll и очистке каталога C:\Windows\SoftwareDistribution, что и описанный чуть ниже bat скрипт.
VERBOSE: Background Intelligent Transfer Service (BITS) VERBOSE: Windows Update (wuauserv) VERBOSE: Application Identity (appidsvc) VERBOSE: Cryptographic Services (cryptsvc) Step 2: Delete the qmgr*.dat files Step 3: Backup software distribution folders VERBOSE: Renaming Software Distribution folder to C:\Windows\SoftwareDistribution.bak VERBOSE: Renaming CatRoot folder to C:\Windows\System32\Catroot2.bak Step 4: Remove old Windows Update logs VERBOSE: Deleting the C:\Windows\WindowsUpdate.log files. Step 5: Reset Windows Update services VERBOSE: Reset BITS service VERBOSE: Reset Windows Update service Step 6: Reregister dll's VERBOSE: regsvr32.exe / s atl.dll VERBOSE: regsvr32.exe / s urlmon.dll VERBOSE: regsvr32.exe / s mshtml.dll VERBOSE: regsvr32.exe / s shdocvw.dll VERBOSE: regsvr32.exe / s browseui.dll VERBOSE: regsvr32.exe / s jscript.dll VERBOSE: regsvr32.exe / s vbscript.dll VERBOSE: regsvr32.exe / s scrrun.dll VERBOSE: regsvr32.exe / s msxml.dll VERBOSE: regsvr32.exe / s msxml3.dll VERBOSE: regsvr32.exe / s msxml6.dll VERBOSE: regsvr32.exe / s actxprxy.dll VERBOSE: regsvr32.exe / s softpub.dll VERBOSE: regsvr32.exe / s wintrust.dll VERBOSE: regsvr32.exe / s dssenh.dll VERBOSE: regsvr32.exe / s rsaenh.dll VERBOSE: regsvr32.exe / s gpkcsp.dll VERBOSE: regsvr32.exe / s sccbase.dll VERBOSE: regsvr32.exe / s slbcsp.dll VERBOSE: regsvr32.exe / s cryptdlg.dll VERBOSE: regsvr32.exe / s oleaut32.dll VERBOSE: regsvr32.exe / s ole32.dll VERBOSE: regsvr32.exe / s shell32.dll VERBOSE: regsvr32.exe / s initpki.dll VERBOSE: regsvr32.exe / s wuapi.dll VERBOSE: regsvr32.exe / s wuaueng.dll VERBOSE: regsvr32.exe / s wuaueng1.dll VERBOSE: regsvr32.exe / s wucltui.dll VERBOSE: regsvr32.exe / s wups.dll VERBOSE: regsvr32.exe / s wups2.dll VERBOSE: regsvr32.exe / s wuweb.dll VERBOSE: regsvr32.exe / s qmgr.dll VERBOSE: regsvr32.exe / s qmgrprxy.dll VERBOSE: regsvr32.exe / s wucltux.dll VERBOSE: regsvr32.exe / s muweb.dll VERBOSE: regsvr32.exe / s wuwebv.dll Step 7: Reset WinSock VERBOSE: netsh winsock reset Step 8: Reset Proxy VERBOSE: netsh winhttp reset proxy Step 9: Start Windows Update services VERBOSE: Cryptographic Services (cryptsvc) VERBOSE: Application Identity (appidsvc) VERBOSE: Windows Update (wuauserv) VERBOSE: Background Intelligent Transfer Service (BITS) Step 10: Start Windows Update services VERBOSE: wuauclt /resetauthorization /detectnow
Запустите поиск обновлений из панели управления или выполните поиск доступных обновлений с помощью команды PowerShell:
Get-WUList
Утилита Reset Windows Update Tool
Есть еще одни полезный и простой инструмент для сброса настроек Windows Update — Reset Windows Update Tool. Раньше это скрипт был доступен на TechNet. Сейчас автор ведет репозиторий на GitHub (м https://github.com/ManuelGil/Script-Reset-Windows-Update-Tool ).
Для загрузки предлагается скомпилированный exe файл (C++) или обычный скрипт. Я предпочитаю использовать cmd скрипт.
- Скачайте ResetWUEng.zip и распакуйте на диск;
- Запустите файл ResetWUEng.cmd с правами администратора;
- Скрипт определит вашу версию ОС (в моем примере это Windows 10) и предложит 18 различных опций. Некоторые из них напрямую не относятся к сбросу настроек агента WU, но могут быть полезны для исправления различных неисправностей в Windows (проверка диска chkdsk, исправление ошибок в образе Windows с помощью DISM, сброс Winsock, очистка временных файлов и т.д.);
- Для сброса настроек Windows Update достаточно использовать опцию 2 — Resets the Windows Update Components (Сбросить компоненты службы обновления Windows). Нажмите 2 и Enter;
- Скрипт автоматически выполнит все действия, которые мы описали выше при выполнении ручного сброса агента обновлений Windows из командной строки.
Вы можете самостоятельно посмотреть, что делает скрипт, открыв в файл ResetWUEng.cmd в любом текстовом редакторе и изучив его содержимое. Например, опция 2 отправляет на процедуру components.
- После окончания работы скрипта Reset Windows Update Agent перезагрузите компьютер и проверьте работу службы обновлений.
Скрипт ResetWUEng.cmd универсальный и подходит для всех версий Windows: начиная с Windows XP и вплоть до Windows 11.
Восстановление исходных настроек Windows Update из командной строки
Процесс сброса настроек агента и службы обновления Windows состоит из нескольких этапов. Все описанные операции выполняются в командной строке и собраны в один bat файл (готовый скрипт можно скачать по ссылке ниже).
С помощью данного скрипта можно полностью сбросить конфигурацию службы Центра обновлений Windows, и очистить локальный кэш обновлений. Скрипт является универсальный и будет работать как в Windows 11/10/8.1/7, так и в Windows Server 2022/2019/2016/2012 R2/2008 R2. Скрипт помогает устранить большинство типовых ошибок в работе службы Windows Update, когда центр обновлений перестает загружать новые обновления или пишет, что при установке обновления возникают ошибки.
Убедитесь, что настройки Windows Update на вашем компьютере на задаются с помощью доменных или локальных политик. Для вывода результирующих настроек GPO можно воспользоваться утилитой gpresult или rsop.msc. Можно сбросить настройки локальной GPO по этой инструкции.
Итак, по порядку о том, что делает скрипт:
- Остановить службы Windows Update (Центр обновлений Windows), BITS и службы криптографии:
net stop bits
net stop wuauserv
net stop appidsvc
net stop cryptsvc
taskkill /im wuauclt.exe /f - Удалить служебных файлы qmgr*.dat в каталоге %ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\:
Del "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat"
- Переименовать служебные каталоги, в которых хранятся конфигурационные файлы и кэш обновлений (в случае необходимости их можно будет использовать как резервные копии). После перезапуска службы обновления, эти каталоги автоматически пересоздадутся:
Ren %systemroot%\SoftwareDistribution SoftwareDistribution.bak
Ren %systemroot%\system32\catroot2 catroot2.bak - Удаление старого журнала windowsupdate.log
del /f /s /q %windir%\windowsupdate.log
- Сброс разрешений на службы BITS и Windows Update (в случае, если права на службы были изменены)
sc.exe sdset bits D:(A;;CCLCSWRPWPDTLOCRRC;;;SY) (A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA) (A;;CCLCSWLOCRRC;;;AU) (A;;CCLCSWRPWPDTLOCRRC;;;PU)
sc.exe sdset wuauserv D:(A;;CCLCSWRPWPDTLOCRRC;;;SY) (A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA) (A;;CCLCSWLOCRRC;;;AU) (A;;CCLCSWRPWPDTLOCRRC;;;PU)
sc.exe sdset cryptsvc D:(A;;CCLCSWLOCRRC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLCRSDRCWDWO;;;SO)(A;;CCLCSWRPWPDTLOCRRC;;;SY)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;WD)
sc.exe sdset trustedinstaller D:(A;;CCLCSWLOCRRC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLCRSDRCWDWO;;;SO)(A;;CCLCSWRPWPDTLOCRRC;;;SY)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;WD) - Перерегистрация файлов системных динамических библиотек (dll), связанных со службами BITS и Windows Update:
cd /d %windir%\system32
regsvr32.exe /s atl.dll
regsvr32.exe /s urlmon.dll
regsvr32.exe /s mshtml.dll
regsvr32.exe /s shdocvw.dll
regsvr32.exe /s browseui.dll
regsvr32.exe /s jscript.dll
regsvr32.exe /s vbscript.dll
regsvr32.exe /s scrrun.dll
regsvr32.exe /s msxml.dll
regsvr32.exe /s msxml3.dll
regsvr32.exe /s msxml6.dll
regsvr32.exe /s actxprxy.dll
regsvr32.exe /s softpub.dll
regsvr32.exe /s wintrust.dll
regsvr32.exe /s dssenh.dll
regsvr32.exe /s rsaenh.dll
regsvr32.exe /s gpkcsp.dll
regsvr32.exe /s sccbase.dll
regsvr32.exe /s slbcsp.dll
regsvr32.exe /s cryptdlg.dll
regsvr32.exe /s oleaut32.dll
regsvr32.exe /s ole32.dll
regsvr32.exe /s shell32.dll
regsvr32.exe /s initpki.dll
regsvr32.exe /s wuapi.dll
regsvr32.exe /s wuaueng.dll
regsvr32.exe /s wuaueng1.dll
regsvr32.exe /s wucltui.dll
regsvr32.exe /s wups.dll
regsvr32.exe /s wups2.dll
regsvr32.exe /s wuweb.dll
regsvr32.exe /s qmgr.dll
regsvr32.exe /s qmgrprxy.dll
regsvr32.exe /s wucltux.dll
regsvr32.exe /s muweb.dll
regsvr32.exe /s wuwebv.dll - Сброс параметров Winsock
netsh winsock reset
- Сброс параметров системного прокси
netsh winhttp reset proxy
- Опционально. При использовании локального сервера WSUS, возможно дополнительно сбросить текущую привязку клиента к серверу WSUS путем удаления следующих параметров в ветке реестра HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate:
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\Policies\Microsoft\Windows\WindowsUpdate" /v TargetGroup /f
REG DELETE "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v WUServer /f
REG DELETE "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v WUStatusServer /f - Запуск остановленных служб:
sc.exe config wuauserv start= auto
sc.exe config bits start= delayed-auto
sc.exe config cryptsvc start= auto
sc.exe config TrustedInstaller start= demand
sc.exe config DcomLaunch start= auto
net start bits
net start wuauserv
net start appidsvc
net start cryptsvc - Опционально. Для Windows 7 и 8.1 можно установить/переустановить последнюю версию агента Windows Update Agent (WUA). Скачать актуальную версию агента можно со страницы https://support.microsoft.com/en-us/kb/949104. Нужно скачать файл для вашей версии Windows
Актуальная версия агента WUA для Windows 7 SP1 x64 — 7.6. Принудительная переустановка агента WindowsUpdate выполняется следующими командами:
- для Windows 7 x86:
WindowsUpdateAgent-7.6-x86.exe /quiet /norestart /wuforce
- для Windows 7 x64:
WindowsUpdateAgent-7.6-x64.exe /quiet /norestart /wuforce
Совет. Текущую версию агента Windows Update Agent (WUA) в Windows 7 можно узнать в свойствах файла %windir%\system32\Wuaueng.dll. В нашем примере это 7.6.7600.256.
- для Windows 7 x86:
Осталось перезагрузить компьютер и запустить синхронизацию с сервером Windows Update /WSUS.
wuauclt /resetauthorization /detectnow
Затем зайдите в Центр обновления и проверьте, пропали ли проблемы при поиске, скачивании и установке обновлений.
Сам скрипт reset_win_update.bat можно скачать по ссылке reset_win_update.zip (пункты 9 и 11 в скрипте не выполняются, т.к. являются опциональными). Скрипт нужно скачать, распаковать и запустить с правами администратора.
После этого перезагрузите компьютер, затем зайдите в Центр обновлений и проверьте, пропали ли проблемы при поиске, скачивании и установке обновлений.
Если обновления Windows стали скачиваться и устанавливать корректно, можно удалить папки резервные копии папок:
Ren %systemroot%\SoftwareDistribution SoftwareDistribution.bak
Ren %systemroot%\system32\catroot2 catroot2.bak
Если ничего не помогло, попробуйте вручную скачать и установить последнее кумулятивное обновление для вашей версии Windows из каталога обновлений Microsoft Update Catalog.
This script will completely reset the Windows Update client settings. It has been tested on Windows 7, 8, 10, and Server 2008 R2, 2012 R2, 2016. It will configure the services and registry keys related to Windows Update for default settings. It will also clean up files related to Windows Update.
This worklet can either be run manually, or you can put in an evaluation code of:
Exit 1
if you want to always run the worklet on a set schedule.
<#
.SYNOPSIS
Resets the Windows Update components
.DESCRIPTION
This script will reset all of the Windows Updates components to DEFAULT SETTINGS, clean-up some files related to Windows Update, and notify the user that a reboot will occur in 15 minutes (which can be modified) giving them a second warning at 5 minutes.
.OUTPUTS
Results are output to the Activity Log.
#>
$arch = Get-WMIObject -Class Win32_Processor -ComputerName LocalHost | Select-Object AddressWidth
Write-Host "1. Stopping Windows Update Services..."
Stop-Service -Name BITS
Stop-Service -Name wuauserv
Stop-Service -Name appidsvc
Stop-Service -Name cryptsvc
Write-Host "2. Remove QMGR Data file..."
Remove-Item "$env:allusersprofile\Microsoft\Network\Downloader\qmgr*.dat" -ErrorAction SilentlyContinue
Write-Host "3. Renaming the Software Distribution and CatRoot Folder..."
Remove-Item $env:systemroot\SoftwareDistribution.bak -ErrorAction SilentlyContinue
Rename-Item $env:systemroot\SoftwareDistribution SoftwareDistribution.bak -ErrorAction SilentlyContinue
# This may not work if the folder is locked by having a contained file being accessed
Remove-Item $env:systemroot\System32\Catroot2.bak -ErrorAction SilentlyContinue
Rename-Item $env:systemroot\System32\Catroot2 catroot2.bak -ErrorAction SilentlyContinue
Write-Host "4. Removing old Windows Update log..."
Remove-Item $env:systemroot\WindowsUpdate.log -ErrorAction SilentlyContinue
Write-Host "5. Resetting the Windows Update Services to default settings..."
"sc.exe sdset bits D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)"
"sc.exe sdset wuauserv D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)"
Set-Location $env:systemroot\system32
Write-Host "6. Registering some DLLs..."
regsvr32.exe /s atl.dll
regsvr32.exe /s urlmon.dll
regsvr32.exe /s mshtml.dll
regsvr32.exe /s shdocvw.dll
regsvr32.exe /s browseui.dll
regsvr32.exe /s jscript.dll
regsvr32.exe /s vbscript.dll
regsvr32.exe /s scrrun.dll
regsvr32.exe /s msxml.dll
regsvr32.exe /s msxml3.dll
regsvr32.exe /s msxml6.dll
regsvr32.exe /s actxprxy.dll
regsvr32.exe /s softpub.dll
regsvr32.exe /s wintrust.dll
regsvr32.exe /s dssenh.dll
regsvr32.exe /s rsaenh.dll
regsvr32.exe /s gpkcsp.dll
regsvr32.exe /s sccbase.dll
regsvr32.exe /s slbcsp.dll
regsvr32.exe /s cryptdlg.dll
regsvr32.exe /s oleaut32.dll
regsvr32.exe /s ole32.dll
regsvr32.exe /s shell32.dll
regsvr32.exe /s initpki.dll
regsvr32.exe /s wuapi.dll
regsvr32.exe /s wuaueng.dll
regsvr32.exe /s wuaueng1.dll
regsvr32.exe /s wucltui.dll
regsvr32.exe /s wups.dll
regsvr32.exe /s wups2.dll
regsvr32.exe /s wuweb.dll
regsvr32.exe /s qmgr.dll
regsvr32.exe /s qmgrprxy.dll
regsvr32.exe /s wucltux.dll
regsvr32.exe /s muweb.dll
regsvr32.exe /s wuwebv.dll
Write-Host "7) Removing WSUS client settings..."
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
Write-Host "8) Resetting the WinSock..."
netsh winsock reset
netsh winhttp reset proxy
Write-Host "9) Delete all BITS jobs..."
Get-BitsTransfer | Remove-BitsTransfer
Write-Host "10) Attempting to install the Windows Update Agent..."
if($arch -eq 64){
wusa Windows8-RT-KB2937636-x64 /quiet
}
else{
wusa Windows8-RT-KB2937636-x86 /quiet
}
Write-Host "11) Starting Windows Update Services..."
Start-Service -Name BITS
Start-Service -Name wuauserv
Start-Service -Name appidsvc
Start-Service -Name cryptsvc
Write-Host "12) Forcing discovery..."
wuauclt /resetauthorization /detectnow
#hardset the reboot countdown timer in seconds (e.g. 900 for 15 minutes)
$rebootimer = 900
#set the first notification message copy. Include the reboot time value set previously
$message1 = "Automox will automatically reboot your computer in 15 minutes. Please take time to save and close any open documents."
#Define the time to wait until the second notification message is sent in seconds (e.g. 600 to wait 10 minutes).
$message2wait = 600
#set the second notification message copy
$message2 = "Automox will automatically reboot your computer in 5 minutes. Please take time to save and close any open documents."
#reset the reboot time to match the time indicated in the previous notification message copy (e.g. 300 for 5 minutes)
$rebootimer2 = 300
shutdown /a
shutdown /r /t $rebootimer /d p:4:1 /c $message1
Start-Sleep -Seconds $message2wait
shutdown /a
shutdown /r /t $rebootimer2 /d p:4:1 /c $message2
Reset Windows Update Tool (Script)
⚠ Deprecated! See wureset-tools/script-wureset
The Reset Windows Update Tool is a powerful troubleshooting tool designed to help users fix various issues related to Windows updates. This tool provides a wide range of functions to help reset and repair various components of the Windows Update service, as well as address other common system issues.
Features
The Reset Windows Update Tool provides the following features:
- Resetting Windows Update components to their default settings
- Deleting temporary files to free up disk space
- Changing invalid values in the Windows Registry to ensure smooth operation
- Scanning and repairing protected system files that may be corrupted using the «sfc /scannow» command
- Detecting and repairing corruptions in the Windows system image
- Cleaning up superseded components to optimize system performance and free up disk space
Getting Started
To use the Reset Windows Update Tool, simply download the tool and run it on your Windows system. The tool will guide you through the process of resetting and repairing various components of the Windows Update service, as well as other common system issues.
Support
- Wiki: 🇺🇸 🇪🇸 🇮🇹 🇧🇷 🇫🇷 🇩🇪
Version list
The following table lists version numbers:
Version | Date | Milestone |
---|---|---|
10.5.5 | 24/03/2023 | Migration to @wureset-tools |
10.5.4.1 | 11/02/2020 | 5 Years Celebration |
10.5.3.7 | 06/04/2019 | |
10.5.3.6 | 06/07/2018 | +500K Downloads Celebration |
10.5.3.5 | 12/22/2017 | |
10.5.3.4 | 11/27/2017 | |
10.5.3.3 | 07/23/2017 |
Credits
This project is developed and maintained by Manuel Gil.
License
Reset Windows Update Tool (Script) is licensed under the MIT License — see the MIT License for details.
1.20
This script will reset all of the Windows Updates components to DEFAULT SETTINGS.
Installation Options
-
Install Script
-
Install PSResource
-
Azure Automation
-
Manual Download
Copy and Paste the following command to install this package using PowerShellGet More Info
Install-Script -Name Reset-WindowsUpdate
Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info
You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More
Manually download the .nupkg file to your system’s default download location. Note that the file won’t be unpacked, and won’t include any dependencies. Learn More
Owners
-
Andreiztm
Package Details
Author(s)
- Ryan Nemeth,Written by: Ryan Nemeth,Find me on:,* My Blog: http://www.geekyryan.com,* Twitter: https://twitter.com/geeky_ryan,* LinkedIn: https://www.linkedin.com/in/ryan-nemeth-b0b1504b/,* Github: https://github.com/rnemeth90,* TechNet: https://social.technet.microsoft.com/profile/ryan%20nemeth/
Dependencies
This script has no dependencies.
Release Notes
Reset-WindowsUpdate.ps1 — Resets the Windows Update components
Results are printed to the console. Future releases will support outputting to a log file.
Change Log
V1.00, 05/21/2015 — Initial version
V1.10, 09/22/2016 — Fixed bug with call to sc.exe
V1.20, 11/13/2017 — Fixed environment variables
FileList
- Reset-WindowsUpdate.nuspec
- Reset-WindowsUpdate.ps1
Version History
Version | Downloads | Last updated |
---|---|---|
|
7,886 | 3/9/2021 |
Here’s a useful script that will automatically delete ALL user profiles that are on a Windows Server 2008/R2 computer.
WARNING!
This is a dangerous operation, designed for use by an administrator who needs to do a complete purge; for instance at the end of a semester.
Note:
For purposes of this example, we will use the following path for the script files:
D:\Scripts
- Copy the below provided code into the notepad and save it as delete_profiles.vbs in D:\Scripts
- Create a new notepad file and copy the following line:
cscript.exe “D:\Scripts\delete_profiles.vbs SRVNAME” > “D:\Scripts\profile_delete.txt”
- Where SRVNAME is the name of the server where you want to delete the profiles.The redirection (>) in that command line acts to create (or append) a text file named profile_delete.txt that will act to log the deletions.
- Save it as delete_all_profiles.bat and save it in D:\Scripts
- Create a scheduled job and run delete_all_profiles.bat at the desired time.
I suggest using a batch file and setting up a scheduled task as that lets the script run with the necessary permissions.
Here is the code for the script file: delete_profiles.vbs
On Error Resume Nextargs = WScript.Arguments.Count
If args <> 1 Then
WScript.Echo "usage: delete_profiles SVRNAME"
WScript.Echo "example (for remote profiles): cscript.exe delete_profiles SOMESERVER "
WScript.Echo "example (for local profiles): cscript.exe delete_profiles . "
WScript.Quit
End IfstrComputer = WScript.Arguments.Item(0)
Set objWMIService = GetObject("winmgmts:\\" & strComputer &"\root\cimv2")
Set colProfiles = objWMIService.ExecQuery("Select * from Win32_UserProfile")
Wscript.Echo "==" & WScript.Arguments.Item(0) & "==" & vbNewLineFor Each objProfile in colProfiles
Set objSID = objWMIService.Get("Win32_SID.SID='" & objProfile.SID &"'")
If (objSID.ReferencedDomainName = "DOMAIN NAME") Then
If Not ((objSID.AccountName = "USERNAME TO EXCLUDE") Or (Left (objSID.AccountName,2) = "USERNAME PREFIX TO EXCLUDE")) Then
Set objUserProfile = GetObject("winmgmts:{impersonationlevel=impersonate}!\\" _
& strComputer &"\root\cimv2:Win32_UserProfile." _
&"SID='" & objProfile.Sid &"'")
objUserProfile.Delete_
Wscript.Echo objSID.AccountName & ";" & objSID.ReferencedDomainName & ";" & objProfile.LocalPath & " - " & "DELETED"
End If
End If
Next
NOTES: In line 19 you have to specify the domain name to be used in the script and in line 20 you can specify user accounts that shouldn’t be deleted, like Administrator accounts.
Courtesy: KresimiK