- Можно ли обновить Windows, используя командную строку?
- 1] Запустите Центр обновления Windows, используя Windows Powershell
- 2] Запустите Центр обновления Windows с помощью командной строки
- Установка и управление обновлениями из командной строки
- Command-line switches for Microsoft software update packages
- Summary
- More information
- Можно ли вызвать Центр обновления Windows из командной строки?
- 6 ответов
- доступные обновления в списке
- Установки Обновления
- How To Run Windows Update From Command Line
- Check for Windows updates using Windows Settings
- Run Windows Update from PowerShell (Command-line)
- Run Windows Update from Command Prompt (Command-line)
- Continue Reading:
- 14 thoughts on “ How To Run Windows Update From Command Line ”
Можно ли обновить Windows, используя командную строку?
Центр обновления Windows — одна из наиболее заметных функций Windows 10. Поскольку с выпуском Windows 10 Windows была предложена покупателям как услуга, а не как продукт. В сценарии «Программное обеспечение как услуга» это привело к тому, что обновления для Windows 10 были включены по умолчанию и никто не мог их отключить. Теперь, в то время как некоторые критиковали этот шаг со стороны Microsoft, в конечном итоге это шаг навстречу клиенту. Потому что Центр обновления Windows помогает пользователям оставаться защищенными от всевозможных угроз и предоставлять им новейшие и самые лучшие решения от Microsoft. Итак, тем, кто ценит этот сервис, сегодня мы поговорим о другом способе запуска этих обновлений.
1] Запустите Центр обновления Windows, используя Windows Powershell
Для запуска обновлений Windows в Windows Powershell потребуется вручную установить модуль Центра обновления Windows, загрузить загруженные обновления Windows и установить обновления Windows. И для этого откройте Windows Powershell, выполнив поиск Powershell в окне поиска Cortana и запустите его с правами уровня администратора.
Установится модуль обновления Windows для Windows Powershell.
Будет выполнено подключение к серверам Центра обновления Windows и загружены обновления, если они найдены.
Установятся обновления Windows, загруженные на ваш компьютер.
2] Запустите Центр обновления Windows с помощью командной строки
Командная строка в операционных системах Windows существует очень давно, в то время как Windows Powershell является сравнительно новым. Следовательно, он имеет аналогичные возможности для запуска обновлений Windows, но здесь следует подчеркнуть, что вам не нужно загружать какой-либо модуль для обновлений Windows.
Сначала откройте командную строку, выполнив поиск cmd в поле поиска Cortana, и запустите его с правами администратора.
Нажмите Да, чтобы получить запрос UAC.
Наконец, введите следующие команды и нажмите клавишу Enter, чтобы выполнить соответствующие операции.
Начать проверку обновлений:
Начать загрузку обновлений:
Начните установку загруженных обновлений:
Перезагрузите устройство после установки обновлений:
Проверьте, загрузите и установите обновления:
Стоит отметить, что упомянутые выше команды командной строки предназначены только для Windows 10. Для более старых версий Windows вам необходимо использовать следующие команды.
Начать проверку обновлений:
Начать установку обнаруженных обновлений:
Проверьте, загрузите и установите обновления:
Установка и управление обновлениями из командной строки
Вы не знали о том, что можете устанавливать и управлять обновлениями для ОС Windows из командной строки? Тогда прочитайте эту статью, она будет вам интересна.
Если вы загружаете обновления программного обеспечения из каталога Microsoft Update, расположенного по адресу http://catalog.update.microsoft.com/v7/site/Install.aspx?referringpage=Home.aspx, вы можете втихую загружать и устанавливать обновления из командной строки с помощью утилиты Windows Update Stand-alone Installer (Wusa.exe). Например, если .msu файл «Обновление для Windows Server 2008 (KB947562)» имеет имя X86-all-windows6.0-kb947562-x86_6ff6b13433eba0503ffcd8e47e1daefac3dc83b4.msu, вы можете установить это обновление вручную, используя следующую команду:
wusa X86-all-windows6.0-kb947562-x86_6ff6b13433eba0503ffcd8e47e1daefac3dc83b4.msu /quiet
Вы можете использовать инструментарий управления Windows из командной строки (Windows Management Instrumentation Command-line — WMIC) для просмотра установленных обновлений на вашем компьютере. Например, чтобы убедиться, что обновление, описанное в предыдущем разделе, было установлено на вашем компьютере, выполните следующие действия:
Caption CSName Description FixComments HotFixID InstallDate InstalledBy InstalledOn Name ServicePackInEffect Status Caption
http://support.microsoft.com/?kbid=947562 S-SC1 Update KB947562 S-1-5-21-940954651-3993729752-4124607334-500 01c8dc69493cee0b
Если результате вывода WMIC трудно читаем для вас, вы можете использовать для тех же целей Systeminfo, а именно:
Command-line switches for Microsoft software update packages
This article describes the consistent set of command-line switches that Microsoft is adopting for deploying packages that contain software updates.
Original product version:  Windows 10 – all editions
Original KB number: В 824687
Summary
Microsoft is adopting a consistent set of command-line switches that you can use to deploy packages that contain software updates, such as security updates, critical updates, and hotfixes. This article describes these new command-line switches and their behaviors.
Packages that support these new command-line switches also support earlier command-line switches for backwards compatibility. However, usage of the earlier switches should be discontinued as this support may be removed in future software updates.
For additional information about command-line switches that are used by Windows software update packages, click the following article number to view the article in the Microsoft Knowledge Base:
262841 Command-line switches for Windows software update packages
For additional information about command-line switches used by Windows Installer, visit the following Microsoft Web site:
For additional information about the standard terminology that Microsoft is adopting to describe software updates, click the following article number to view the article in the Microsoft Knowledge Base:
More information
Microsoft is adopting the following command-line switches for software update packages:
/help; /h; /? — Displays a dialog box that shows the correct usage of the Setup command, including a list of all its command-line switches and their behaviors. You can display this help information in the command-line interface (CLI) or the graphical user interface (GUI). If you use any command-line switch incorrectly, this help switch is invoked and the correct usage is displayed. The dialog box also provides references to more online information.
/quiet — Runs the Setup program or the removal program in «quiet» mode. The program doesn’t prompt the user with any messages. The program enters all messages in a log file. By default, the program restarts the computer with no prompt or warning if the process requires a restart for the changes to take effect. To change the default restart behavior, use a different restart mode.
/passive — Runs the Setup program or the removal program in «passive» mode. The program doesn’t prompt the user with any error messages. The user sees a progress bar that indicates that the installation or the removal is occurring. The user can’t cancel the installation or the removal. By default, the program invokes the /warnrestart switch. If the program is installing multiple updates, the progress bar indicates the progress of the installation or the removal for each update.
/norestart — Doesn’t restart the computer after the installation or the removal, even if the process requires a restart for the changes to take effect.
/forcerestart — Restarts the computer after the installation or the removal, even if the process doesn’t require a restart for the changes to take effect. Restarting forces programs that are running to close.
/warnrestart[:x ] — Invokes a dialog box that warns the user that a restart will occur in x seconds (in 30 seconds if no value is specified). For example, to warn that a restart will occur in 60 seconds, type /warnrestart:60. The dialog box contains a Cancel button and a Restart Now button. If the user clicks Cancel, the computer isn’t restarted.
/promptrestart — Prompts the user that the computer must be restarted for the changes to take effect. The user can select whether to restart the computer.
/uninstall — Removes the package.
/log — Enables the user to define the path for the local log file. This switch invokes the default logging behavior.
/extract — Enables you to extract the installation files to a specified folder.
Можно ли вызвать Центр обновления Windows из командной строки?
часто бывает, что я должен смотреть этот экран в течение нескольких минут:
Я понятия не имею, что происходит в спину. И я также не заинтересован в наблюдении за WindowsUpdate.log для изменения.
Я хотел бы знать, если есть способ, что дает больше обратной связи. Предпочтительно то, что я могу вызвать из командной строки (например, apt-get ).
6 ответов
в Windows 10, вы можете использовать PSWindowsUpdate модуль PowerShell.
вы можете вызвать Центр обновления Windows из командной строки с помощью wuauclt.утилита exe расположена в папке %windir%\system32\.
проверить наличие обновлений,
проверить и обновить,
Это не будет работать, если вы установили «никогда не проверять наличие обновлений» в настройках Центра Обновления Windows. Также, вероятно, автоматические обновления должны быть включены для переключения «/ updatenow » на работу (установка обновлений).
в версиях Windows до Windows 10, вы также можете запустите GUI для Центра Обновления Windows, введя следующую команду (находится в папке %windir%\system32\):
Это только открывает приложение обновления и проверяет доступные обновления, он не устанавливает их. И если вы поставили «не проверять наличие обновлений» в настройках обновления Windows, это не проверяет наличие обновлений, вам придется нажать на «кнопку обновления».
одно предложение мне очень понравилось, это WUA_SearchDownloadInstall.vbs сценарий.
доступные обновления в списке
Установки Обновления
можно использовать wusa.exe который является частью Windows 7.
хотел удалить значок обновления Windows 10 из панели задач, так что я написал это AutoHotkey скрипт, который вызывает wusa.
так что вы можете использовать wusa.exe для управления обновлениями Windows и установить .msu файлы.
этой страница имеет коллекцию других способов для управления обновлениями из командной строки.
чтобы увидеть, какие обновления установлены (через командную строку):
Я использую WuInstall. Это инструмент командной строки для управления обновлениями Windows. У вас есть много отличных опций, таких как отображение хода установки, чтобы указать, если вы хотите перезагрузить и когда, и файлы журнала доступны для каждого процесса. С уважением
Windows 10 и Windows Server 2016 или выше, используйте USOClient.exe для сканирования, загрузки и установки обновлений.
- StartScan Используется Для Запуска Сканирования
- StartDownload используется для запуска загрузки патчей
- StartInstall используется для установки загруженных патчи
- RefreshSettings обновить настройки, если были сделаны какие-либо изменения
- StartInteractiveScan может запрашивать ввод пользователя и / или открывать диалоги, чтобы показать прогресс или сообщить об ошибках
- RestartDevice перезагрузить устройство, чтобы закончить установку обновлений
- ScanInstallWait Комбинированная Загрузка Сканирования Установить
- ResumeUpdate Возобновить Установку Обновления При Загрузке
How To Run Windows Update From Command Line
In Windows 10, Windows Update can be found in Settings –> Update & Security –> Windows Update. Normally Windows Update keeps on running in the background and will install new updates automatically.
You can also run Windows Update manually to check for new updates at any time. Here are three ways to check for new Windows updates.
Check for Windows updates using Windows Settings
To check for new updates and configure Windows Update settings, follow the steps below:
- Open Windows Settings (Windows key + i).
- Choose Update & Security.
- Choose Windows Update from the left hand menu.
- Press the Check for updates button in the right hand pane.
Check for updates
Run Windows Update from PowerShell (Command-line)
There is a PowerShell module for Windows Update. You can install and run the module to check for new updates. There are three steps for running Windows Update through PowerShell. Run the following commands step by step:
- Install-Module PSWindowsUpdate Install Module PSWindowsUpdate
This will install the Windows Update module in PowerShell.
Get-WindowsUpdate Get WindowsUpdate
This command will check for updates.
Install-WindowsUpdate Install WindowsUpdate
This command will install the available updates (which were listed in step 2)
Run Windows Update from Command Prompt (Command-line)
Windows Update can also be run through legacy CMD. The only limitation running Windows Update through command prompt is that it won’t show any progress. Only results are shown. Let’s see how to run it:
- Go to Run –> cmd
- Run the following command to check for new updates:
wuauclt /detectnow - Run the following command to install new updates
wuauclt /updatenow
Since the command prompt does not show any progress, a better approach would be to check and install updates at the same time. Here’s the command for this:
wuauclt /detectnow /updatenow
The above mentioned command will work in all versions of Windows including Windows 7 and Windows Server 2008 R2. But if you are using Windows 10 or Windows Server 2016, you can use UsoClient command which has more options than wuauclt. You can run UsoClient with the following switches:
StartScan – Start checking for updates
StartDownload – Start downloading updates
StartInstall – Start installing downloaded updates
RestartDevice – Restart Windows after updates are installed
ScanInstallWait – Check for updates, download available updates and install them
Hopefully this will be useful in situations where you want to automate certain Windows functions. What other purposes do you want to use command line options for running Windows Update?
Continue Reading:
Usman Khurshid is a seasoned IT Pro with over 15 years of experience in the IT industry. He has experience in everything from IT support, helpdesk, sysadmin, network admin, and cloud computing. He is also certified in Microsoft Technologies (MCTS and MCSA) and also Cisco Certified Professional in Routing and Switching. Reach him at Twitter @usmank11
14 thoughts on “ How To Run Windows Update From Command Line ”
Thank you Usman! Wow Microsoft has a new cli USOClient.exe awesome!
Thank you. Refurbished machine – needed to update in order to move from other machine to “new to me” machine after just getting ti to cooperate with the network. I have never run across a machine that would not update before. The cmd options did not work, but the PS option was exactly what I needed. Added to my bag of tricks. Thank you so much!!
usoclient.exe /StartScan does not update the shown ‘Last checked date’ shown in the GUI on a Windows Server 2016 or 2019.
PS C:\> Start-Service wuauserv -Verbose
PS C:\> $updateSession = new-object -com “Microsoft.Update.Session”;$updates=$updateSession.CreateupdateSearcher().Search($criteria).Updates
PS C:\> (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
This is work on a Windows 10 – the Last checked time is updated in the GUI
BUT it’s not workting om Windows 2016 or 2019
Any know of a way to make this work on a Server 2016 ??
I don’t get any of these from article to work. Not even: Start-Service wuauserv -Verbose
PS C:\WINDOWS\system32> Start-Service wuauserv -Verbose
VERBOSE: Performing the operation “Start-Service” on target “wuauserv (wuauserv)”.
Start-Service : Failed to start service ‘wuauserv (wuauserv)’.
At line:1 char:1
+ Start-Service wuauserv -Verbose
+
+ CategoryInfo : OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service],
ServiceCommandException
+ FullyQualifiedErrorId : StartServiceFailed,Microsoft.PowerShell.Commands.StartServiceCommand
Please run PowerShell with administrative privileges.
usoclient StartScan does NOT make any changes to the Last checked date shown in the GUI
Neither does the Powershell command Get-WindowsUpdate
In previous Windows I had to updating the Last checked value in registry after performing a scan using the API (as they dont). But MS has moved the location to an unknown place i 2016 and 2019.
Anyone who knows how to update the “Last checked date” from CMD or API .
Function Force-WSUSCheckin($Computer)
<
Invoke-Command -computername $Computer -scriptblock < Start-Service wuauserv -Verbose >
# Have to use psexec with the -s parameter as otherwise we receive an “Access denied” message loading the comobject
$Cmd = ‘$updateSession = new-object -com “Microsoft.Update.Session”;$updates=$updateSession.CreateupdateSearcher().Search($criteria).Updates’
& c:\bin\psexec.exe -s \\$Computer powershell.exe -command $Cmd
Write-host “Waiting 10 seconds for SyncUpdates webservice to complete to add to the wuauserv queue so that it can be reported on”
Start-sleep -seconds 10
Invoke-Command -computername $Computer -scriptblock
<
# Now that the system is told it CAN report in, run every permutation of commands to actually trigger the report in operation
wuauclt /detectnow
(New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
wuauclt /reportnow
c:\windows\system32\UsoClient.exe startscan
>
>
Hi Glenn, thank you for such a detailed explanation.
Get-WindowsUpdate: The ‘Get-WindowsUpdate’ command was found in the module ‘PSWindowsUpdate’, but the module could
not be loaded. For more information, run ‘Import-Module PSWindowsUpdate’.
At line:1 char:1
+ Get-WindowsUpdate
+
+ CategoryInfo : ObjectNotFound: (Get-WindowsUpdate:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
To remedy that, please try the following:
1. Run Set-ExecutionPolicy -ExecutionPolicy Unrestricted
2. Run Import-Module PSWindowsUpdate
3. Try running Get-WindowsUpdate again.
This worked for me.