Skip to content

Commit 3bcb8b4

Browse files
committed
Add option to force Microsoft Update
1 parent 14db9a8 commit 3bcb8b4

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

WindowsUpdatePush/Module1.vb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,27 @@ Module Module1
1818
End Function
1919

2020
Sub Main()
21+
Dim serverSelection As Integer = 0
22+
Dim serviceId As String = ""
23+
24+
Dim arguments As String() = Environment.GetCommandLineArgs()
25+
If arguments.Length > 1 Then
26+
Select Case arguments(1)
27+
Case "-microsoft"
28+
Console.WriteLine("Microsoft Update source selected.")
29+
serverSelection = 3
30+
serviceId = "7971f918-a847-4430-9279-4a52d1efe18d"
31+
End Select
32+
End If
33+
2134
'https://docs.microsoft.com/en-us/windows/win32/wua_sdk/searching--downloading--and-installing-updates
2235
Dim winUpdateSession As New UpdateSession()
2336
winUpdateSession.ClientApplicationID = "WindowsUpdatePush"
2437
Dim winUpdateSearcher As IUpdateSearcher = winUpdateSession.CreateUpdateSearcher()
38+
winUpdateSearcher.ServerSelection = serverSelection
39+
If serviceId <> "" Then
40+
winUpdateSearcher.ServiceID = serviceId
41+
End If
2542

2643
Try
2744
Console.WriteLine("Checking for updates...")

WindowsUpdatePush/My Project/AssemblyInfo.vb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Imports System.Runtime.InteropServices
1212
<Assembly: AssemblyDescription("")>
1313
<Assembly: AssemblyCompany("Jacob Weisz")>
1414
<Assembly: AssemblyProduct("WindowsUpdatePush")>
15-
<Assembly: AssemblyCopyright("Copyright © 2019-2021 Jacob Weisz")>
15+
<Assembly: AssemblyCopyright("Copyright © 2019-2022 Jacob Weisz")>
1616
<Assembly: AssemblyTrademark("")>
1717

1818
<Assembly: ComVisible(False)>
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
3131
' by using the '*' as shown below:
3232
' <Assembly: AssemblyVersion("1.0.*")>
3333

34-
<Assembly: AssemblyVersion("1.0.0.2")>
35-
<Assembly: AssemblyFileVersion("1.0.0.2")>
34+
<Assembly: AssemblyVersion("1.0.0.3")>
35+
<Assembly: AssemblyFileVersion("1.0.0.3")>

0 commit comments

Comments
 (0)