ms:settingswindowsupdate hidden

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Garfieldhi
Posts: 4
Joined: 23 Mar 2021 07:24

ms:settingswindowsupdate hidden

#1 Post by Garfieldhi » 23 Mar 2021 08:05

Hi,

I am trying to find a batch file that will run ms:settingswindowsupdate to check for updates and optional updates and install them, but all hidden or in the background. I know I can do this manually with check for updates, but I want to automate this process a little.

I have tried usoclient but it does not seem to work outside of task manager but if I create my own task it will not work. There is probably a very easy way to do this but I am pretty useless unfortunately, I want to avoid third party software.

I am working from home currently and have to keep logging in to work to make sure all updates are installed and everything is up to date. This I would think should be pretty easy but I can't believe how awkward it is proving.

I really appreciate any help you can give and I'm sorry if I have posed this in the wrong place.

Thanks

Toby

penpen
Expert
Posts: 1991
Joined: 23 Jun 2013 06:15
Location: Germany

Re: ms:settingswindowsupdate hidden

#2 Post by penpen » 23 Mar 2021 11:54

I actually can't check that, but in case with "I (...) can do this manually" you mean, that you use the "start->Run"- Dialog, type "ms:settingswindowsupdate" and hit enter, then the following might work:

Code: Select all

start "" "ms:settingswindowsupdate"
:: though i would expect something more like the following; but that might have changed since i read that the last time years ago
start "" "ms-settings:windowsupdate"
:: or
start "" "ms-settings:windowsupdate-action"

penpen

Garfieldhi
Posts: 4
Joined: 23 Mar 2021 07:24

Re: ms:settingswindowsupdate hidden

#3 Post by Garfieldhi » 23 Mar 2021 14:17

Hi Penpen,

Yes start "" "ms-settings:windowsupdate-action" definitely works I have to run it twice as the first time it only starts the settings update page the second time it starts a update check. Any idea how I can get the update page to open hidden/silently?

Thank you

Toby

penpen
Expert
Posts: 1991
Joined: 23 Jun 2013 06:15
Location: Germany

Re: ms:settingswindowsupdate hidden

#4 Post by penpen » 25 Mar 2021 13:13

I'm not sure if the update page can be influences, but maybe the following idea might help:
viewtopic.php?t=9468#p61384

Garfieldhi
Posts: 4
Joined: 23 Mar 2021 07:24

Re: ms:settingswindowsupdate hidden

#5 Post by Garfieldhi » 27 Mar 2021 06:49

Hi Penpen,

Ok I have tried the scrips in the link you suggested, I can't get any of them to work, I guess I am doing something wrong, I have added the ms:settings to the scrips some will run the settings page some will not, I am probably doing something wrong!!

The original scripts still won't allow me to run this hidden/silent.

Thank you so much for your help, it really is appreciated.

Toby

penpen
Expert
Posts: 1991
Joined: 23 Jun 2013 06:15
Location: Germany

Re: ms:settingswindowsupdate hidden

#6 Post by penpen » 28 Mar 2021 08:24

I thought of something like the following:

Code: Select all

"C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe" "-Command" "$wshShell = New-Object -ComObject WScript.Shell; $result = $WshShell.Run(\"ms-settings:windowsupdate\", 2);"
Sidenote:
I always test with the option "2" (=Activates the window and displays it as a minimized window.), which, if the commandline works as expected, could be switched to "0" (=Hides the window and activtes another window.)

But as you wrote, it simply doesn't work, so the obviously the windows update page window simply ignores such options.

Example for one application that obeys those option and one that ignores them ("test.bat"):

Code: Select all

@if (true==false) @end /*
@echo off
setlocal enableExtensions disableDelayedExpansion
call :main
goto :eof

:main
wscript //E:JScript //NoLogo "%~f0" 
goto :eof

goto :eof
*/

var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.Run ("\"C:\\Windows\\System32\\Notepad.exe\"", 2, false);	// obeys the second argument
WshShell.Run ("\"C:\\Windows\\Explorer.exe\"", 2, false);			// ignores the second argument
I don't see any other (regular) batch options to hide that window:
You might write for example a C++ application, that explicitely hides the windows update window (using "ShowWindow(hWnd, SW_HIDE);") after creation;
the result could be packed into a batch file with some additional steps, but it's easier to skip those steps and simply use a compiled exe as an alternative step... .


penpen

Garfieldhi
Posts: 4
Joined: 23 Mar 2021 07:24

Re: ms:settingswindowsupdate hidden

#7 Post by Garfieldhi » 01 Apr 2021 08:32

Hi Penpen,

I have tried to run this but I have had no luck I don't know how to add the code I need, I have bee trying Powershell but again to get it to run hidden is equally as difficult as tring to get a batch file to run hidden.

I'm guessing this is an imposible task.

Thanks

Toby

penpen
Expert
Posts: 1991
Joined: 23 Jun 2013 06:15
Location: Germany

Re: ms:settingswindowsupdate hidden

#8 Post by penpen » 02 Apr 2021 10:29

Yes, as i wrote the "windows update page window simply ignores such options", like running minimized or hidden.
So there is not much you can do about that from pure batch.

Therefore you have to use a programming language such as C++, with which you first start the windows update window,
then hook into that process and last hide that window.

Sidenote:
Every C++ program could be translated into a C# programm, which technically could be loaded and compiled by a hybrid C#/batch file - but beside proof of concept, that's not worth the effort, unless you have a good reason to do that.


penpen

Post Reply