├── .gitignore
├── LICENSE
├── PSWindowsUpdate.Format.ps1xml
├── PSWindowsUpdate.csproj
├── PSWindowsUpdate.dll-Help.xml
├── PSWindowsUpdate.psd1
├── PSWindowsUpdate.psm1
├── PSWindowsUpdate.sln
├── README.md
├── docs
├── Add-WUServiceManager.md
├── Enable-WURemoting.md
├── Get-WUApiVersion.md
├── Get-WUHistory.md
├── Get-WUInstallerStatus.md
├── Get-WUJob.md
├── Get-WULastResults.md
├── Get-WUOfflineMSU.md
├── Get-WURebootStatus.md
├── Get-WUServiceManager.md
├── Get-WUSettings.md
├── Get-WUTest.md
├── Get-WindowsUpdate.md
├── Get-WindowsUpdate_v2.md
├── Invoke-WUJob.md
├── Remove-WUServiceManager.md
├── Remove-WindowsUpdate.md
├── Reset-WUComponents.md
├── Set-PSWUSettings.md
├── Set-WUSettings.md
└── Update-WUModule.md
├── genbitsdll.bat
└── src
├── AddWUServiceManager.cs
├── AgentInfo.cs
├── Credential.cs
├── CredentialType.cs
├── EnableWURemoting.cs
├── GetWUApiVersion.cs
├── GetWUHistory.cs
├── GetWUInstallerStatus.cs
├── GetWUJob.cs
├── GetWULastResults.cs
├── GetWUOfflineMSU.cs
├── GetWURebootStatus.cs
├── GetWUServiceManager.cs
├── GetWUSettings.cs
├── GetWUTest.cs
├── GetWindowsUpdate.cs
├── GetWindowsUpdate_v2.cs
├── History.cs
├── InstallerStatus.cs
├── InvokeWUJob.cs
├── LastResults.cs
├── NativeMethods.cs
├── OfflineMSU.cs
├── PSCredMan.cs
├── PersistenceType.cs
├── RebootStatus.cs
├── RemoveWUServiceManager.cs
├── RemoveWindowsUpdate.cs
├── ResetWUComponents.cs
├── SecureStringHelper.cs
├── ServiceManager.cs
├── SetPSWUSettings.cs
├── SetWUSettings.cs
├── UpdateWUModule.cs
├── ValidateDateTimeAttribute.cs
├── ValidateIntGt0Attribute.cs
├── ValidateRecurseCycleAttribute.cs
├── ValidateTestAttribute.cs
├── WUAPIObject.cs
├── WUApiCode.cs
├── WUBits.cs
├── WUCimSession.cs
├── WUImpersonator.cs
├── WUJob.cs
├── WUServiceController.cs
├── WUSettings.cs
├── WUTools.cs
└── WindowsUpdate.cs
/.gitignore:
--------------------------------------------------------------------------------
1 | # User-specific stuff
2 | .idea/**/workspace.xml
3 | .idea/**/tasks.xml
4 | .idea/**/usage.statistics.xml
5 | .idea/**/dictionaries
6 | .idea/**/shelf
7 |
8 | # Generated files
9 | .idea/**/contentModel.xml
10 |
11 | # Sensitive or high-churn files
12 | .idea/**/dataSources/
13 | .idea/**/dataSources.ids
14 | .idea/**/dataSources.local.xml
15 | .idea/**/sqlDataSources.xml
16 | .idea/**/dynamic.xml
17 | .idea/**/uiDesigner.xml
18 | .idea/**/dbnavigator.xml
19 |
20 | # File-based project format
21 | *.iws
22 |
23 | /obj/
24 | /bin/
25 | /.vs/
26 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Michal Gajda
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/PSWindowsUpdate.Format.ps1xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PSWindowsUpdate
6 |
7 | PSWindowsUpdate.WindowsUpdate
8 |
9 |
10 |
11 |
12 | 12
13 |
14 |
15 | 10
16 |
17 |
18 | 9
19 |
20 |
21 | Right
22 | 6
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | ComputerName
31 |
32 |
33 | Status
34 |
35 |
36 | KB
37 |
38 |
39 | Size
40 |
41 |
42 | Title
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | PSWindowsUpdate
51 |
52 | PSWindowsUpdate.OfflineMSU
53 |
54 |
55 |
56 |
57 | 1
58 |
59 |
60 | 10
61 |
62 |
63 |
64 | 11
65 |
66 |
67 | Right
68 | 8
69 |
70 |
71 |
72 |
73 |
74 |
75 | X
76 |
77 |
78 | Result
79 |
80 |
81 | Title
82 |
83 |
84 | LastUpdated
85 |
86 |
87 | Size
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | PSWindowsUpdate
96 |
97 | PSWindowsUpdate.WindowsUpdateJob
98 |
99 |
100 |
101 |
102 | 1
103 |
104 |
105 | 12
106 |
107 |
108 | 10
109 |
110 |
111 | 9
112 |
113 |
114 | Right
115 | 6
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 | X
124 |
125 |
126 | ComputerName
127 |
128 |
129 | Result
130 |
131 |
132 | KB
133 |
134 |
135 | Size
136 |
137 |
138 | Title
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 | PSWindowsUpdate
147 |
148 | PSWindowsUpdate.History
149 |
150 |
151 |
152 |
153 | 12
154 |
155 |
156 | 14
157 |
158 |
159 | 10
160 |
161 |
162 | 19
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 | ComputerName
171 |
172 |
173 | Operationname
174 |
175 |
176 | Result
177 |
178 |
179 | Date
180 |
181 |
182 | Title
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 | PSWindowsUpdate
191 |
192 | PSWindowsUpdate.ServiceManager
193 |
194 |
195 |
196 |
197 | 36
198 |
199 |
200 | 9
201 |
202 |
203 |
204 | 9
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 | ServiceID
213 |
214 |
215 | IsManaged
216 |
217 |
218 | IsDefaultAUService
219 |
220 |
221 | Name
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 | PSWindowsUpdate
230 |
231 | PSWindowsUpdate.AgentInfo
232 |
233 |
234 |
235 |
236 | 12
237 |
238 |
239 | 15
240 |
241 |
242 | 15
243 |
244 |
245 | 10
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 | ComputerName
254 |
255 |
256 | PSWindowsUpdate
257 |
258 |
259 | PSWUModuleDll
260 |
261 |
262 | ApiVersion
263 |
264 |
265 | WuapiDllVersion
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 | PSWindowsUpdate
274 |
275 | PSWindowsUpdate.InstallerStatus
276 |
277 |
278 |
279 |
280 | 12
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 | ComputerName
289 |
290 |
291 | IsBusy
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 | PSWindowsUpdate
300 |
301 | PSWindowsUpdate.LastResults
302 |
303 |
304 |
305 |
306 | 12
307 |
308 |
309 | 10
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 | ComputerName
318 |
319 |
320 | LastSearchSuccessDate
321 |
322 |
323 | LastInstallationSuccessDate
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 | PSWindowsUpdate
332 |
333 | PSWindowsUpdate.WUJob
334 |
335 |
336 |
337 |
338 | 12
339 |
340 |
341 | 20
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 | ComputerName
352 |
353 |
354 | Name
355 |
356 |
357 |
358 | $_.Definition.Actions[1].Arguments -replace '-Command "|"$'
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
--------------------------------------------------------------------------------
/PSWindowsUpdate.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | Debug
4 | AnyCPU
5 | {31C18EBF-C6E4-45E7-AECF-7FE9913ACB15}
6 | net472
7 | Library
8 | PSWindowsUpdate
9 | v4.7.2
10 | 2.2.1.5
11 | 512
12 | latest
13 | true
14 | true
15 | PSWindowsUpdate
16 | 2.2.1.5
17 | 1.0.0
18 | 2.2.1.5
19 | PSWindowsUpdate
20 | https://github.com/sarog/PSWindowsUpdate
21 | Copyright © 2011-2022 Michal Gajda. All rights reserved.
22 | https://github.com/sarog/PSWindowsUpdate
23 | https://github.com/sarog/PSWindowsUpdate/blob/master/LICENSE
24 | PSWindowsUpdate
25 |
26 |
27 | AnyCPU
28 | true
29 | full
30 | false
31 | bin\Debug\
32 | DEBUG;TRACE
33 | prompt
34 | 4
35 | true
36 |
37 |
38 | AnyCPU
39 | pdbonly
40 | true
41 | bin\Release\
42 | TRACE
43 | prompt
44 | 4
45 | true
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | {3050F1C5-98B5-11CF-BB82-00AA00BDCE0B}
110 | 4
111 | 0
112 | 0
113 | tlbimp
114 | False
115 | True
116 |
117 |
118 | {58FBCF7C-E7A9-467C-80B3-FC65E8FCCA08}
119 | 1
120 | 0
121 | 0
122 | tlbimp
123 | False
124 | True
125 |
126 |
127 | {E34CB9F1-C7F7-424C-BE29-027DCC09363A}
128 | 1
129 | 0
130 | 0
131 | tlbimp
132 | False
133 | True
134 |
135 |
136 | {B596CC9F-56E5-419E-A622-E01BB457431E}
137 | 2
138 | 0
139 | 0
140 | tlbimp
141 | False
142 | True
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
--------------------------------------------------------------------------------
/PSWindowsUpdate.psd1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sarog/PSWindowsUpdate/310efa7b17c58aaf36352589179a7a8510a81c75/PSWindowsUpdate.psd1
--------------------------------------------------------------------------------
/PSWindowsUpdate.psm1:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sarog/PSWindowsUpdate/310efa7b17c58aaf36352589179a7a8510a81c75/PSWindowsUpdate.psm1
--------------------------------------------------------------------------------
/PSWindowsUpdate.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 12.00
2 | # Visual Studio Version 16
3 | VisualStudioVersion = 16.0.32802.440
4 | MinimumVisualStudioVersion = 10.0.40219.1
5 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSWindowsUpdate", "PSWindowsUpdate.csproj", "{31C18EBF-C6E4-45E7-AECF-7FE9913ACB15}"
6 | EndProject
7 | Global
8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
9 | Debug|Any CPU = Debug|Any CPU
10 | Release|Any CPU = Release|Any CPU
11 | EndGlobalSection
12 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
13 | {31C18EBF-C6E4-45E7-AECF-7FE9913ACB15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
14 | {31C18EBF-C6E4-45E7-AECF-7FE9913ACB15}.Debug|Any CPU.Build.0 = Debug|Any CPU
15 | {31C18EBF-C6E4-45E7-AECF-7FE9913ACB15}.Release|Any CPU.ActiveCfg = Release|Any CPU
16 | {31C18EBF-C6E4-45E7-AECF-7FE9913ACB15}.Release|Any CPU.Build.0 = Release|Any CPU
17 | EndGlobalSection
18 | GlobalSection(SolutionProperties) = preSolution
19 | HideSolutionNode = FALSE
20 | EndGlobalSection
21 | GlobalSection(ExtensibilityGlobals) = postSolution
22 | SolutionGuid = {C12C9855-2A7E-4BC7-B48C-0C1316E1712D}
23 | EndGlobalSection
24 | EndGlobal
25 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ### PSWindowsUpdate (unofficial fork)
2 |
3 | PSWindowsUpdate is written by Michal Gajda ([mgajda83/PSWindowsUpdate](https://github.com/mgajda83/PSWindowsUpdate)).
4 |
5 | This "fork" is a **decompiled** version of the original PSWindowsUpdate DLLs for the sole purpose of fixing bugs, improving security, and allowing transparency to an otherwise **awesome** PowerShell module used by [millions of sysadmins](https://www.powershellgallery.com/packages/PSWindowsUpdate). Currently, this repo contains a bug fix for `Remove-WindowsUpdate -UpdateID` (please see the git history for more information).
6 |
7 | The project builds without any issues in Rider however its use in production environments is discouraged at this time. Additional source code reviews & cleanup of leftover artifacts are still needed.
8 |
9 | For anyone wishing to build this project, one must first [compile](https://docs.microsoft.com/en-us/windows/win32/bits/bits-dot-net) a `BITSReference4_0` reference DLL using Type Libraries from the Windows 10+ SDK. For convenience, I have included the build script featured on Microsoft's page.
10 |
--------------------------------------------------------------------------------
/docs/Add-WUServiceManager.md:
--------------------------------------------------------------------------------
1 | ---
2 | external help file: PSWindowsUpdate.dll-Help.xml
3 | Module Name: PSWindowsUpdate
4 | online version: https://commandlinegeeks.wordpress.com/
5 | schema: 2.0.0
6 | ---
7 |
8 | # Add-WUServiceManager
9 |
10 | ## SYNOPSIS
11 | Register a new Windows Update API Service Manager.
12 |
13 | ## SYNTAX
14 |
15 | ### LocalServiceID (Default)
16 | ```
17 | Add-WUServiceManager [-SendReport] [-PSWUSettings ] -ServiceID [-AddServiceFlag ]
18 | [-AuthorizationCabPath ] [-Silent] [-Debuger] [-WhatIf] [-Confirm] []
19 | ```
20 |
21 | ### RemoteServiceID
22 | ```
23 | Add-WUServiceManager [-ComputerName ] [-SendReport] [-PSWUSettings ] -ServiceID
24 | [-Silent] [-Debuger] [-WhatIf] [-Confirm] []
25 | ```
26 |
27 | ### MicrosoftUpdate
28 | ```
29 | Add-WUServiceManager [-ComputerName ] [-SendReport] [-PSWUSettings ] [-MicrosoftUpdate]
30 | [-Silent] [-Debuger] [-WhatIf] [-Confirm] []
31 | ```
32 |
33 | ### OfflineSync
34 | ```
35 | Add-WUServiceManager [-SendReport] [-PSWUSettings ] [-ServiceName ]
36 | -ScanFileLocation [-Silent] [-Debuger] [-WhatIf] [-Confirm] []
37 | ```
38 |
39 | ## DESCRIPTION
40 | Use Add-WUServiceManager cmdlet to register new Windows Update Service Manager.
41 |
42 | It's combination old 'Add-WUServiceManager' and 'Add-WUOfflineSync' functions to register online and offline ServiceManager
43 |
44 | ## EXAMPLES
45 |
46 | ### Example 1
47 | ```
48 | Try register Microsoft Update Service by custom ServiceID.
49 |
50 | Add-WUServiceManager -ServiceID "7971f918-a847-4430-9279-4a52d1efe18d"
51 |
52 | Confirm
53 | Are you sure you want to perform this action?
54 | Performing the operation "Register Windows Update Service Manager: 7971f918-a847-4430-9279-4a52d1efe18d" on target "MG-PC".
55 | [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): Y
56 |
57 | ServiceID IsManaged IsDefault Name
58 | --------- --------- --------- ----
59 | 7971f918-a847-4430-9279-4a52d1efe18d False False Microsoft Update
60 | ```
61 |
62 | ### Example 2
63 | ```
64 | Try register Microsoft Update service as Service Manager.
65 |
66 | Add-WUServiceManager -MicrosoftUpdate
67 |
68 | Confirm
69 | Are you sure you want to perform this action?
70 | Performing the operation "Register Windows Update Service Manager: 7971f918-a847-4430-9279-4a52d1efe18d" on target "MG-PC".
71 | [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): Y
72 |
73 | ServiceID IsManaged IsDefault Name
74 | --------- --------- --------- ----
75 | 7971f918-a847-4430-9279-4a52d1efe18d False False Microsoft Update
76 | ```
77 |
78 | ### Example 3
79 | ```
80 | Try register Offline Sync Service from file C:\wsusscn2.cab.
81 |
82 | Add-WUServiceManager -ScanFileLocation C:\wsusscn2.cab
83 |
84 | Confirm
85 | Are you sure you want to perform this action?
86 | Performing the operation "Register Offline Windows Update Service Manager: C:\wsusscn2.cab" on target "MG-PC".
87 | [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): Y
88 |
89 | ServiceID IsManaged IsDefault Name
90 | --------- --------- --------- ----
91 | 7e1364ef-e30e-4f4e-9c66-84194eebcbbe False False Offline Sync Service
92 | ```
93 |
94 | ## PARAMETERS
95 |
96 | ### -AddServiceFlag
97 | A combination of AddServiceFlag values: \r\n0x1 - asfAllowPendingRegistration \r\n0x2 - asfAllowOnlineRegistration \r\n0x4 - asfRegisterServiceWithAU
98 |
99 | ```yaml
100 | Type: Int32
101 | Parameter Sets: LocalServiceID
102 | Aliases:
103 |
104 | Required: False
105 | Position: Named
106 | Default value: 2
107 | Accept pipeline input: False
108 | Accept wildcard characters: False
109 | ```
110 |
111 | ### -AuthorizationCabPath
112 | The path of the Microsoft signed local cabinet file (.cab) that has the information that is required for a service registration.
113 | If empty, the update agent searches for the authorization cabinet file (.cab) during service registration when a network connection is available.
114 |
115 | ```yaml
116 | Type: String
117 | Parameter Sets: LocalServiceID
118 | Aliases:
119 |
120 | Required: False
121 | Position: Named
122 | Default value: None
123 | Accept pipeline input: False
124 | Accept wildcard characters: False
125 | ```
126 |
127 | ### -ComputerName
128 | Specify one or more computer names for remote connection.
129 |
130 | ```yaml
131 | Type: String[]
132 | Parameter Sets: RemoteServiceID, MicrosoftUpdate
133 | Aliases:
134 |
135 | Required: False
136 | Position: Named
137 | Default value: None
138 | Accept pipeline input: True (ByPropertyName, ByValue)
139 | Accept wildcard characters: False
140 | ```
141 |
142 | ### -Confirm
143 | Prompts you for confirmation before running the cmdlet.
144 |
145 | ```yaml
146 | Type: SwitchParameter
147 | Parameter Sets: (All)
148 | Aliases: cf
149 |
150 | Required: False
151 | Position: Named
152 | Default value: None
153 | Accept pipeline input: False
154 | Accept wildcard characters: False
155 | ```
156 |
157 | ### -Debuger
158 | Debuger return original exceptions.
159 |
160 | ```yaml
161 | Type: SwitchParameter
162 | Parameter Sets: (All)
163 | Aliases:
164 |
165 | Required: False
166 | Position: Named
167 | Default value: False
168 | Accept pipeline input: False
169 | Accept wildcard characters: False
170 | ```
171 |
172 | ### -MicrosoftUpdate
173 | Register Microsoft Update Service Manager - '7971f918-a847-4430-9279-4a52d1efe18d'
174 |
175 | ```yaml
176 | Type: SwitchParameter
177 | Parameter Sets: MicrosoftUpdate
178 | Aliases:
179 |
180 | Required: True
181 | Position: Named
182 | Default value: False
183 | Accept pipeline input: False
184 | Accept wildcard characters: False
185 | ```
186 |
187 | ### -PSWUSettings
188 | Required parameter for -SendReport.
189 |
190 | Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";\[Port=25\];\[Subject="Alternative Subject"\];\[Properties="Alternative object properties"\];\[Style="Table|List"\]}
191 |
192 | Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";\[Port=25\]}"
193 |
194 | ```yaml
195 | Type: Hashtable
196 | Parameter Sets: (All)
197 | Aliases:
198 |
199 | Required: False
200 | Position: Named
201 | Default value: None
202 | Accept pipeline input: False
203 | Accept wildcard characters: False
204 | ```
205 |
206 | ### -ScanFileLocation
207 | Path to Windows Update offline scan file (wsusscan.cab or wsusscn2.cab).
208 |
209 | ```yaml
210 | Type: String
211 | Parameter Sets: OfflineSync
212 | Aliases:
213 |
214 | Required: True
215 | Position: Named
216 | Default value: None
217 | Accept pipeline input: False
218 | Accept wildcard characters: False
219 | ```
220 |
221 | ### -SendReport
222 | Send report email to specific recipients.
223 |
224 | Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path.
225 |
226 | ```yaml
227 | Type: SwitchParameter
228 | Parameter Sets: (All)
229 | Aliases:
230 |
231 | Required: False
232 | Position: Named
233 | Default value: False
234 | Accept pipeline input: False
235 | Accept wildcard characters: False
236 | ```
237 |
238 | ### -ServiceID
239 | An identifier for the service to be registered.
240 |
241 | Examples Of ServiceID: \r\n \r\n -- Windows Update 9482f4b4-e343-43b6-b170-9a65bc822c77 \r\n -- Microsoft Update 7971f918-a847-4430-9279-4a52d1efe18d \r\n -- Windows Store 117cab2d-82b1-4b5a-a08c-4d62dbee7782 \r\n -- Windows Server Update Service 3da21691-e39d-4da6-8a4b-b43877bcb1b7
242 |
243 | ```yaml
244 | Type: String
245 | Parameter Sets: LocalServiceID, RemoteServiceID
246 | Aliases:
247 |
248 | Required: True
249 | Position: Named
250 | Default value: None
251 | Accept pipeline input: False
252 | Accept wildcard characters: False
253 | ```
254 |
255 | ### -ServiceName
256 | Name under which it will be registered Windows Update offline service.
257 | Default name is 'Offline Sync Service'.
258 |
259 | ```yaml
260 | Type: String
261 | Parameter Sets: OfflineSync
262 | Aliases:
263 |
264 | Required: False
265 | Position: Named
266 | Default value: Offline Sync Service
267 | Accept pipeline input: False
268 | Accept wildcard characters: False
269 | ```
270 |
271 | ### -Silent
272 | Don't return output.
273 |
274 | ```yaml
275 | Type: SwitchParameter
276 | Parameter Sets: (All)
277 | Aliases:
278 |
279 | Required: False
280 | Position: Named
281 | Default value: False
282 | Accept pipeline input: False
283 | Accept wildcard characters: False
284 | ```
285 |
286 | ### -WhatIf
287 | Shows what would happen if the cmdlet runs. The cmdlet is not run.
288 |
289 | ```yaml
290 | Type: SwitchParameter
291 | Parameter Sets: (All)
292 | Aliases: wi
293 |
294 | Required: False
295 | Position: Named
296 | Default value: None
297 | Accept pipeline input: False
298 | Accept wildcard characters: False
299 | ```
300 |
301 | ### CommonParameters
302 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
303 |
304 | ## INPUTS
305 |
306 | ### System.String[]
307 |
308 | ## OUTPUTS
309 |
310 | ### PSWindowsUpdate.ServiceManager
311 |
312 | ## NOTES
313 |
314 | ## RELATED LINKS
315 |
316 | [Author Blog](https://commandlinegeeks.wordpress.com/)
317 |
318 |
--------------------------------------------------------------------------------
/docs/Enable-WURemoting.md:
--------------------------------------------------------------------------------
1 | ---
2 | external help file: PSWindowsUpdate.dll-Help.xml
3 | Module Name: PSWindowsUpdate
4 | online version: https://commandlinegeeks.wordpress.com/
5 | schema: 2.0.0
6 | ---
7 |
8 | # Enable-WURemoting
9 |
10 | ## SYNOPSIS
11 | Enable firewall rules for PSWindowsUpdate remoting.
12 |
13 | ## SYNTAX
14 |
15 | ```
16 | Enable-WURemoting [-LocalAccountTokenFilterPolicy] [-WinRMPublic] [-Debuger] [-WhatIf] [-Confirm]
17 | []
18 | ```
19 |
20 | ## DESCRIPTION
21 | Use Enable-WURemoting cmdlet to enable nessesery firewall rules for PSWindowsUpdate remoting.
22 |
23 | ## EXAMPLES
24 |
25 | ### Example 1
26 | ```
27 | Enable firewall rules for PSWindowsUpdate remoting.
28 |
29 | Enable-WURemoting -Verbose
30 | ```
31 |
32 | ## PARAMETERS
33 |
34 | ### -Confirm
35 | Prompts you for confirmation before running the cmdlet.
36 |
37 | ```yaml
38 | Type: SwitchParameter
39 | Parameter Sets: (All)
40 | Aliases: cf
41 |
42 | Required: False
43 | Position: Named
44 | Default value: None
45 | Accept pipeline input: False
46 | Accept wildcard characters: False
47 | ```
48 |
49 | ### -Debuger
50 | Debuger return original exceptions.
51 |
52 | ```yaml
53 | Type: SwitchParameter
54 | Parameter Sets: (All)
55 | Aliases:
56 |
57 | Required: False
58 | Position: Named
59 | Default value: False
60 | Accept pipeline input: False
61 | Accept wildcard characters: False
62 | ```
63 |
64 | ### -LocalAccountTokenFilterPolicy
65 | Set LocalAccountTokenFilterPolicy registry entry to builds an elevated token on the target remote computer.
66 |
67 | ```yaml
68 | Type: SwitchParameter
69 | Parameter Sets: (All)
70 | Aliases:
71 |
72 | Required: False
73 | Position: Named
74 | Default value: False
75 | Accept pipeline input: False
76 | Accept wildcard characters: False
77 | ```
78 |
79 | ### -WhatIf
80 | Shows what would happen if the cmdlet runs. The cmdlet is not run.
81 |
82 | ```yaml
83 | Type: SwitchParameter
84 | Parameter Sets: (All)
85 | Aliases: wi
86 |
87 | Required: False
88 | Position: Named
89 | Default value: None
90 | Accept pipeline input: False
91 | Accept wildcard characters: False
92 | ```
93 |
94 | ### -WinRMPublic
95 | Enable WinRM Public access from all subnets.
96 | Default access is only enabled from local subnet.
97 | Required for workgroup computers.
98 |
99 | ```yaml
100 | Type: SwitchParameter
101 | Parameter Sets: (All)
102 | Aliases:
103 |
104 | Required: False
105 | Position: Named
106 | Default value: False
107 | Accept pipeline input: False
108 | Accept wildcard characters: False
109 | ```
110 |
111 | ### CommonParameters
112 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
113 |
114 | ## INPUTS
115 |
116 | ### None
117 |
118 | ## OUTPUTS
119 |
120 | ### System.Object
121 | ## NOTES
122 |
123 | ## RELATED LINKS
124 |
125 | [Author Blog](https://commandlinegeeks.wordpress.com/)
126 |
127 |
--------------------------------------------------------------------------------
/docs/Get-WUApiVersion.md:
--------------------------------------------------------------------------------
1 | ---
2 | external help file: PSWindowsUpdate.dll-Help.xml
3 | Module Name: PSWindowsUpdate
4 | online version: https://commandlinegeeks.wordpress.com/
5 | schema: 2.0.0
6 | ---
7 |
8 | # Get-WUApiVersion
9 |
10 | ## SYNOPSIS
11 | Get Windows Update Agent version.
12 |
13 | ## SYNTAX
14 |
15 | ```
16 | Get-WUApiVersion [-ComputerName ] [-SendReport] [-PSWUSettings ] [-Debuger] [-WhatIf]
17 | [-Confirm] []
18 | ```
19 |
20 | ## DESCRIPTION
21 | Use Get-WUAPIVersion cmdlet to get Windows Update Agent version.
22 |
23 | ## EXAMPLES
24 |
25 | ### Example 1
26 | ```
27 | Get Windows Update Agent version.
28 |
29 | Get-WUAPIVersion
30 |
31 | ComputerName PSWindowsUpdate ApiVersion WuapiDllVersion
32 | ------------ --------------- ---------- ---------------
33 | MG-PC 2.0 8.0 10.0.14393.1670
34 | ```
35 |
36 | ## PARAMETERS
37 |
38 | ### -ComputerName
39 | Specify one or more computer names for remote connection.
40 |
41 | ```yaml
42 | Type: String[]
43 | Parameter Sets: (All)
44 | Aliases:
45 |
46 | Required: False
47 | Position: Named
48 | Default value: None
49 | Accept pipeline input: True (ByPropertyName, ByValue)
50 | Accept wildcard characters: False
51 | ```
52 |
53 | ### -Confirm
54 | Prompts you for confirmation before running the cmdlet.
55 |
56 | ```yaml
57 | Type: SwitchParameter
58 | Parameter Sets: (All)
59 | Aliases: cf
60 |
61 | Required: False
62 | Position: Named
63 | Default value: None
64 | Accept pipeline input: False
65 | Accept wildcard characters: False
66 | ```
67 |
68 | ### -Debuger
69 | Debuger return original exceptions.
70 |
71 | ```yaml
72 | Type: SwitchParameter
73 | Parameter Sets: (All)
74 | Aliases:
75 |
76 | Required: False
77 | Position: Named
78 | Default value: False
79 | Accept pipeline input: False
80 | Accept wildcard characters: False
81 | ```
82 |
83 | ### -PSWUSettings
84 | Required parameter for -SendReport.
85 |
86 | Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";\[Port=25\];\[Subject="Alternative Subject"\];\[Properties="Alternative object properties"\];\[Style="Table|List"\]}
87 |
88 | Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";\[Port=25\]}"
89 |
90 | ```yaml
91 | Type: Hashtable
92 | Parameter Sets: (All)
93 | Aliases:
94 |
95 | Required: False
96 | Position: Named
97 | Default value: None
98 | Accept pipeline input: False
99 | Accept wildcard characters: False
100 | ```
101 |
102 | ### -SendReport
103 | Send report email to specific recipients.
104 |
105 | Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path.
106 |
107 | ```yaml
108 | Type: SwitchParameter
109 | Parameter Sets: (All)
110 | Aliases:
111 |
112 | Required: False
113 | Position: Named
114 | Default value: False
115 | Accept pipeline input: False
116 | Accept wildcard characters: False
117 | ```
118 |
119 | ### -WhatIf
120 | Shows what would happen if the cmdlet runs. The cmdlet is not run.
121 |
122 | ```yaml
123 | Type: SwitchParameter
124 | Parameter Sets: (All)
125 | Aliases: wi
126 |
127 | Required: False
128 | Position: Named
129 | Default value: None
130 | Accept pipeline input: False
131 | Accept wildcard characters: False
132 | ```
133 |
134 | ### CommonParameters
135 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
136 |
137 | ## INPUTS
138 |
139 | ### System.String[]
140 |
141 | ## OUTPUTS
142 |
143 | ### PSWindowsUpdate.AgentInfo
144 |
145 | ## NOTES
146 |
147 | ## RELATED LINKS
148 |
149 | [Author Blog](https://commandlinegeeks.wordpress.com/)
150 |
151 |
--------------------------------------------------------------------------------
/docs/Get-WUHistory.md:
--------------------------------------------------------------------------------
1 | ---
2 | external help file: PSWindowsUpdate.dll-Help.xml
3 | Module Name: PSWindowsUpdate
4 | online version: https://commandlinegeeks.wordpress.com/
5 | schema: 2.0.0
6 | ---
7 |
8 | # Get-WUHistory
9 |
10 | ## SYNOPSIS
11 | Get list of updates history.
12 |
13 | ## SYNTAX
14 |
15 | ```
16 | Get-WUHistory [-ComputerName ] [-SendReport] [-PSWUSettings ] [-MaxDate ]
17 | [-Last ] [-Debuger] [-WhatIf] [-Confirm] []
18 | ```
19 |
20 | ## DESCRIPTION
21 | Use function Get-WUHistory to get list of installed updates on specific machine.
22 |
23 | ## EXAMPLES
24 |
25 | ### Example 1
26 | ```
27 | Get Windows Update history.
28 |
29 | Get-WUHistory
30 |
31 | ComputerName Operationname Date KB Title
32 | ------------ ------------- ---- -- -----
33 | MG-PC Installation 30.08.2017 12:03:53 KB2267602 Definition Update for Windows Defender - KB2267602(Defini...
34 | MG-PC Installation 29.08.2017 11:49:50 KB3186568 Microsoft .NET Framework 4.7 for Windows 10 Version 1607 a...
35 | MG-PC Installation 29.08.2017 11:30:37 KB4035631 2017-08 Update for Windows Server 2016 for x64-based Syste...
36 | MG-PC Installation 29.08.2017 11:21:12 KB890830 Windows Malicious Software Removal Tool for Windows 8, 8.1...
37 | MG-PC Installation 29.08.2017 07:53:36 KB2267602 Definition Update for Windows Defender - KB2267602 (Defini...
38 | MG-PC Installation 27.08.2017 07:53:39 KB2267602 Definition Update for Windows Defender - KB2267602 (Defini...
39 | MG-PC Installation 25.08.2017 07:54:38 KB2267602 Definition Update for Windows Defender - KB2267602 (Defini...
40 | MG-PC Installation 23.08.2017 13:01:26 KB2267602 Definition Update for Windows Defender - KB2267602 (Defini...
41 | MG-PC Installation 23.08.2017 12:45:45 KB4023307 Security Update for Microsoft Silverlight (KB4023307)
42 | MG-PC Installation 23.08.2017 07:53:56 KB2267602 Definition Update for Windows Defender - KB2267602 (Defini...
43 | ```
44 |
45 | ### Example 2
46 | ```
47 | Get Windows Update Agent history for last 24h.
48 |
49 | Get-WUHistory -MaxDate (Get-Date).AddDays(-1)
50 |
51 | ComputerName Operationname Date KB Title
52 | ------------ ------------- ---- -- -----
53 | MG-PC Installation 30.08.2017 12:03:53 KB2267602 Definition Update for Windows Defender - KB2267602(Defini...
54 | ```
55 |
56 | ## PARAMETERS
57 |
58 | ### -ComputerName
59 | Specify one or more computer names for remote connection.
60 |
61 | ```yaml
62 | Type: String[]
63 | Parameter Sets: (All)
64 | Aliases:
65 |
66 | Required: False
67 | Position: Named
68 | Default value: None
69 | Accept pipeline input: True (ByPropertyName, ByValue)
70 | Accept wildcard characters: False
71 | ```
72 |
73 | ### -Confirm
74 | Prompts you for confirmation before running the cmdlet.
75 |
76 | ```yaml
77 | Type: SwitchParameter
78 | Parameter Sets: (All)
79 | Aliases: cf
80 |
81 | Required: False
82 | Position: Named
83 | Default value: None
84 | Accept pipeline input: False
85 | Accept wildcard characters: False
86 | ```
87 |
88 | ### -Debuger
89 | Debuger return original exceptions.
90 |
91 | ```yaml
92 | Type: SwitchParameter
93 | Parameter Sets: (All)
94 | Aliases:
95 |
96 | Required: False
97 | Position: Named
98 | Default value: False
99 | Accept pipeline input: False
100 | Accept wildcard characters: False
101 | ```
102 |
103 | ### -Last
104 | Last X history entry.
105 |
106 | ```yaml
107 | Type: Int32
108 | Parameter Sets: (All)
109 | Aliases:
110 |
111 | Required: False
112 | Position: Named
113 | Default value: 0
114 | Accept pipeline input: False
115 | Accept wildcard characters: False
116 | ```
117 |
118 | ### -MaxDate
119 | Filter results by date.
120 |
121 | ```yaml
122 | Type: DateTime
123 | Parameter Sets: (All)
124 | Aliases:
125 |
126 | Required: False
127 | Position: Named
128 | Default value: 01.01.0001 00:00:00
129 | Accept pipeline input: False
130 | Accept wildcard characters: False
131 | ```
132 |
133 | ### -PSWUSettings
134 | Required parameter for -SendReport.
135 |
136 | Passes the parameters (as hashtable) necessary to send the report: @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";\[Port=25\];\[Subject="Alternative Subject"\];\[Properties="Alternative object properties"\];\[Style="Table|List"\]}
137 |
138 | Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: Export-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";\[Port=25\]}"
139 |
140 | ```yaml
141 | Type: Hashtable
142 | Parameter Sets: (All)
143 | Aliases:
144 |
145 | Required: False
146 | Position: Named
147 | Default value: None
148 | Accept pipeline input: False
149 | Accept wildcard characters: False
150 | ```
151 |
152 | ### -SendReport
153 | Send report email to specific recipients.
154 |
155 | Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path.
156 |
157 | ```yaml
158 | Type: SwitchParameter
159 | Parameter Sets: (All)
160 | Aliases:
161 |
162 | Required: False
163 | Position: Named
164 | Default value: False
165 | Accept pipeline input: False
166 | Accept wildcard characters: False
167 | ```
168 |
169 | ### -WhatIf
170 | Shows what would happen if the cmdlet runs. The cmdlet is not run.
171 |
172 | ```yaml
173 | Type: SwitchParameter
174 | Parameter Sets: (All)
175 | Aliases: wi
176 |
177 | Required: False
178 | Position: Named
179 | Default value: None
180 | Accept pipeline input: False
181 | Accept wildcard characters: False
182 | ```
183 |
184 | ### CommonParameters
185 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
186 |
187 | ## INPUTS
188 |
189 | ### System.String[]
190 |
191 | ## OUTPUTS
192 |
193 | ### PSWindowsUpdate.History
194 |
195 | ## NOTES
196 |
197 | ## RELATED LINKS
198 |
199 | [Author Blog](https://commandlinegeeks.wordpress.com/)
200 |
201 |
--------------------------------------------------------------------------------
/docs/Get-WUInstallerStatus.md:
--------------------------------------------------------------------------------
1 | ---
2 | external help file: PSWindowsUpdate.dll-Help.xml
3 | Module Name: PSWindowsUpdate
4 | online version: https://commandlinegeeks.wordpress.com/
5 | schema: 2.0.0
6 | ---
7 |
8 | # Get-WUInstallerStatus
9 |
10 | ## SYNOPSIS
11 | Get Windows Update Installer status.
12 |
13 | ## SYNTAX
14 |
15 | ```
16 | Get-WUInstallerStatus [-SendReport] [-PSWUSettings ] [-Silent] [-Debuger] [-WhatIf] [-Confirm]
17 | []
18 | ```
19 |
20 | ## DESCRIPTION
21 | Use Get-WUInstallerStatus cmdlet to show Windows Update Installer status.
22 |
23 | ## EXAMPLES
24 |
25 | ### Example 1
26 | ```
27 | Check if Windows Update Installer is busy.
28 |
29 | Get-WUInstallerStatus
30 |
31 | ComputerName IsBusy
32 | ------------ ------
33 | MG-PC False
34 | ```
35 |
36 | ### Example 2
37 | ```
38 | Check if Windows Update Installer is busy in silent mode. Return only True (isBusy) or False (isFree).
39 |
40 | Get-WUInstallerStatus -Silent
41 |
42 | False
43 | ```
44 |
45 | ## PARAMETERS
46 |
47 | ### -Confirm
48 | Prompts you for confirmation before running the cmdlet.
49 |
50 | ```yaml
51 | Type: SwitchParameter
52 | Parameter Sets: (All)
53 | Aliases: cf
54 |
55 | Required: False
56 | Position: Named
57 | Default value: None
58 | Accept pipeline input: False
59 | Accept wildcard characters: False
60 | ```
61 |
62 | ### -Debuger
63 | Debuger return original exceptions.
64 |
65 | ```yaml
66 | Type: SwitchParameter
67 | Parameter Sets: (All)
68 | Aliases:
69 |
70 | Required: False
71 | Position: Named
72 | Default value: False
73 | Accept pipeline input: False
74 | Accept wildcard characters: False
75 | ```
76 |
77 | ### -PSWUSettings
78 | Required parameter for -SendReport.
79 |
80 | Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";\[Port=25\];\[Subject="Alternative Subject"\];\[Properties="Alternative object properties"\];\[Style="Table|List"\]}
81 |
82 | Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";\[Port=25\]}"
83 |
84 | ```yaml
85 | Type: Hashtable
86 | Parameter Sets: (All)
87 | Aliases:
88 |
89 | Required: False
90 | Position: Named
91 | Default value: None
92 | Accept pipeline input: False
93 | Accept wildcard characters: False
94 | ```
95 |
96 | ### -SendReport
97 | Send report email to specific recipients.
98 |
99 | Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path.
100 |
101 | ```yaml
102 | Type: SwitchParameter
103 | Parameter Sets: (All)
104 | Aliases:
105 |
106 | Required: False
107 | Position: Named
108 | Default value: False
109 | Accept pipeline input: False
110 | Accept wildcard characters: False
111 | ```
112 |
113 | ### -Silent
114 | Return true/false only.
115 |
116 | ```yaml
117 | Type: SwitchParameter
118 | Parameter Sets: (All)
119 | Aliases:
120 |
121 | Required: False
122 | Position: Named
123 | Default value: False
124 | Accept pipeline input: False
125 | Accept wildcard characters: False
126 | ```
127 |
128 | ### -WhatIf
129 | Shows what would happen if the cmdlet runs. The cmdlet is not run.
130 |
131 | ```yaml
132 | Type: SwitchParameter
133 | Parameter Sets: (All)
134 | Aliases: wi
135 |
136 | Required: False
137 | Position: Named
138 | Default value: None
139 | Accept pipeline input: False
140 | Accept wildcard characters: False
141 | ```
142 |
143 | ### CommonParameters
144 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
145 |
146 | ## INPUTS
147 |
148 | ### None
149 |
150 | ## OUTPUTS
151 |
152 | ### PSWindowsUpdate.InstallerStatus
153 |
154 | ## NOTES
155 |
156 | ## RELATED LINKS
157 |
158 | [Author Blog](https://commandlinegeeks.wordpress.com/)
159 |
160 |
--------------------------------------------------------------------------------
/docs/Get-WUJob.md:
--------------------------------------------------------------------------------
1 | ---
2 | external help file: PSWindowsUpdate.dll-Help.xml
3 | Module Name: PSWindowsUpdate
4 | online version: https://commandlinegeeks.wordpress.com/
5 | schema: 2.0.0
6 | ---
7 |
8 | # Get-WUJob
9 |
10 | ## SYNOPSIS
11 | Get invoked WUJob.
12 |
13 | ## SYNTAX
14 |
15 | ```
16 | Get-WUJob [-ComputerName ] [-Credential ] [-PSWUSettings ]
17 | [-TaskName ] [-ClearExpired] [-Debuger] [-WhatIf] [-Confirm] []
18 | ```
19 |
20 | ## DESCRIPTION
21 | Use Get-WUJob cmdlet to get invoked WUJob in Task Scheduler.
22 |
23 | ## EXAMPLES
24 |
25 | ### Example 1
26 | ```
27 | Get invoked WUJob on remote machine.
28 |
29 | Get-WUJob -ComputerName MG-PC
30 | ```
31 |
32 | ## PARAMETERS
33 |
34 | ### -ClearExpired
35 | Clear expired WUJob.
36 |
37 | ```yaml
38 | Type: SwitchParameter
39 | Parameter Sets: (All)
40 | Aliases:
41 |
42 | Required: False
43 | Position: Named
44 | Default value: False
45 | Accept pipeline input: False
46 | Accept wildcard characters: False
47 | ```
48 |
49 | ### -ComputerName
50 | Specify one or more computer names for remote connection.
51 |
52 | ```yaml
53 | Type: String[]
54 | Parameter Sets: (All)
55 | Aliases:
56 |
57 | Required: False
58 | Position: Named
59 | Default value: None
60 | Accept pipeline input: True (ByPropertyName, ByValue)
61 | Accept wildcard characters: False
62 | ```
63 |
64 | ### -Confirm
65 | Prompts you for confirmation before running the cmdlet.
66 |
67 | ```yaml
68 | Type: SwitchParameter
69 | Parameter Sets: (All)
70 | Aliases: cf
71 |
72 | Required: False
73 | Position: Named
74 | Default value: None
75 | Accept pipeline input: False
76 | Accept wildcard characters: False
77 | ```
78 |
79 | ### -Credential
80 | Specify alternative credential.
81 |
82 | ```yaml
83 | Type: PSCredential
84 | Parameter Sets: (All)
85 | Aliases:
86 |
87 | Required: False
88 | Position: Named
89 | Default value: None
90 | Accept pipeline input: False
91 | Accept wildcard characters: False
92 | ```
93 |
94 | ### -Debuger
95 | Debuger return original exceptions.
96 |
97 | ```yaml
98 | Type: SwitchParameter
99 | Parameter Sets: (All)
100 | Aliases:
101 |
102 | Required: False
103 | Position: Named
104 | Default value: False
105 | Accept pipeline input: False
106 | Accept wildcard characters: False
107 | ```
108 |
109 | ### -PSWUSettings
110 | Required parameter for -SendReport.
111 |
112 | Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";\[Port=25\];\[Subject="Alternative Subject"\];\[Properties="Alternative object properties"\];\[Style="Table|List"\]}
113 |
114 | Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";\[Port=25\]}"
115 |
116 | ```yaml
117 | Type: Hashtable
118 | Parameter Sets: (All)
119 | Aliases:
120 |
121 | Required: False
122 | Position: Named
123 | Default value: None
124 | Accept pipeline input: False
125 | Accept wildcard characters: False
126 | ```
127 |
128 | ### -TaskName
129 | Specify custom name for Task Scheduler job.
130 | Default is 'PSWindowsUpdate'.
131 |
132 | ```yaml
133 | Type: String
134 | Parameter Sets: (All)
135 | Aliases:
136 |
137 | Required: False
138 | Position: Named
139 | Default value: None
140 | Accept pipeline input: False
141 | Accept wildcard characters: False
142 | ```
143 |
144 | ### -WhatIf
145 | Shows what would happen if the cmdlet runs. The cmdlet is not run.
146 |
147 | ```yaml
148 | Type: SwitchParameter
149 | Parameter Sets: (All)
150 | Aliases: wi
151 |
152 | Required: False
153 | Position: Named
154 | Default value: None
155 | Accept pipeline input: False
156 | Accept wildcard characters: False
157 | ```
158 |
159 | ### CommonParameters
160 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
161 |
162 | ## INPUTS
163 |
164 | ### System.String[]
165 |
166 | ## OUTPUTS
167 |
168 | ### PSWindowsUpdate.WUJob
169 |
170 | ## NOTES
171 |
172 | ## RELATED LINKS
173 |
174 | [Author Blog](https://commandlinegeeks.wordpress.com/)
175 |
176 |
--------------------------------------------------------------------------------
/docs/Get-WULastResults.md:
--------------------------------------------------------------------------------
1 | ---
2 | external help file: PSWindowsUpdate.dll-Help.xml
3 | Module Name: PSWindowsUpdate
4 | online version: https://commandlinegeeks.wordpress.com/
5 | schema: 2.0.0
6 | ---
7 |
8 | # Get-WULastResults
9 |
10 | ## SYNOPSIS
11 | Get Windows Update results.
12 |
13 | ## SYNTAX
14 |
15 | ```
16 | Get-WULastResults [-ComputerName ] [-SendReport] [-PSWUSettings ] [-Debuger] [-WhatIf]
17 | [-Confirm] []
18 | ```
19 |
20 | ## DESCRIPTION
21 | Use Get-WULastResults cmdlet to get Windows Update LastSearchSuccessDate and LastInstallationSuccessDate.
22 |
23 | ## EXAMPLES
24 |
25 | ### Example 1
26 | ```
27 | Get last Windows Update results.
28 |
29 | Get-WULastResults
30 |
31 | ComputerName LastSearchSuccessDate LastInstallationSuccessDate
32 | ------------ --------------------- ---------------------------
33 | MG-PC 30.08.2017 14:02:11 03.07.2017 07:35:27
34 | ```
35 |
36 | ## PARAMETERS
37 |
38 | ### -ComputerName
39 | Specify one or more computer names for remote connection.
40 |
41 | ```yaml
42 | Type: String[]
43 | Parameter Sets: (All)
44 | Aliases:
45 |
46 | Required: False
47 | Position: Named
48 | Default value: None
49 | Accept pipeline input: True (ByPropertyName, ByValue)
50 | Accept wildcard characters: False
51 | ```
52 |
53 | ### -Confirm
54 | Prompts you for confirmation before running the cmdlet.
55 |
56 | ```yaml
57 | Type: SwitchParameter
58 | Parameter Sets: (All)
59 | Aliases: cf
60 |
61 | Required: False
62 | Position: Named
63 | Default value: None
64 | Accept pipeline input: False
65 | Accept wildcard characters: False
66 | ```
67 |
68 | ### -Debuger
69 | Debuger return original exceptions.
70 |
71 | ```yaml
72 | Type: SwitchParameter
73 | Parameter Sets: (All)
74 | Aliases:
75 |
76 | Required: False
77 | Position: Named
78 | Default value: False
79 | Accept pipeline input: False
80 | Accept wildcard characters: False
81 | ```
82 |
83 | ### -PSWUSettings
84 | Required parameter for -SendReport.
85 |
86 | Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";\[Port=25\];\[Subject="Alternative Subject"\];\[Properties="Alternative object properties"\];\[Style="Table|List"\]}
87 |
88 | Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";\[Port=25\]}"
89 |
90 | ```yaml
91 | Type: Hashtable
92 | Parameter Sets: (All)
93 | Aliases:
94 |
95 | Required: False
96 | Position: Named
97 | Default value: None
98 | Accept pipeline input: False
99 | Accept wildcard characters: False
100 | ```
101 |
102 | ### -SendReport
103 | Send report email to specific recipients.
104 |
105 | Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path.
106 |
107 | ```yaml
108 | Type: SwitchParameter
109 | Parameter Sets: (All)
110 | Aliases:
111 |
112 | Required: False
113 | Position: Named
114 | Default value: False
115 | Accept pipeline input: False
116 | Accept wildcard characters: False
117 | ```
118 |
119 | ### -WhatIf
120 | Shows what would happen if the cmdlet runs. The cmdlet is not run.
121 |
122 | ```yaml
123 | Type: SwitchParameter
124 | Parameter Sets: (All)
125 | Aliases: wi
126 |
127 | Required: False
128 | Position: Named
129 | Default value: None
130 | Accept pipeline input: False
131 | Accept wildcard characters: False
132 | ```
133 |
134 | ### CommonParameters
135 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
136 |
137 | ## INPUTS
138 |
139 | ### System.String[]
140 |
141 | ## OUTPUTS
142 |
143 | ### PSWindowsUpdate.LastResults
144 |
145 | ## NOTES
146 |
147 | ## RELATED LINKS
148 |
149 | [Author Blog](https://commandlinegeeks.wordpress.com/)
150 |
151 |
--------------------------------------------------------------------------------
/docs/Get-WUOfflineMSU.md:
--------------------------------------------------------------------------------
1 | ---
2 | external help file: PSWindowsUpdate.dll-Help.xml
3 | Module Name: PSWindowsUpdate
4 | online version: https://commandlinegeeks.wordpress.com/
5 | schema: 2.0.0
6 | ---
7 |
8 | # Get-WUOfflineMSU
9 |
10 | ## SYNOPSIS
11 | Get offline MSU package.
12 |
13 | ## SYNTAX
14 |
15 | ```
16 | Get-WUOfflineMSU -KBArticleID -Destination [-AcceptAll] [-WhatIf] [-Confirm]
17 | []
18 | ```
19 |
20 | ## DESCRIPTION
21 | Use Get-WUOfflineMSU cmdlet to download MSU package from Microsoft Update Catalog website.
22 |
23 | ## EXAMPLES
24 |
25 | ### Example 1
26 | ```
27 | Download package for KB4551762.
28 | PS> Get-WUOfflineMSU -KBArticleID 4551762 -Destination C:\Temp
29 |
30 | Confirm
31 | Are you sure you want to perform this action?
32 | Performing the operation "(20.04.2020 14:27:17) 2020-03 Cumulative Update for Windows Server, version 1909 for
33 | x64-based Systems (KB4551762)[354.4 MB]" on target "DESKTOP-GCQBCBS".
34 | [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): N
35 |
36 | Confirm
37 | Are you sure you want to perform this action?
38 | Performing the operation "(20.04.2020 14:27:19) 2020-03 Cumulative Update for Windows 10 Version 1909 for x64-based
39 | Systems(KB4551762) [354.4 MB]" on target "DESKTOP-GCQBCBS".
40 | [Y] Yes[A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y
41 |
42 | Confirm
43 | Are you sure you want to perform this action?
44 | Performing the operation "(20.04.2020 14:27:23) 2020-03 Cumulative Update for Windows 10 Version 1903 for x64-based
45 | Systems(KB4551762) [354.4 MB]" on target "DESKTOP-GCQBCBS".
46 | [Y] Yes[A]Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): L
47 |
48 | X Result Title LastUpdated Size
49 | - ------ ----- ----------- ----
50 | 1 Rejected 2020-03 Cumulative Update for Windows Server, version 1909 for x64-based Systems (... 3/12/2020 354.4 MB
51 | 1 Accepted 2020-03 Cumulative Update for Windows 10 Version 1909 for x64-based Systems (KB455... 3/12/2020 354.4 MB
52 | 1 Rejected 2020-03 Cumulative Update for Windows 10 Version 1903 for x64-based Systems (KB455... 3/12/2020 354.4 MB
53 | 1 Rejected 2020-03 Cumulative Update for Windows 10 Version 1909 for x86-based Systems (KB455... 3/12/2020 191.7 MB
54 | 1 Rejected 2020-03 Cumulative Update for Windows 10 Version 1903 for x86-based Systems (KB455... 3/12/2020 191.7 MB
55 | 1 Rejected 2020-03 Cumulative Update for Windows 10 Version 1909 for ARM64-based Systems (KB4... 3/12/2020 396.1 MB
56 | 1 Rejected 2020-03 Cumulative Update for Windows Server, version 1903 for x64-based Systems (... 3/12/2020 354.4 MB
57 | 1 Rejected 2020-03 Cumulative Update for Windows 10 Version 1903 for ARM64-based Systems (KB4... 3/12/2020 396.1 MB
58 | 2 Downloaded 2020-03 Cumulative Update for Windows 10 Version 1909 for x64-based Systems (KB455... 3/12/2020 354.4 MB
59 |
60 | PS> Get-ChildItem C:\Temp
61 | Directory: C:\Temp
62 |
63 | Mode LastWriteTime Length Name
64 | ---- ------------- ------ ----
65 | -a---- 12.03.2020 07:03 371656774 windows10.0-kb4551762-x64_dacef156c781f2018d94d5a5286076610ba97279.msu
66 | ```
67 |
68 | ## PARAMETERS
69 |
70 | ### -AcceptAll
71 | Do not ask confirmation for download updates.
72 |
73 | ```yaml
74 | Type: SwitchParameter
75 | Parameter Sets: (All)
76 | Aliases:
77 |
78 | Required: False
79 | Position: Named
80 | Default value: False
81 | Accept pipeline input: False
82 | Accept wildcard characters: False
83 | ```
84 |
85 | ### -Confirm
86 | Prompts you for confirmation before running the cmdlet.
87 |
88 | ```yaml
89 | Type: SwitchParameter
90 | Parameter Sets: (All)
91 | Aliases: cf
92 |
93 | Required: False
94 | Position: Named
95 | Default value: None
96 | Accept pipeline input: False
97 | Accept wildcard characters: False
98 | ```
99 |
100 | ### -Destination
101 | Destination for downloaded files.
102 |
103 | ```yaml
104 | Type: String
105 | Parameter Sets: (All)
106 | Aliases:
107 |
108 | Required: True
109 | Position: Named
110 | Default value: None
111 | Accept pipeline input: False
112 | Accept wildcard characters: False
113 | ```
114 |
115 | ### -KBArticleID
116 | Finds updates that contain a KBArticleID.
117 |
118 | ```yaml
119 | Type: String
120 | Parameter Sets: (All)
121 | Aliases:
122 |
123 | Required: True
124 | Position: Named
125 | Default value: None
126 | Accept pipeline input: True (ByPropertyName, ByValue)
127 | Accept wildcard characters: False
128 | ```
129 |
130 | ### -WhatIf
131 | Shows what would happen if the cmdlet runs. The cmdlet is not run.
132 |
133 | ```yaml
134 | Type: SwitchParameter
135 | Parameter Sets: (All)
136 | Aliases: wi
137 |
138 | Required: False
139 | Position: Named
140 | Default value: None
141 | Accept pipeline input: False
142 | Accept wildcard characters: False
143 | ```
144 |
145 | ### CommonParameters
146 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
147 |
148 | ## INPUTS
149 |
150 | ### System.String
151 |
152 | ## OUTPUTS
153 |
154 | ### PSWindowsUpdate.OfflineMSU
155 |
156 | ## NOTES
157 |
158 | ## RELATED LINKS
159 |
160 | [Author Blog](https://commandlinegeeks.wordpress.com/)
161 |
162 |
--------------------------------------------------------------------------------
/docs/Get-WURebootStatus.md:
--------------------------------------------------------------------------------
1 | ---
2 | external help file: PSWindowsUpdate.dll-Help.xml
3 | Module Name: PSWindowsUpdate
4 | online version: https://commandlinegeeks.wordpress.com/
5 | schema: 2.0.0
6 | ---
7 |
8 | # Get-WURebootStatus
9 |
10 | ## SYNOPSIS
11 | Get Windows Update reboot status.
12 |
13 | ## SYNTAX
14 |
15 | ### ManualReboot (Default)
16 | ```
17 | Get-WURebootStatus [-ComputerName ] [-SendReport] [-PSWUSettings ] [-Silent] [-Debuger]
18 | [-WhatIf] [-Confirm] []
19 | ```
20 |
21 | ### AutoReboot
22 | ```
23 | Get-WURebootStatus [-ComputerName ] [-SendReport] [-PSWUSettings ] [-Silent] [-AutoReboot]
24 | [-Debuger] [-WhatIf] [-Confirm] []
25 | ```
26 |
27 | ### ScheduleReboot
28 | ```
29 | Get-WURebootStatus [-ComputerName ] [-SendReport] [-PSWUSettings ] [-Silent]
30 | -ScheduleReboot [-Debuger] [-WhatIf] [-Confirm] []
31 | ```
32 |
33 | ### CancelReboot
34 | ```
35 | Get-WURebootStatus [-ComputerName ] [-SendReport] [-PSWUSettings ] [-Silent]
36 | [-CancelReboot] [-Debuger] [-WhatIf] [-Confirm] []
37 | ```
38 |
39 | ## DESCRIPTION
40 | Use Get-WURebootStatus cmdlet to check if reboot is needed.
41 |
42 | ## EXAMPLES
43 |
44 | ### Example 1
45 | ```
46 | Check if restart is necessary. If yes, ask to do this or don't.
47 |
48 | Get-WURebootStatus
49 |
50 | Reboot is required. Do it now ? [Y/N] (default is 'N')
51 | ComputerName RebootRequired RebootScheduled
52 | ------------ -------------- ---------------
53 | MG-PC True
54 | ```
55 |
56 | ### Example 2
57 | ```
58 | Check if restart is necessary. If yes, then shedule it.
59 |
60 | Get-WURebootStatus -ScheduleReboot (Get-Date -Hour 18 -Minute 0 -Second 0)
61 |
62 | ComputerName RebootRequired RebootScheduled
63 | ------------ -------------- ---------------
64 | MG-PC True 31.08.2017 18:00:00
65 | ```
66 |
67 | ## PARAMETERS
68 |
69 | ### -AutoReboot
70 | Do not ask for reboot if it needed, but do it now.
71 |
72 | ```yaml
73 | Type: SwitchParameter
74 | Parameter Sets: AutoReboot
75 | Aliases:
76 |
77 | Required: True
78 | Position: Named
79 | Default value: False
80 | Accept pipeline input: False
81 | Accept wildcard characters: False
82 | ```
83 |
84 | ### -CancelReboot
85 | Cancel scheduled reboot.
86 |
87 | ```yaml
88 | Type: SwitchParameter
89 | Parameter Sets: CancelReboot
90 | Aliases:
91 |
92 | Required: True
93 | Position: Named
94 | Default value: False
95 | Accept pipeline input: False
96 | Accept wildcard characters: False
97 | ```
98 |
99 | ### -ComputerName
100 | Specify one or more computer names for remote connection.
101 |
102 | ```yaml
103 | Type: String[]
104 | Parameter Sets: (All)
105 | Aliases:
106 |
107 | Required: False
108 | Position: Named
109 | Default value: None
110 | Accept pipeline input: False
111 | Accept wildcard characters: False
112 | ```
113 |
114 | ### -Confirm
115 | Prompts you for confirmation before running the cmdlet.
116 |
117 | ```yaml
118 | Type: SwitchParameter
119 | Parameter Sets: (All)
120 | Aliases: cf
121 |
122 | Required: False
123 | Position: Named
124 | Default value: None
125 | Accept pipeline input: False
126 | Accept wildcard characters: False
127 | ```
128 |
129 | ### -Debuger
130 | Debuger return original exceptions.
131 |
132 | ```yaml
133 | Type: SwitchParameter
134 | Parameter Sets: (All)
135 | Aliases:
136 |
137 | Required: False
138 | Position: Named
139 | Default value: False
140 | Accept pipeline input: False
141 | Accept wildcard characters: False
142 | ```
143 |
144 | ### -PSWUSettings
145 | Required parameter for -SendReport.
146 |
147 | Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";\[Port=25\];\[Subject="Alternative Subject"\];\[Properties="Alternative object properties"\];\[Style="Table|List"\]}
148 |
149 | Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";\[Port=25\]}"
150 |
151 | ```yaml
152 | Type: Hashtable
153 | Parameter Sets: (All)
154 | Aliases:
155 |
156 | Required: False
157 | Position: Named
158 | Default value: None
159 | Accept pipeline input: False
160 | Accept wildcard characters: False
161 | ```
162 |
163 | ### -ScheduleReboot
164 | Specify schedule time for reboot.
165 |
166 | ```yaml
167 | Type: DateTime
168 | Parameter Sets: ScheduleReboot
169 | Aliases:
170 |
171 | Required: True
172 | Position: Named
173 | Default value: 01.01.0001 00:00:00
174 | Accept pipeline input: False
175 | Accept wildcard characters: False
176 | ```
177 |
178 | ### -SendReport
179 | Send report email to specific recipients.
180 |
181 | Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path.
182 |
183 | ```yaml
184 | Type: SwitchParameter
185 | Parameter Sets: (All)
186 | Aliases:
187 |
188 | Required: False
189 | Position: Named
190 | Default value: False
191 | Accept pipeline input: False
192 | Accept wildcard characters: False
193 | ```
194 |
195 | ### -Silent
196 | Return true/false only.
197 |
198 | ```yaml
199 | Type: SwitchParameter
200 | Parameter Sets: (All)
201 | Aliases:
202 |
203 | Required: False
204 | Position: Named
205 | Default value: False
206 | Accept pipeline input: True (ByPropertyName, ByValue)
207 | Accept wildcard characters: False
208 | ```
209 |
210 | ### -WhatIf
211 | Shows what would happen if the cmdlet runs. The cmdlet is not run.
212 |
213 | ```yaml
214 | Type: SwitchParameter
215 | Parameter Sets: (All)
216 | Aliases: wi
217 |
218 | Required: False
219 | Position: Named
220 | Default value: None
221 | Accept pipeline input: False
222 | Accept wildcard characters: False
223 | ```
224 |
225 | ### CommonParameters
226 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
227 |
228 | ## INPUTS
229 |
230 | ### System.Management.Automation.SwitchParameter
231 |
232 | ## OUTPUTS
233 |
234 | ### PSWindowsUpdate.RebootStatus
235 |
236 | ## NOTES
237 |
238 | ## RELATED LINKS
239 |
240 | [Author Blog](https://commandlinegeeks.wordpress.com/)
241 |
242 |
--------------------------------------------------------------------------------
/docs/Get-WUServiceManager.md:
--------------------------------------------------------------------------------
1 | ---
2 | external help file: PSWindowsUpdate.dll-Help.xml
3 | Module Name: PSWindowsUpdate
4 | online version: https://commandlinegeeks.wordpress.com/
5 | schema: 2.0.0
6 | ---
7 |
8 | # Get-WUServiceManager
9 |
10 | ## SYNOPSIS
11 | Get Service Manager configuration.
12 |
13 | ## SYNTAX
14 |
15 | ```
16 | Get-WUServiceManager [-ComputerName ] [-Credential ] [-SendReport]
17 | [-PSWUSettings ] [-ServiceID ] [-Debuger] [-WhatIf] [-Confirm] []
18 | ```
19 |
20 | ## DESCRIPTION
21 | Use Get-WUServiceManager cmdlet to get available configuration of update services.
22 |
23 | ## EXAMPLES
24 |
25 | ### Example 1
26 | ```
27 | Check currently available Windows Update Services on machine.
28 |
29 | Get-WUServiceManager
30 |
31 | ServiceID IsManaged IsDefault Name
32 | --------- --------- --------- ----
33 | 9482f4b4-e343-43b6-b170-9a65bc822c77 False False Windows Update
34 | 7971f918-a847-4430-9279-4a52d1efe18d False False Microsoft Update
35 | 3da21691-e39d-4da6-8a4b-b43877bcb1b7 True True Windows Server Update Service
36 | 13df3d8f-78d7-4eb8-bb9c-2a101870d350 False False Offline Sync Service2
37 | a8f3b5e6-fb1f-4814-a047-2257d39c2460 False False Offline Sync Service
38 | ```
39 |
40 | ## PARAMETERS
41 |
42 | ### -ComputerName
43 | Specify one or more computer names for remote connection.
44 |
45 | ```yaml
46 | Type: String[]
47 | Parameter Sets: (All)
48 | Aliases:
49 |
50 | Required: False
51 | Position: Named
52 | Default value: None
53 | Accept pipeline input: True (ByPropertyName, ByValue)
54 | Accept wildcard characters: False
55 | ```
56 |
57 | ### -Confirm
58 | Prompts you for confirmation before running the cmdlet.
59 |
60 | ```yaml
61 | Type: SwitchParameter
62 | Parameter Sets: (All)
63 | Aliases: cf
64 |
65 | Required: False
66 | Position: Named
67 | Default value: None
68 | Accept pipeline input: False
69 | Accept wildcard characters: False
70 | ```
71 |
72 | ### -Credential
73 | Specify alternative credential.
74 |
75 | ```yaml
76 | Type: PSCredential
77 | Parameter Sets: (All)
78 | Aliases:
79 |
80 | Required: False
81 | Position: Named
82 | Default value: None
83 | Accept pipeline input: False
84 | Accept wildcard characters: False
85 | ```
86 |
87 | ### -Debuger
88 | Debuger return original exceptions.
89 |
90 | ```yaml
91 | Type: SwitchParameter
92 | Parameter Sets: (All)
93 | Aliases:
94 |
95 | Required: False
96 | Position: Named
97 | Default value: False
98 | Accept pipeline input: False
99 | Accept wildcard characters: False
100 | ```
101 |
102 | ### -PSWUSettings
103 | Required parameter for -SendReport.
104 |
105 | Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";\[Port=25\];\[Subject="Alternative Subject"\];\[Properties="Alternative object properties"\];\[Style="Table|List"\]}
106 |
107 | Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";\[Port=25\]}"
108 |
109 | ```yaml
110 | Type: Hashtable
111 | Parameter Sets: (All)
112 | Aliases:
113 |
114 | Required: False
115 | Position: Named
116 | Default value: None
117 | Accept pipeline input: False
118 | Accept wildcard characters: False
119 | ```
120 |
121 | ### -SendReport
122 | Send report email to specific recipients.
123 |
124 | Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path.
125 |
126 | ```yaml
127 | Type: SwitchParameter
128 | Parameter Sets: (All)
129 | Aliases:
130 |
131 | Required: False
132 | Position: Named
133 | Default value: False
134 | Accept pipeline input: False
135 | Accept wildcard characters: False
136 | ```
137 |
138 | ### -ServiceID
139 | Get specific Service Manager if it's available.
140 |
141 | ```yaml
142 | Type: String
143 | Parameter Sets: (All)
144 | Aliases:
145 |
146 | Required: False
147 | Position: Named
148 | Default value: None
149 | Accept pipeline input: False
150 | Accept wildcard characters: False
151 | ```
152 |
153 | ### -WhatIf
154 | Shows what would happen if the cmdlet runs. The cmdlet is not run.
155 |
156 | ```yaml
157 | Type: SwitchParameter
158 | Parameter Sets: (All)
159 | Aliases: wi
160 |
161 | Required: False
162 | Position: Named
163 | Default value: None
164 | Accept pipeline input: False
165 | Accept wildcard characters: False
166 | ```
167 |
168 | ### CommonParameters
169 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
170 |
171 | ## INPUTS
172 |
173 | ### System.String[]
174 |
175 | ## OUTPUTS
176 |
177 | ### PSWindowsUpdate.ServiceManager
178 |
179 | ## NOTES
180 |
181 | ## RELATED LINKS
182 |
183 | [Author Blog](https://commandlinegeeks.wordpress.com/)
184 |
185 |
--------------------------------------------------------------------------------
/docs/Get-WUSettings.md:
--------------------------------------------------------------------------------
1 | ---
2 | external help file: PSWindowsUpdate.dll-Help.xml
3 | Module Name: PSWindowsUpdate
4 | online version: https://commandlinegeeks.wordpress.com/
5 | schema: 2.0.0
6 | ---
7 |
8 | # Get-WUSettings
9 |
10 | ## SYNOPSIS
11 | Get Windows Update Client settings.
12 |
13 | ## SYNTAX
14 |
15 | ```
16 | Get-WUSettings [-ComputerName ] [-SendReport] [-PSWUSettings ] [-Debuger] [-WhatIf]
17 | [-Confirm] []
18 | ```
19 |
20 | ## DESCRIPTION
21 | Use Get-WUSettings cmdlet to get current configuration of Windows Update Client.
22 |
23 | ## EXAMPLES
24 |
25 | ### Example 1
26 | ```
27 | Get current Windows Update Client configuration.
28 |
29 | Get-WUSettings
30 |
31 | ComputerName : MG-PC
32 | AcceptTrustedPublisherCerts : 0
33 | WUServer : https://wsus.commandlinegeeks.com
34 | WUStatusServer : https://wsus.commandlinegeeks.com
35 | DetectionFrequencyEnabled : 1
36 | DetectionFrequency : 2
37 | NoAutoRebootWithLoggedOnUsers : 1
38 | RebootRelaunchTimeoutEnabled : 1
39 | RebootRelaunchTimeout : 240
40 | IncludeRecommendedUpdates : 0
41 | NoAutoUpdate : 0
42 | AUOptions : 2 - Notify before download
43 | ScheduledInstallDay : 0 - Every Day
44 | ScheduledInstallTime : 4
45 | UseWUServer : 1
46 | ```
47 |
48 | ## PARAMETERS
49 |
50 | ### -ComputerName
51 | Specify one or more computer names for remote connection.
52 |
53 | ```yaml
54 | Type: String[]
55 | Parameter Sets: (All)
56 | Aliases:
57 |
58 | Required: False
59 | Position: Named
60 | Default value: None
61 | Accept pipeline input: True (ByPropertyName, ByValue)
62 | Accept wildcard characters: False
63 | ```
64 |
65 | ### -Confirm
66 | Prompts you for confirmation before running the cmdlet.
67 |
68 | ```yaml
69 | Type: SwitchParameter
70 | Parameter Sets: (All)
71 | Aliases: cf
72 |
73 | Required: False
74 | Position: Named
75 | Default value: None
76 | Accept pipeline input: False
77 | Accept wildcard characters: False
78 | ```
79 |
80 | ### -Debuger
81 | Debuger return original exceptions.
82 |
83 | ```yaml
84 | Type: SwitchParameter
85 | Parameter Sets: (All)
86 | Aliases:
87 |
88 | Required: False
89 | Position: Named
90 | Default value: False
91 | Accept pipeline input: False
92 | Accept wildcard characters: False
93 | ```
94 |
95 | ### -PSWUSettings
96 | Required parameter for -SendReport.
97 |
98 | Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";\[Port=25\];\[Subject="Alternative Subject"\];\[Properties="Alternative object properties"\];\[Style="Table|List"\]}
99 |
100 | Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";\[Port=25\]}"
101 |
102 | ```yaml
103 | Type: Hashtable
104 | Parameter Sets: (All)
105 | Aliases:
106 |
107 | Required: False
108 | Position: Named
109 | Default value: None
110 | Accept pipeline input: False
111 | Accept wildcard characters: False
112 | ```
113 |
114 | ### -SendReport
115 | Send report email to specific recipients.
116 |
117 | Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path.
118 |
119 | ```yaml
120 | Type: SwitchParameter
121 | Parameter Sets: (All)
122 | Aliases:
123 |
124 | Required: False
125 | Position: Named
126 | Default value: False
127 | Accept pipeline input: False
128 | Accept wildcard characters: False
129 | ```
130 |
131 | ### -WhatIf
132 | Shows what would happen if the cmdlet runs. The cmdlet is not run.
133 |
134 | ```yaml
135 | Type: SwitchParameter
136 | Parameter Sets: (All)
137 | Aliases: wi
138 |
139 | Required: False
140 | Position: Named
141 | Default value: None
142 | Accept pipeline input: False
143 | Accept wildcard characters: False
144 | ```
145 |
146 | ### CommonParameters
147 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
148 |
149 | ## INPUTS
150 |
151 | ### System.String[]
152 |
153 | ## OUTPUTS
154 |
155 | ### PSWindowsUpdate.WUSettings
156 |
157 | ## NOTES
158 |
159 | ## RELATED LINKS
160 |
161 | [Author Blog](https://commandlinegeeks.wordpress.com/)
162 |
163 |
--------------------------------------------------------------------------------
/docs/Get-WUTest.md:
--------------------------------------------------------------------------------
1 | ---
2 | external help file: PSWindowsUpdate.dll-Help.xml
3 | Module Name: PSWindowsUpdate
4 | online version: https://commandlinegeeks.wordpress.com/
5 | schema: 2.0.0
6 | ---
7 |
8 | # Get-WUTest
9 |
10 | ## SYNOPSIS
11 | Test cmdlet.
12 |
13 | ## SYNTAX
14 |
15 | ```
16 | Get-WUTest [-ComputerName ] [-Credential ] [-SendReport] [-PSWUSettings ]
17 | [-Debuger] [-TestParam ] [-WhatIf] [-Confirm] []
18 | ```
19 |
20 | ## DESCRIPTION
21 | Use Get-WUTest cmdlet to test.
22 |
23 | ## EXAMPLES
24 |
25 | ### Example 1
26 | ```
27 | Test.
28 |
29 | Get-WUTest
30 | ```
31 |
32 | ## PARAMETERS
33 |
34 | ### -ComputerName
35 | Specify one or more computer names for remote connection.
36 |
37 | ```yaml
38 | Type: String[]
39 | Parameter Sets: (All)
40 | Aliases:
41 |
42 | Required: False
43 | Position: Named
44 | Default value: None
45 | Accept pipeline input: True (ByPropertyName, ByValue)
46 | Accept wildcard characters: False
47 | ```
48 |
49 | ### -Confirm
50 | Prompts you for confirmation before running the cmdlet.
51 |
52 | ```yaml
53 | Type: SwitchParameter
54 | Parameter Sets: (All)
55 | Aliases: cf
56 |
57 | Required: False
58 | Position: Named
59 | Default value: None
60 | Accept pipeline input: False
61 | Accept wildcard characters: False
62 | ```
63 |
64 | ### -Credential
65 | Specify alternative credential.
66 |
67 | ```yaml
68 | Type: PSCredential
69 | Parameter Sets: (All)
70 | Aliases:
71 |
72 | Required: False
73 | Position: Named
74 | Default value: None
75 | Accept pipeline input: False
76 | Accept wildcard characters: False
77 | ```
78 |
79 | ### -Debuger
80 | Debuger return original exceptions.
81 |
82 | ```yaml
83 | Type: SwitchParameter
84 | Parameter Sets: (All)
85 | Aliases:
86 |
87 | Required: False
88 | Position: Named
89 | Default value: False
90 | Accept pipeline input: False
91 | Accept wildcard characters: False
92 | ```
93 |
94 | ### -PSWUSettings
95 | Required parameter for -SendReport.
96 |
97 | Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";\[Port=25\];\[Subject="Alternative Subject"\];\[Properties="Alternative object properties"\];\[Style="Table|List"\]}
98 |
99 | Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";\[Port=25\]}"
100 |
101 | ```yaml
102 | Type: Hashtable
103 | Parameter Sets: (All)
104 | Aliases:
105 |
106 | Required: False
107 | Position: Named
108 | Default value: None
109 | Accept pipeline input: False
110 | Accept wildcard characters: False
111 | ```
112 |
113 | ### -SendReport
114 | Send report email to specific recipients.
115 |
116 | Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path.
117 |
118 | ```yaml
119 | Type: SwitchParameter
120 | Parameter Sets: (All)
121 | Aliases:
122 |
123 | Required: False
124 | Position: Named
125 | Default value: False
126 | Accept pipeline input: False
127 | Accept wildcard characters: False
128 | ```
129 |
130 | ### -TestParam
131 | Test parameter.
132 |
133 | ```yaml
134 | Type: String
135 | Parameter Sets: (All)
136 | Aliases:
137 |
138 | Required: False
139 | Position: Named
140 | Default value: None
141 | Accept pipeline input: False
142 | Accept wildcard characters: False
143 | ```
144 |
145 | ### -WhatIf
146 | Shows what would happen if the cmdlet runs. The cmdlet is not run.
147 |
148 | ```yaml
149 | Type: SwitchParameter
150 | Parameter Sets: (All)
151 | Aliases: wi
152 |
153 | Required: False
154 | Position: Named
155 | Default value: None
156 | Accept pipeline input: False
157 | Accept wildcard characters: False
158 | ```
159 |
160 | ### CommonParameters
161 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
162 |
163 | ## INPUTS
164 |
165 | ### System.String[]
166 |
167 | ## OUTPUTS
168 |
169 | ### System.Object
170 | ## NOTES
171 |
172 | ## RELATED LINKS
173 |
174 | [Author Blog](https://commandlinegeeks.wordpress.com/)
175 |
176 |
--------------------------------------------------------------------------------
/docs/Invoke-WUJob.md:
--------------------------------------------------------------------------------
1 | ---
2 | external help file: PSWindowsUpdate.dll-Help.xml
3 | Module Name: PSWindowsUpdate
4 | online version: https://commandlinegeeks.wordpress.com/
5 | schema: 2.0.0
6 | ---
7 |
8 | # Invoke-WUJob
9 |
10 | ## SYNOPSIS
11 | Invoke WUJobs by Task Schduler.
12 |
13 | ## SYNTAX
14 |
15 | ### RunNow (Default)
16 | ```
17 | Invoke-WUJob [-ComputerName ] [-Credential ] [-TaskName ] [-Hidden]
18 | [-EndBoundary ] [-RunNow] [-Script ] [-Force] [-Debuger] [-WhatIf] [-Confirm]
19 | []
20 | ```
21 |
22 | ### TriggerDate
23 | ```
24 | Invoke-WUJob [-ComputerName ] [-Credential ] [-TaskName ] [-Hidden]
25 | [-EndBoundary ] -TriggerDate [-Script ] [-Force] [-Debuger] [-WhatIf] [-Confirm]
26 | []
27 | ```
28 |
29 | ### TriggerAtStart
30 | ```
31 | Invoke-WUJob [-ComputerName ] [-Credential ] [-TaskName ] [-Hidden]
32 | [-EndBoundary ] [-TriggerAtStart] [-Script ] [-Force] [-Debuger] [-WhatIf] [-Confirm]
33 | []
34 | ```
35 |
36 | ## DESCRIPTION
37 | Use Invoke-WUJobs cmdlet to invoke PSWindowsUpdate actions remotly.
38 | It Based on TaskScheduler because CreateUpdateDownloader() and CreateUpdateInstaller() methods can't be called from a remote computer - E_ACCESSDENIED.
39 |
40 | Note: Because we do not have the ability to interact, is recommended use -AcceptAll for Install-WindowsUpdate.
41 |
42 | ## EXAMPLES
43 |
44 | ### Example 1
45 | ```
46 | Invoke Install-WindowsUpdate on remote machine today at 6:00 PM.
47 |
48 | Invoke-WUJob -ComputerName MG-PC -Script "ipmo PSWindowsUpdate; Install-WindowsUpdate -AcceptAll | Out-File C:\PSWindowsUpdate.log" -TriggerDate (Get-Date -Hour 18 -Minute 0 -Second 0)
49 |
50 | Confirm
51 | Are you sure you want to perform this action?
52 | Performing the operation "Invoke WU job: powershell.exe -Command "ipmo PSWindowsUpdate; Install-WindowsUpdate -AcceptAll | Out-File C:\PSWindowsUpdate.log"" on target "MG-PC".
53 | [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): Y
54 | ```
55 |
56 | ## PARAMETERS
57 |
58 | ### -ComputerName
59 | Specify one or more computer names for remote connection.
60 |
61 | ```yaml
62 | Type: String[]
63 | Parameter Sets: (All)
64 | Aliases:
65 |
66 | Required: False
67 | Position: Named
68 | Default value: None
69 | Accept pipeline input: True (ByPropertyName, ByValue)
70 | Accept wildcard characters: False
71 | ```
72 |
73 | ### -Confirm
74 | Prompts you for confirmation before running the cmdlet.
75 |
76 | ```yaml
77 | Type: SwitchParameter
78 | Parameter Sets: (All)
79 | Aliases: cf
80 |
81 | Required: False
82 | Position: Named
83 | Default value: None
84 | Accept pipeline input: False
85 | Accept wildcard characters: False
86 | ```
87 |
88 | ### -Credential
89 | Specify alternative credential.
90 |
91 | ```yaml
92 | Type: PSCredential
93 | Parameter Sets: (All)
94 | Aliases:
95 |
96 | Required: False
97 | Position: Named
98 | Default value: None
99 | Accept pipeline input: False
100 | Accept wildcard characters: False
101 | ```
102 |
103 | ### -Debuger
104 | Debuger return original exceptions.
105 |
106 | ```yaml
107 | Type: SwitchParameter
108 | Parameter Sets: (All)
109 | Aliases:
110 |
111 | Required: False
112 | Position: Named
113 | Default value: False
114 | Accept pipeline input: False
115 | Accept wildcard characters: False
116 | ```
117 |
118 | ### -EndBoundary
119 | Specify EndBoundary for Task Scheduler trigger.
120 |
121 | ```yaml
122 | Type: DateTime
123 | Parameter Sets: (All)
124 | Aliases:
125 |
126 | Required: False
127 | Position: Named
128 | Default value: 01.01.0001 00:00:00
129 | Accept pipeline input: False
130 | Accept wildcard characters: False
131 | ```
132 |
133 | ### -Force
134 | Force update old Task Scheduler Job if it's available.
135 |
136 | ```yaml
137 | Type: SwitchParameter
138 | Parameter Sets: (All)
139 | Aliases:
140 |
141 | Required: False
142 | Position: Named
143 | Default value: False
144 | Accept pipeline input: False
145 | Accept wildcard characters: False
146 | ```
147 |
148 | ### -Hidden
149 | Specify if task must be hidden.
150 | Default is true.
151 |
152 | ```yaml
153 | Type: SwitchParameter
154 | Parameter Sets: (All)
155 | Aliases:
156 |
157 | Required: False
158 | Position: Named
159 | Default value: True
160 | Accept pipeline input: False
161 | Accept wildcard characters: False
162 | ```
163 |
164 | ### -RunNow
165 | Run Task Scheduler job immediately.
166 |
167 | ```yaml
168 | Type: SwitchParameter
169 | Parameter Sets: RunNow
170 | Aliases:
171 |
172 | Required: True
173 | Position: Named
174 | Default value: False
175 | Accept pipeline input: False
176 | Accept wildcard characters: False
177 | ```
178 |
179 | ### -Script
180 | Specify PowerShell script that you what to run.
181 | Default is {ipmo PSWindowsUpdate; Get-WindowsUpdate -AcceptAll -Install | Out-File $Env:TEMP\PSWindowsUpdate.log}
182 |
183 | ```yaml
184 | Type: String
185 | Parameter Sets: (All)
186 | Aliases:
187 |
188 | Required: False
189 | Position: Named
190 | Default value: Ipmo PSWindowsUpdate; Get-WindowsUpdate -AcceptAll -Install | Out-File $Env:TEMP\PSWindowsUpdate.log
191 | Accept pipeline input: False
192 | Accept wildcard characters: False
193 | ```
194 |
195 | ### -TaskName
196 | Specify custom name for Task Scheduler job.
197 | Default is 'PSWindowsUpdate'.
198 |
199 | ```yaml
200 | Type: String
201 | Parameter Sets: (All)
202 | Aliases:
203 |
204 | Required: False
205 | Position: Named
206 | Default value: PSWindowsUpdate
207 | Accept pipeline input: False
208 | Accept wildcard characters: False
209 | ```
210 |
211 | ### -TriggerAtStart
212 | Specify system startup trigger for Task Scheduler job.
213 |
214 | ```yaml
215 | Type: SwitchParameter
216 | Parameter Sets: TriggerAtStart
217 | Aliases:
218 |
219 | Required: True
220 | Position: Named
221 | Default value: False
222 | Accept pipeline input: False
223 | Accept wildcard characters: False
224 | ```
225 |
226 | ### -TriggerDate
227 | Specify Time trigger for Task Scheduler job.
228 |
229 | ```yaml
230 | Type: DateTime
231 | Parameter Sets: TriggerDate
232 | Aliases:
233 |
234 | Required: True
235 | Position: Named
236 | Default value: 01.01.0001 00:00:00
237 | Accept pipeline input: False
238 | Accept wildcard characters: False
239 | ```
240 |
241 | ### -WhatIf
242 | Shows what would happen if the cmdlet runs. The cmdlet is not run.
243 |
244 | ```yaml
245 | Type: SwitchParameter
246 | Parameter Sets: (All)
247 | Aliases: wi
248 |
249 | Required: False
250 | Position: Named
251 | Default value: None
252 | Accept pipeline input: False
253 | Accept wildcard characters: False
254 | ```
255 |
256 | ### CommonParameters
257 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
258 |
259 | ## INPUTS
260 |
261 | ### System.String[]
262 |
263 | ## OUTPUTS
264 |
265 | ### System.Object
266 | ## NOTES
267 |
268 | ## RELATED LINKS
269 |
270 | [Author Blog](https://commandlinegeeks.wordpress.com/)
271 |
272 |
--------------------------------------------------------------------------------
/docs/Remove-WUServiceManager.md:
--------------------------------------------------------------------------------
1 | ---
2 | external help file: PSWindowsUpdate.dll-Help.xml
3 | Module Name: PSWindowsUpdate
4 | online version: https://commandlinegeeks.wordpress.com/
5 | schema: 2.0.0
6 | ---
7 |
8 | # Remove-WUServiceManager
9 |
10 | ## SYNOPSIS
11 | Remove windows update service manager.
12 |
13 | ## SYNTAX
14 |
15 | ```
16 | Remove-WUServiceManager [-ComputerName ] [-ScheduleJob ] -ServiceID [-Debuger]
17 | [-WhatIf] [-Confirm] []
18 | ```
19 |
20 | ## DESCRIPTION
21 | Use Remove-WUServiceManager cmdlet to unregister Windows Update Service Manager.
22 |
23 | ## EXAMPLES
24 |
25 | ### Example 1
26 | ```
27 | Try unregister Microsoft Update Service.
28 |
29 | Remove-WUServiceManager -ServiceID "7971f918-a847-4430-9279-4a52d1efe18d"
30 |
31 | Confirm
32 | Are you sure you want to perform this action?
33 | Performing the operation "Unregister Windows Update Service Manager: 7971f918-a847-4430-9279-4a52d1efe18d" on target "MG-PC".
34 |
35 | [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): Y
36 | ```
37 |
38 | ## PARAMETERS
39 |
40 | ### -ComputerName
41 | Specify one or more computer names for remote connection.
42 |
43 | ```yaml
44 | Type: String[]
45 | Parameter Sets: (All)
46 | Aliases:
47 |
48 | Required: False
49 | Position: Named
50 | Default value: None
51 | Accept pipeline input: True (ByPropertyName, ByValue)
52 | Accept wildcard characters: False
53 | ```
54 |
55 | ### -Confirm
56 | Prompts you for confirmation before running the cmdlet.
57 |
58 | ```yaml
59 | Type: SwitchParameter
60 | Parameter Sets: (All)
61 | Aliases: cf
62 |
63 | Required: False
64 | Position: Named
65 | Default value: None
66 | Accept pipeline input: False
67 | Accept wildcard characters: False
68 | ```
69 |
70 | ### -Debuger
71 | Debuger return original exceptions.
72 |
73 | ```yaml
74 | Type: SwitchParameter
75 | Parameter Sets: (All)
76 | Aliases:
77 |
78 | Required: False
79 | Position: Named
80 | Default value: False
81 | Accept pipeline input: False
82 | Accept wildcard characters: False
83 | ```
84 |
85 | ### -ScheduleJob
86 | Specify schedule time job.
87 |
88 | ```yaml
89 | Type: DateTime
90 | Parameter Sets: (All)
91 | Aliases:
92 |
93 | Required: False
94 | Position: Named
95 | Default value: 01.01.0001 00:00:00
96 | Accept pipeline input: False
97 | Accept wildcard characters: False
98 | ```
99 |
100 | ### -ServiceID
101 | Specify ServiceID of Service Manager that you want to remove.
102 |
103 | ```yaml
104 | Type: String
105 | Parameter Sets: (All)
106 | Aliases:
107 |
108 | Required: True
109 | Position: Named
110 | Default value: None
111 | Accept pipeline input: False
112 | Accept wildcard characters: False
113 | ```
114 |
115 | ### -WhatIf
116 | Shows what would happen if the cmdlet runs. The cmdlet is not run.
117 |
118 | ```yaml
119 | Type: SwitchParameter
120 | Parameter Sets: (All)
121 | Aliases: wi
122 |
123 | Required: False
124 | Position: Named
125 | Default value: None
126 | Accept pipeline input: False
127 | Accept wildcard characters: False
128 | ```
129 |
130 | ### CommonParameters
131 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
132 |
133 | ## INPUTS
134 |
135 | ### System.String[]
136 |
137 | ## OUTPUTS
138 |
139 | ### System.Object
140 | ## NOTES
141 |
142 | ## RELATED LINKS
143 |
144 | [Author Blog](https://commandlinegeeks.wordpress.com/)
145 |
146 |
--------------------------------------------------------------------------------
/docs/Remove-WindowsUpdate.md:
--------------------------------------------------------------------------------
1 | ---
2 | external help file: PSWindowsUpdate.dll-Help.xml
3 | Module Name: PSWindowsUpdate
4 | online version: https://commandlinegeeks.wordpress.com/
5 | schema: 2.0.0
6 | ---
7 |
8 | # Remove-WindowsUpdate
9 |
10 | ## SYNOPSIS
11 | Uninstall update.
12 |
13 | ## SYNTAX
14 |
15 | ### WUSAMode
16 | ```
17 | Remove-WindowsUpdate [-ComputerName ] [-ScheduleJob ] -KBArticleID [-AutoReboot]
18 | [-IgnoreReboot] [-ScheduleReboot ] [-WUSAMode] [-Debuger] [-WhatIf] [-Confirm] []
19 | ```
20 |
21 | ### WUApiMode
22 | ```
23 | Remove-WindowsUpdate [-ComputerName ] [-ScheduleJob ] -UpdateID [-AutoReboot]
24 | [-IgnoreReboot] [-ScheduleReboot ] [-WUSAMode] [-Debuger] [-WhatIf] [-Confirm] []
25 | ```
26 |
27 | ## DESCRIPTION
28 | Use Remove-WindowsUpdate to uninstall update.
29 |
30 | ## EXAMPLES
31 |
32 | ### Example 1
33 | ```
34 | Try to uninstall update with specific KBArticleID = KB958830.
35 |
36 | Get-WUUninstall -KBArticleID KB958830
37 | ```
38 |
39 | ## PARAMETERS
40 |
41 | ### -AutoReboot
42 | Do not ask for reboot if it needed.
43 |
44 | ```yaml
45 | Type: SwitchParameter
46 | Parameter Sets: (All)
47 | Aliases:
48 |
49 | Required: False
50 | Position: Named
51 | Default value: False
52 | Accept pipeline input: False
53 | Accept wildcard characters: False
54 | ```
55 |
56 | ### -ComputerName
57 | Specify one or more computer names for remote connection.
58 |
59 | ```yaml
60 | Type: String[]
61 | Parameter Sets: (All)
62 | Aliases:
63 |
64 | Required: False
65 | Position: Named
66 | Default value: None
67 | Accept pipeline input: True (ByPropertyName, ByValue)
68 | Accept wildcard characters: False
69 | ```
70 |
71 | ### -Confirm
72 | Prompts you for confirmation before running the cmdlet.
73 |
74 | ```yaml
75 | Type: SwitchParameter
76 | Parameter Sets: (All)
77 | Aliases: cf
78 |
79 | Required: False
80 | Position: Named
81 | Default value: None
82 | Accept pipeline input: False
83 | Accept wildcard characters: False
84 | ```
85 |
86 | ### -Debuger
87 | Debuger return original exceptions.
88 |
89 | ```yaml
90 | Type: SwitchParameter
91 | Parameter Sets: (All)
92 | Aliases:
93 |
94 | Required: False
95 | Position: Named
96 | Default value: False
97 | Accept pipeline input: False
98 | Accept wildcard characters: False
99 | ```
100 |
101 | ### -IgnoreReboot
102 | Do not ask for reboot if it needed, but do not reboot automaticaly.
103 |
104 | ```yaml
105 | Type: SwitchParameter
106 | Parameter Sets: (All)
107 | Aliases:
108 |
109 | Required: False
110 | Position: Named
111 | Default value: False
112 | Accept pipeline input: False
113 | Accept wildcard characters: False
114 | ```
115 |
116 | ### -KBArticleID
117 | KBArticleID that will be uninstalled.
118 |
119 | ```yaml
120 | Type: String
121 | Parameter Sets: WUSAMode
122 | Aliases: HotFixID
123 |
124 | Required: True
125 | Position: Named
126 | Default value: None
127 | Accept pipeline input: False
128 | Accept wildcard characters: False
129 | ```
130 |
131 | ### -ScheduleJob
132 | Specify schedule time job.
133 |
134 | ```yaml
135 | Type: DateTime
136 | Parameter Sets: (All)
137 | Aliases:
138 |
139 | Required: False
140 | Position: Named
141 | Default value: 01.01.0001 00:00:00
142 | Accept pipeline input: False
143 | Accept wildcard characters: False
144 | ```
145 |
146 | ### -ScheduleReboot
147 | Specify time when system will be rebooted.
148 |
149 | ```yaml
150 | Type: DateTime
151 | Parameter Sets: (All)
152 | Aliases:
153 |
154 | Required: False
155 | Position: Named
156 | Default value: 01.01.0001 00:00:00
157 | Accept pipeline input: False
158 | Accept wildcard characters: False
159 | ```
160 |
161 | ### -UpdateID
162 | Update ID that will be uninstalled.
163 |
164 | ```yaml
165 | Type: String
166 | Parameter Sets: WUApiMode
167 | Aliases:
168 |
169 | Required: True
170 | Position: Named
171 | Default value: None
172 | Accept pipeline input: False
173 | Accept wildcard characters: False
174 | ```
175 |
176 | ### -WUSAMode
177 | Wse wusa.exe instead of WU Api.
178 |
179 | ```yaml
180 | Type: SwitchParameter
181 | Parameter Sets: (All)
182 | Aliases:
183 |
184 | Required: False
185 | Position: Named
186 | Default value: False
187 | Accept pipeline input: False
188 | Accept wildcard characters: False
189 | ```
190 |
191 | ### -WhatIf
192 | Shows what would happen if the cmdlet runs. The cmdlet is not run.
193 |
194 | ```yaml
195 | Type: SwitchParameter
196 | Parameter Sets: (All)
197 | Aliases: wi
198 |
199 | Required: False
200 | Position: Named
201 | Default value: None
202 | Accept pipeline input: False
203 | Accept wildcard characters: False
204 | ```
205 |
206 | ### CommonParameters
207 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
208 |
209 | ## INPUTS
210 |
211 | ### System.String[]
212 |
213 | ## OUTPUTS
214 |
215 | ### System.Object
216 | ## NOTES
217 |
218 | ## RELATED LINKS
219 |
220 | [Author Blog](https://commandlinegeeks.wordpress.com/)
221 |
222 |
--------------------------------------------------------------------------------
/docs/Reset-WUComponents.md:
--------------------------------------------------------------------------------
1 | ---
2 | external help file: PSWindowsUpdate.dll-Help.xml
3 | Module Name: PSWindowsUpdate
4 | online version: https://commandlinegeeks.wordpress.com/
5 | schema: 2.0.0
6 | ---
7 |
8 | # Reset-WUComponents
9 |
10 | ## SYNOPSIS
11 | Reset Windows Update components.
12 |
13 | ## SYNTAX
14 |
15 | ```
16 | Reset-WUComponents [-WhatIf] [-Confirm] []
17 | ```
18 |
19 | ## DESCRIPTION
20 | Use Reset-WUComponents cmdlet to reset all Windows Update components to default.
21 |
22 | ## EXAMPLES
23 |
24 | ### Example 1
25 | ```
26 | Reset Windows Update components to default.
27 |
28 | Reset-WUComponents -Verbose
29 | Step 1: Stop Windows Update services
30 | VERBOSE: Background Intelligent Transfer Service(BITS)
31 | VERBOSE: Windows Update(wuauserv)
32 | VERBOSE: Application Identity(appidsvc)
33 | VERBOSE: Cryptographic Services(cryptsvc)
34 | Step 2: Delete the qmgr*.dat files
35 | Step 3: Backup softare distribution folders
36 | VERBOSE: Renaming Software Distribution folder to C:\WINDOWS\SoftwareDistribution.bak5
37 | VERBOSE: Renaming CatRoot folder to C:\WINDOWS\System32\Catroot2.bak1
38 | Step 4: Remove old Windows Update logs
39 | VERBOSE: Deleting the C:\WINDOWS\WindowsUpdate.log files.
40 | Step 5: Reset Windows Update services
41 | VERBOSE: Reset BITS service
42 | VERBOSE: Reset Windows Update service
43 | Step 6: Reregister dll's
44 | VERBOSE: regsvr32.exe / s atl.dll
45 | VERBOSE: regsvr32.exe / s urlmon.dll
46 | VERBOSE: regsvr32.exe / s mshtml.dll
47 | VERBOSE: regsvr32.exe / s shdocvw.dll
48 | VERBOSE: regsvr32.exe / s browseui.dll
49 | VERBOSE: regsvr32.exe / s jscript.dll
50 | VERBOSE: regsvr32.exe / s vbscript.dll
51 | VERBOSE: regsvr32.exe / s scrrun.dll
52 | VERBOSE: regsvr32.exe / s msxml.dll
53 | VERBOSE: regsvr32.exe / s msxml3.dll
54 | VERBOSE: regsvr32.exe / s msxml6.dll
55 | VERBOSE: regsvr32.exe / s actxprxy.dll
56 | VERBOSE: regsvr32.exe / s softpub.dll
57 | VERBOSE: regsvr32.exe / s wintrust.dll
58 | VERBOSE: regsvr32.exe / s dssenh.dll
59 | VERBOSE: regsvr32.exe / s rsaenh.dll
60 | VERBOSE: regsvr32.exe / s gpkcsp.dll
61 | VERBOSE: regsvr32.exe / s sccbase.dll
62 | VERBOSE: regsvr32.exe / s slbcsp.dll
63 | VERBOSE: regsvr32.exe / s cryptdlg.dll
64 | VERBOSE: regsvr32.exe / s oleaut32.dll
65 | VERBOSE: regsvr32.exe / s ole32.dll
66 | VERBOSE: regsvr32.exe / s shell32.dll
67 | VERBOSE: regsvr32.exe / s initpki.dll
68 | VERBOSE: regsvr32.exe / s wuapi.dll
69 | VERBOSE: regsvr32.exe / s wuaueng.dll
70 | VERBOSE: regsvr32.exe / s wuaueng1.dll
71 | VERBOSE: regsvr32.exe / s wucltui.dll
72 | VERBOSE: regsvr32.exe / s wups.dll
73 | VERBOSE: regsvr32.exe / s wups2.dll
74 | VERBOSE: regsvr32.exe / s wuweb.dll
75 | VERBOSE: regsvr32.exe / s qmgr.dll
76 | VERBOSE: regsvr32.exe / s qmgrprxy.dll
77 | VERBOSE: regsvr32.exe / s wucltux.dll
78 | VERBOSE: regsvr32.exe / s muweb.dll
79 | VERBOSE: regsvr32.exe / s wuwebv.dll
80 | Step 7: Reset WinSock
81 | VERBOSE: netsh winsock reset
82 | Step 8: Reset Proxy
83 | VERBOSE: netsh winhttp reset proxy
84 | Step 9: Start Windows Update services
85 | VERBOSE: Cryptographic Services (cryptsvc)
86 | VERBOSE: Application Identity (appidsvc)
87 | VERBOSE: Windows Update (wuauserv)
88 | VERBOSE: Background Intelligent Transfer Service (BITS)
89 | Step 10: Start Windows Update services
90 | VERBOSE: wuauclt /resetauthorization /detectnow
91 | ```
92 |
93 | ## PARAMETERS
94 |
95 | ### -Confirm
96 | Prompts you for confirmation before running the cmdlet.
97 |
98 | ```yaml
99 | Type: SwitchParameter
100 | Parameter Sets: (All)
101 | Aliases: cf
102 |
103 | Required: False
104 | Position: Named
105 | Default value: None
106 | Accept pipeline input: False
107 | Accept wildcard characters: False
108 | ```
109 |
110 | ### -WhatIf
111 | Shows what would happen if the cmdlet runs. The cmdlet is not run.
112 |
113 | ```yaml
114 | Type: SwitchParameter
115 | Parameter Sets: (All)
116 | Aliases: wi
117 |
118 | Required: False
119 | Position: Named
120 | Default value: None
121 | Accept pipeline input: False
122 | Accept wildcard characters: False
123 | ```
124 |
125 | ### CommonParameters
126 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
127 |
128 | ## INPUTS
129 |
130 | ### None
131 |
132 | ## OUTPUTS
133 |
134 | ### System.Object
135 | ## NOTES
136 |
137 | ## RELATED LINKS
138 |
139 | [Author Blog](https://commandlinegeeks.wordpress.com/)
140 |
141 |
--------------------------------------------------------------------------------
/docs/Set-PSWUSettings.md:
--------------------------------------------------------------------------------
1 | ---
2 | external help file: PSWindowsUpdate.dll-Help.xml
3 | Module Name: PSWindowsUpdate
4 | online version: https://commandlinegeeks.wordpress.com/
5 | schema: 2.0.0
6 | ---
7 |
8 | # Set-PSWUSettings
9 |
10 | ## SYNOPSIS
11 | Save PSWUSettings.
12 |
13 | ## SYNTAX
14 |
15 | ```
16 | Set-PSWUSettings [-Credential ] [-SendReport] [-SmtpServer ] [-SmtpPort ]
17 | [-SmtpEnableSsl ] [-SmtpCredential ] [-SmtpTo ] [-SmtpFrom ]
18 | [-SmtpSubject ] [-Properties ] [-Style ] [-SaveAsSystem ] [-Debuger] [-WhatIf]
19 | [-Confirm] []
20 | ```
21 |
22 | ## DESCRIPTION
23 | Use Set-PSWUSettings save PSWindowsUpdate module settings to XML file.
24 |
25 | ## EXAMPLES
26 |
27 | ### Example 1
28 | ```
29 | Set Office 365 as smtp server for PSWindowsUpdate module.
30 |
31 | Set-PSWUSettings -SmtpServer smtp.office365.com -SmtpPort 587 -SmtpEnableSsl $true -SmtpSubject "PSWindowsUpdate Report" -SmtpTo mgajda@psmvp.pl -SmtpFrom mgajda@psmvp.pl -SmtpCredential (Get-Credential mgajda@psmvp.pl)
32 | ```
33 |
34 | ## PARAMETERS
35 |
36 | ### -Confirm
37 | Prompts you for confirmation before running the cmdlet.
38 |
39 | ```yaml
40 | Type: SwitchParameter
41 | Parameter Sets: (All)
42 | Aliases: cf
43 |
44 | Required: False
45 | Position: Named
46 | Default value: None
47 | Accept pipeline input: False
48 | Accept wildcard characters: False
49 | ```
50 |
51 | ### -Credential
52 | Specify alternative credential.
53 |
54 | ```yaml
55 | Type: PSCredential
56 | Parameter Sets: (All)
57 | Aliases:
58 |
59 | Required: False
60 | Position: Named
61 | Default value: None
62 | Accept pipeline input: False
63 | Accept wildcard characters: False
64 | ```
65 |
66 | ### -Debuger
67 | Debuger return original exceptions.
68 |
69 | ```yaml
70 | Type: SwitchParameter
71 | Parameter Sets: (All)
72 | Aliases:
73 |
74 | Required: False
75 | Position: Named
76 | Default value: False
77 | Accept pipeline input: False
78 | Accept wildcard characters: False
79 | ```
80 |
81 | ### -Properties
82 | Alternative report message propertie.s
83 |
84 | ```yaml
85 | Type: String
86 | Parameter Sets: (All)
87 | Aliases:
88 |
89 | Required: False
90 | Position: Named
91 | Default value: None
92 | Accept pipeline input: False
93 | Accept wildcard characters: False
94 | ```
95 |
96 | ### -SaveAsSystem
97 | Invoke-WUJob to save credential as system user
98 |
99 | ```yaml
100 | Type: String
101 | Parameter Sets: (All)
102 | Aliases:
103 |
104 | Required: False
105 | Position: Named
106 | Default value: None
107 | Accept pipeline input: False
108 | Accept wildcard characters: False
109 | ```
110 |
111 | ### -SendReport
112 | Send report email to specific recipients.
113 |
114 | Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path.
115 |
116 | ```yaml
117 | Type: SwitchParameter
118 | Parameter Sets: (All)
119 | Aliases:
120 |
121 | Required: False
122 | Position: Named
123 | Default value: False
124 | Accept pipeline input: False
125 | Accept wildcard characters: False
126 | ```
127 |
128 | ### -SmtpCredential
129 | Save smtp credential to Credential Manager.
130 |
131 | ```yaml
132 | Type: PSCredential
133 | Parameter Sets: (All)
134 | Aliases:
135 |
136 | Required: False
137 | Position: Named
138 | Default value: None
139 | Accept pipeline input: False
140 | Accept wildcard characters: False
141 | ```
142 |
143 | ### -SmtpEnableSsl
144 | Save enable ssl to PSWUSettings file.
145 |
146 | ```yaml
147 | Type: Boolean
148 | Parameter Sets: (All)
149 | Aliases:
150 |
151 | Required: False
152 | Position: Named
153 | Default value: False
154 | Accept pipeline input: False
155 | Accept wildcard characters: False
156 | ```
157 |
158 | ### -SmtpFrom
159 | Save smtp sernder to PSWUSettings file.
160 |
161 | ```yaml
162 | Type: String
163 | Parameter Sets: (All)
164 | Aliases:
165 |
166 | Required: False
167 | Position: Named
168 | Default value: None
169 | Accept pipeline input: False
170 | Accept wildcard characters: False
171 | ```
172 |
173 | ### -SmtpPort
174 | Save smtp port to PSWUSettings file.
175 |
176 | ```yaml
177 | Type: Int32
178 | Parameter Sets: (All)
179 | Aliases:
180 |
181 | Required: False
182 | Position: Named
183 | Default value: 25
184 | Accept pipeline input: False
185 | Accept wildcard characters: False
186 | ```
187 |
188 | ### -SmtpServer
189 | Save smtp server to PSWUSettings file.
190 |
191 | ```yaml
192 | Type: String
193 | Parameter Sets: (All)
194 | Aliases:
195 |
196 | Required: False
197 | Position: Named
198 | Default value: None
199 | Accept pipeline input: False
200 | Accept wildcard characters: False
201 | ```
202 |
203 | ### -SmtpSubject
204 | Save alternative message subject to PSWUSettings file.
205 |
206 | ```yaml
207 | Type: String
208 | Parameter Sets: (All)
209 | Aliases:
210 |
211 | Required: False
212 | Position: Named
213 | Default value: None
214 | Accept pipeline input: False
215 | Accept wildcard characters: False
216 | ```
217 |
218 | ### -SmtpTo
219 | Save smtp recipient to PSWUSettings file.
220 |
221 | ```yaml
222 | Type: String
223 | Parameter Sets: (All)
224 | Aliases:
225 |
226 | Required: False
227 | Position: Named
228 | Default value: None
229 | Accept pipeline input: False
230 | Accept wildcard characters: False
231 | ```
232 |
233 | ### -Style
234 | Alternative report message format style.
235 |
236 | ```yaml
237 | Type: String
238 | Parameter Sets: (All)
239 | Aliases:
240 | Accepted values: Table, List
241 |
242 | Required: False
243 | Position: Named
244 | Default value: None
245 | Accept pipeline input: False
246 | Accept wildcard characters: False
247 | ```
248 |
249 | ### -WhatIf
250 | Shows what would happen if the cmdlet runs. The cmdlet is not run.
251 |
252 | ```yaml
253 | Type: SwitchParameter
254 | Parameter Sets: (All)
255 | Aliases: wi
256 |
257 | Required: False
258 | Position: Named
259 | Default value: None
260 | Accept pipeline input: False
261 | Accept wildcard characters: False
262 | ```
263 |
264 | ### CommonParameters
265 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
266 |
267 | ## INPUTS
268 |
269 | ### None
270 |
271 | ## OUTPUTS
272 |
273 | ### System.Object
274 | ## NOTES
275 |
276 | ## RELATED LINKS
277 |
278 | [Author Blog](https://commandlinegeeks.wordpress.com/)
279 |
280 |
--------------------------------------------------------------------------------
/docs/Set-WUSettings.md:
--------------------------------------------------------------------------------
1 | ---
2 | external help file: PSWindowsUpdate.dll-Help.xml
3 | Module Name: PSWindowsUpdate
4 | online version: https://commandlinegeeks.wordpress.com/
5 | schema: 2.0.0
6 | ---
7 |
8 | # Set-WUSettings
9 |
10 | ## SYNOPSIS
11 | Set Windows Update Client settings.
12 |
13 | ## SYNTAX
14 |
15 | ```
16 | Set-WUSettings [-ComputerName ] [-SendReport] [-PSWUSettings ]
17 | [-AcceptTrustedPublisherCerts] [-DisableWindowsUpdateAccess] [-NonAdministratorsElevated]
18 | [-TargetGroup ] [-TargetGroupEnabled] [-WUServer ] [-NotificationLevel ]
19 | [-AutoInstallMinorUpdates] [-DetectionFrequency ] [-DetectionFrequencyEnabled]
20 | [-IncludeRecommendedUpdates] [-NoAutoRebootWithLoggedOnUsers] [-NoAutoUpdate] [-RebootRelaunchTimeout ]
21 | [-RebootRelaunchTimeoutEnabled] [-RebootWarningTimeout ] [-RebootWarningTimeoutEnabled]
22 | [-RescheduleWaitTime ] [-ScheduledInstallDay ] [-ScheduledInstallTime ] [-UseWUServer]
23 | [-Debuger] [-WhatIf] [-Confirm] []
24 | ```
25 |
26 | ## DESCRIPTION
27 | Use Set-WUSettings cmdlet to Set configuration of Windows Update Client.
28 |
29 | ## EXAMPLES
30 |
31 | ### Example 1
32 | ```
33 | Enable IncludeRecommendedUpdates attributes.
34 |
35 | Set-WUSettings -IncludeRecommendedUpdates
36 |
37 | Confirm
38 | Are you sure you want to perform this action?
39 | Performing the operation "Set Windows Update settings" on target "MG-PC".
40 | [Y] Yes[A] Yes to All [N] No[L] No to All [S] Suspend[?] Help (default is "Y"): Y
41 |
42 | ComputerName IncludeRecommendedUpdates
43 | ------------ -------------------------
44 | MG-PC True
45 | ```
46 |
47 | ## PARAMETERS
48 |
49 | ### -AcceptTrustedPublisherCerts
50 | Enabled - The WSUS server distributes available signed non-Microsoft updates.
51 |
52 | Disabled - The WSUS server does not distribute available signed non-Microsoft updates.
53 |
54 | ```yaml
55 | Type: SwitchParameter
56 | Parameter Sets: (All)
57 | Aliases:
58 |
59 | Required: False
60 | Position: Named
61 | Default value: False
62 | Accept pipeline input: False
63 | Accept wildcard characters: False
64 | ```
65 |
66 | ### -AutoInstallMinorUpdates
67 | Silently install minor updates.
68 |
69 | ```yaml
70 | Type: SwitchParameter
71 | Parameter Sets: (All)
72 | Aliases:
73 |
74 | Required: False
75 | Position: Named
76 | Default value: False
77 | Accept pipeline input: False
78 | Accept wildcard characters: False
79 | ```
80 |
81 | ### -ComputerName
82 | Specify one or more computer names for remote connection.
83 |
84 | ```yaml
85 | Type: String[]
86 | Parameter Sets: (All)
87 | Aliases:
88 |
89 | Required: False
90 | Position: Named
91 | Default value: None
92 | Accept pipeline input: True (ByPropertyName, ByValue)
93 | Accept wildcard characters: False
94 | ```
95 |
96 | ### -Confirm
97 | Prompts you for confirmation before running the cmdlet.
98 |
99 | ```yaml
100 | Type: SwitchParameter
101 | Parameter Sets: (All)
102 | Aliases: cf
103 |
104 | Required: False
105 | Position: Named
106 | Default value: None
107 | Accept pipeline input: False
108 | Accept wildcard characters: False
109 | ```
110 |
111 | ### -Debuger
112 | Debuger return original exceptions.
113 |
114 | ```yaml
115 | Type: SwitchParameter
116 | Parameter Sets: (All)
117 | Aliases:
118 |
119 | Required: False
120 | Position: Named
121 | Default value: False
122 | Accept pipeline input: False
123 | Accept wildcard characters: False
124 | ```
125 |
126 | ### -DetectionFrequency
127 | Time between detection cycles.
128 | Time in hours (1-22).
129 |
130 | ```yaml
131 | Type: Int32
132 | Parameter Sets: (All)
133 | Aliases:
134 |
135 | Required: False
136 | Position: Named
137 | Default value: 0
138 | Accept pipeline input: False
139 | Accept wildcard characters: False
140 | ```
141 |
142 | ### -DetectionFrequencyEnabled
143 | Enable/Disable detection frequency.
144 |
145 | ```yaml
146 | Type: SwitchParameter
147 | Parameter Sets: (All)
148 | Aliases:
149 |
150 | Required: False
151 | Position: Named
152 | Default value: False
153 | Accept pipeline input: False
154 | Accept wildcard characters: False
155 | ```
156 |
157 | ### -DisableWindowsUpdateAccess
158 | Disables/Enables access to Windows Update.
159 |
160 | ```yaml
161 | Type: SwitchParameter
162 | Parameter Sets: (All)
163 | Aliases:
164 |
165 | Required: False
166 | Position: Named
167 | Default value: False
168 | Accept pipeline input: False
169 | Accept wildcard characters: False
170 | ```
171 |
172 | ### -IncludeRecommendedUpdates
173 | Enable/Disable recommended updates.
174 |
175 | ```yaml
176 | Type: SwitchParameter
177 | Parameter Sets: (All)
178 | Aliases:
179 |
180 | Required: False
181 | Position: Named
182 | Default value: False
183 | Accept pipeline input: False
184 | Accept wildcard characters: False
185 | ```
186 |
187 | ### -NoAutoRebootWithLoggedOnUsers
188 | Logged-on user can decide whether to restart the client computer.
189 |
190 | ```yaml
191 | Type: SwitchParameter
192 | Parameter Sets: (All)
193 | Aliases:
194 |
195 | Required: False
196 | Position: Named
197 | Default value: False
198 | Accept pipeline input: False
199 | Accept wildcard characters: False
200 | ```
201 |
202 | ### -NoAutoUpdate
203 | Enable/Disable Automatic Updates.
204 |
205 | ```yaml
206 | Type: SwitchParameter
207 | Parameter Sets: (All)
208 | Aliases:
209 |
210 | Required: False
211 | Position: Named
212 | Default value: False
213 | Accept pipeline input: False
214 | Accept wildcard characters: False
215 | ```
216 |
217 | ### -NonAdministratorsElevated
218 | Enabled - All members of the Users security group can approve or disapprove updates.
219 |
220 | Disabled - Only members of the Administrators security group can approve or disapprove updates.
221 |
222 | ```yaml
223 | Type: SwitchParameter
224 | Parameter Sets: (All)
225 | Aliases:
226 |
227 | Required: False
228 | Position: Named
229 | Default value: False
230 | Accept pipeline input: False
231 | Accept wildcard characters: False
232 | ```
233 |
234 | ### -NotificationLevel
235 | Notify mode: "Not configured", "Disabled", "Notify before download", "Notify before installation", "Scheduled installation", "Users configure"
236 |
237 | ```yaml
238 | Type: String
239 | Parameter Sets: (All)
240 | Aliases: AUOptions
241 | Accepted values: Not configured, Disabled, Notify before download, Notify before installation, Scheduled installation, Users configure
242 |
243 | Required: False
244 | Position: Named
245 | Default value: None
246 | Accept pipeline input: False
247 | Accept wildcard characters: False
248 | ```
249 |
250 | ### -PSWUSettings
251 | Required parameter for -SendReport.
252 |
253 | Passes the parameters (as hashtable) necessary to send the report: \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";\[Port=25\];\[Subject="Alternative Subject"\];\[Properties="Alternative object properties"\];\[Style="Table|List"\]}
254 |
255 | Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path: \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";\[Port=25\]}"
256 |
257 | ```yaml
258 | Type: Hashtable
259 | Parameter Sets: (All)
260 | Aliases:
261 |
262 | Required: False
263 | Position: Named
264 | Default value: None
265 | Accept pipeline input: False
266 | Accept wildcard characters: False
267 | ```
268 |
269 | ### -RebootRelaunchTimeout
270 | Time between prompts for a scheduled restart.
271 | Time in minutes (1-1440).
272 |
273 | ```yaml
274 | Type: Int32
275 | Parameter Sets: (All)
276 | Aliases:
277 |
278 | Required: False
279 | Position: Named
280 | Default value: 0
281 | Accept pipeline input: False
282 | Accept wildcard characters: False
283 | ```
284 |
285 | ### -RebootRelaunchTimeoutEnabled
286 | Enable/Disable RebootRelaunchTimeout.
287 |
288 | ```yaml
289 | Type: SwitchParameter
290 | Parameter Sets: (All)
291 | Aliases:
292 |
293 | Required: False
294 | Position: Named
295 | Default value: False
296 | Accept pipeline input: False
297 | Accept wildcard characters: False
298 | ```
299 |
300 | ### -RebootWarningTimeout
301 | Length, in minutes, of the restart warning countdown after updates have been installed that have a deadline or scheduled updates.
302 | Time in minutes (1-30).
303 |
304 | ```yaml
305 | Type: Int32
306 | Parameter Sets: (All)
307 | Aliases:
308 |
309 | Required: False
310 | Position: Named
311 | Default value: 0
312 | Accept pipeline input: False
313 | Accept wildcard characters: False
314 | ```
315 |
316 | ### -RebootWarningTimeoutEnabled
317 | Enable/Disable RebootWarningTimeout.
318 |
319 | ```yaml
320 | Type: SwitchParameter
321 | Parameter Sets: (All)
322 | Aliases:
323 |
324 | Required: False
325 | Position: Named
326 | Default value: False
327 | Accept pipeline input: False
328 | Accept wildcard characters: False
329 | ```
330 |
331 | ### -RescheduleWaitTime
332 | Time in minutes that Automatic Updates waits at startup before it applies updates from a missed scheduled installation time.
333 | Time in minutes (1-60).
334 |
335 | ```yaml
336 | Type: Int32
337 | Parameter Sets: (All)
338 | Aliases:
339 |
340 | Required: False
341 | Position: Named
342 | Default value: 0
343 | Accept pipeline input: False
344 | Accept wildcard characters: False
345 | ```
346 |
347 | ### -ScheduledInstallDay
348 | Scheduled day of install: "Every day", "Every Sunday", "Every Monday", "Every Tuesday", "Every Wednesday", "Every Thursday", ""Every Friday", "EverySaturday".
349 | Only valid if NotificationLevel (AUOptions) = "Scheduled installation"
350 |
351 | Starting with Windows 8 and Windows Server 2012, ScheduledInstallationDay are not supported and will return unreliable values.If you try to modify these properties, the operation will appear to succeed but will have no effect.
352 |
353 | ```yaml
354 | Type: String
355 | Parameter Sets: (All)
356 | Aliases:
357 | Accepted values: Every Day, Every Sunday, Every Monday, Every Tuesday, Every Wednesday, Every Thursday, Every Friday, EverySaturday
358 |
359 | Required: False
360 | Position: Named
361 | Default value: None
362 | Accept pipeline input: False
363 | Accept wildcard characters: False
364 | ```
365 |
366 | ### -ScheduledInstallTime
367 | Scheduled time of install in 24-hour format(0-23).
368 |
369 | Starting with Windows 8 and Windows Server 2012, ScheduledInstallTime are not supported and will return unreliable values.If you try to modify these properties, the operation will appear to succeed but will have no effect.
370 |
371 | ```yaml
372 | Type: Int32
373 | Parameter Sets: (All)
374 | Aliases:
375 |
376 | Required: False
377 | Position: Named
378 | Default value: 0
379 | Accept pipeline input: False
380 | Accept wildcard characters: False
381 | ```
382 |
383 | ### -SendReport
384 | Send report email to specific recipients.
385 |
386 | Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path.
387 |
388 | ```yaml
389 | Type: SwitchParameter
390 | Parameter Sets: (All)
391 | Aliases:
392 |
393 | Required: False
394 | Position: Named
395 | Default value: False
396 | Accept pipeline input: False
397 | Accept wildcard characters: False
398 | ```
399 |
400 | ### -TargetGroup
401 | Name of the computer group to which the computer belongs.
402 |
403 | ```yaml
404 | Type: String
405 | Parameter Sets: (All)
406 | Aliases:
407 |
408 | Required: False
409 | Position: Named
410 | Default value: None
411 | Accept pipeline input: False
412 | Accept wildcard characters: False
413 | ```
414 |
415 | ### -TargetGroupEnabled
416 | Use/Do not use client-side targeting.
417 |
418 | ```yaml
419 | Type: SwitchParameter
420 | Parameter Sets: (All)
421 | Aliases:
422 |
423 | Required: False
424 | Position: Named
425 | Default value: False
426 | Accept pipeline input: False
427 | Accept wildcard characters: False
428 | ```
429 |
430 | ### -UseWUServer
431 | The computer gets its updates from a WSUS server or from Microsoft Update.
432 |
433 | ```yaml
434 | Type: SwitchParameter
435 | Parameter Sets: (All)
436 | Aliases:
437 |
438 | Required: False
439 | Position: Named
440 | Default value: False
441 | Accept pipeline input: False
442 | Accept wildcard characters: False
443 | ```
444 |
445 | ### -WUServer
446 | HTTP(S) URL of the WSUS server that is used by Automatic Updates and API callers (by default).
447 |
448 | ```yaml
449 | Type: String
450 | Parameter Sets: (All)
451 | Aliases:
452 |
453 | Required: False
454 | Position: Named
455 | Default value: None
456 | Accept pipeline input: False
457 | Accept wildcard characters: False
458 | ```
459 |
460 | ### -WhatIf
461 | Shows what would happen if the cmdlet runs. The cmdlet is not run.
462 |
463 | ```yaml
464 | Type: SwitchParameter
465 | Parameter Sets: (All)
466 | Aliases: wi
467 |
468 | Required: False
469 | Position: Named
470 | Default value: None
471 | Accept pipeline input: False
472 | Accept wildcard characters: False
473 | ```
474 |
475 | ### CommonParameters
476 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
477 |
478 | ## INPUTS
479 |
480 | ### System.String[]
481 |
482 | ## OUTPUTS
483 |
484 | ### PSWindowsUpdate.WUSettings
485 |
486 | ## NOTES
487 |
488 | ## RELATED LINKS
489 |
490 | [Author Blog](https://commandlinegeeks.wordpress.com/)
491 |
492 |
--------------------------------------------------------------------------------
/docs/Update-WUModule.md:
--------------------------------------------------------------------------------
1 | ---
2 | external help file: PSWindowsUpdate.dll-Help.xml
3 | Module Name: PSWindowsUpdate
4 | online version: https://commandlinegeeks.wordpress.com/
5 | schema: 2.0.0
6 | ---
7 |
8 | # Update-WUModule
9 |
10 | ## SYNOPSIS
11 | Update PSWindowsUpdate module.
12 |
13 | ## SYNTAX
14 |
15 | ### Online (Default)
16 | ```
17 | Update-WUModule [-ComputerName ] [-Credential ] [-Online] [-Debuger] [-WhatIf]
18 | [-Confirm] []
19 | ```
20 |
21 | ### Local
22 | ```
23 | Update-WUModule -ComputerName [-Credential ] [-Local] [-Debuger] [-WhatIf] [-Confirm]
24 | []
25 | ```
26 |
27 | ## DESCRIPTION
28 | Use Use Update-WUModule cmdlet to remote update PSWindowsUpdate module.
29 |
30 | ## EXAMPLES
31 |
32 | ### Example 1
33 | ```
34 | Update PSWindowsUpdate module from PSGallery
35 |
36 | Update-WUModule -ComputerName MG-PC -Online
37 | ```
38 |
39 | ### Example 2
40 | ```
41 | Update PSWindowsUpdate module from current serwer. Require SMB connection to destination machine.
42 |
43 | Update-WUModule -ComputerName MG-PC -Local
44 | ```
45 |
46 | ## PARAMETERS
47 |
48 | ### -ComputerName
49 | Specify one or more computer names for remote connection.
50 |
51 | ```yaml
52 | Type: String[]
53 | Parameter Sets: Online
54 | Aliases:
55 |
56 | Required: False
57 | Position: Named
58 | Default value: None
59 | Accept pipeline input: True (ByPropertyName, ByValue)
60 | Accept wildcard characters: False
61 | ```
62 |
63 | ```yaml
64 | Type: String[]
65 | Parameter Sets: Local
66 | Aliases:
67 |
68 | Required: True
69 | Position: Named
70 | Default value: None
71 | Accept pipeline input: True (ByPropertyName, ByValue)
72 | Accept wildcard characters: False
73 | ```
74 |
75 | ### -Confirm
76 | Prompts you for confirmation before running the cmdlet.
77 |
78 | ```yaml
79 | Type: SwitchParameter
80 | Parameter Sets: (All)
81 | Aliases: cf
82 |
83 | Required: False
84 | Position: Named
85 | Default value: None
86 | Accept pipeline input: False
87 | Accept wildcard characters: False
88 | ```
89 |
90 | ### -Credential
91 | Specify alternative credential.
92 |
93 | ```yaml
94 | Type: PSCredential
95 | Parameter Sets: (All)
96 | Aliases:
97 |
98 | Required: False
99 | Position: Named
100 | Default value: None
101 | Accept pipeline input: False
102 | Accept wildcard characters: False
103 | ```
104 |
105 | ### -Debuger
106 | Debuger return original exceptions.
107 |
108 | ```yaml
109 | Type: SwitchParameter
110 | Parameter Sets: (All)
111 | Aliases:
112 |
113 | Required: False
114 | Position: Named
115 | Default value: False
116 | Accept pipeline input: False
117 | Accept wildcard characters: False
118 | ```
119 |
120 | ### -Local
121 | Update from current module.
122 |
123 | ```yaml
124 | Type: SwitchParameter
125 | Parameter Sets: Local
126 | Aliases:
127 |
128 | Required: True
129 | Position: Named
130 | Default value: False
131 | Accept pipeline input: False
132 | Accept wildcard characters: False
133 | ```
134 |
135 | ### -Online
136 | Update from PSGallery.
137 |
138 | ```yaml
139 | Type: SwitchParameter
140 | Parameter Sets: Online
141 | Aliases:
142 |
143 | Required: True
144 | Position: Named
145 | Default value: False
146 | Accept pipeline input: False
147 | Accept wildcard characters: False
148 | ```
149 |
150 | ### -WhatIf
151 | Shows what would happen if the cmdlet runs. The cmdlet is not run.
152 |
153 | ```yaml
154 | Type: SwitchParameter
155 | Parameter Sets: (All)
156 | Aliases: wi
157 |
158 | Required: False
159 | Position: Named
160 | Default value: None
161 | Accept pipeline input: False
162 | Accept wildcard characters: False
163 | ```
164 |
165 | ### CommonParameters
166 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
167 |
168 | ## INPUTS
169 |
170 | ### System.String[]
171 |
172 | ## OUTPUTS
173 |
174 | ### System.Object
175 | ## NOTES
176 |
177 | ## RELATED LINKS
178 |
179 | [Author Blog](https://commandlinegeeks.wordpress.com/)
180 |
181 |
--------------------------------------------------------------------------------
/genbitsdll.bat:
--------------------------------------------------------------------------------
1 | REM Create a working directory
2 | REM You can select a different directory based on your needs.
3 | SET BITSTEMP=C:\BITSTEMPDIR
4 | MKDIR "%BITSTEMP%"
5 |
6 | REM Run the VsDevCmd.bat file to locate the Windows
7 | REM SDK directory and the tools directories
8 | REM This will be different for different versions of
9 | REM Visual Studio
10 |
11 | CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\vsdevcmd.bat"
12 |
13 | REM Run the MIDL command on the desired BITS IDL file
14 | REM This will generate a TLB file for the TLBIMP command
15 | REM The IDL file will be different depending on which
16 | REM set of BITS interfaces you need to use.
17 | REM Run the MIDL command once per reference file
18 | REM that you will need to explicitly use.
19 | PUSHD .
20 | CD /D "%WindowsSdkDir%Include\%WindowsSDKLibVersion%um"
21 |
22 | MIDL /I ..\shared /out "%BITSTEMP%" bits1_5.idl /dlldata NUL: /header NUL: /iid NUL: /proxy NUL:
23 | MIDL /I ..\shared /out "%BITSTEMP%" bits4_0.idl /dlldata NUL: /header NUL: /iid NUL: /proxy NUL:
24 | MIDL /I ..\shared /out "%BITSTEMP%" bits5_0.idl /dlldata NUL: /header NUL: /iid NUL: /proxy NUL:
25 | MIDL /I ..\shared /out "%BITSTEMP%" bits10_1.idl /dlldata NUL: /header NUL: /iid NUL: /proxy NUL:
26 | MIDL /I ..\shared /out "%BITSTEMP%" bits10_2.idl /dlldata NUL: /header NUL: /iid NUL: /proxy NUL:
27 |
28 | REM Run the TLBIMP command on the resulting TLB file(s)
29 | REM Try to keep a parallel set of names.
30 | TLBIMP "%BITSTEMP%"\bits1_5.tlb /out: "%BITSTEMP%"\BITSReference1_5.dll
31 | TLBIMP "%BITSTEMP%"\bits4_0.tlb /out: "%BITSTEMP%"\BITSReference4_0.dll
32 | TLBIMP "%BITSTEMP%"\bits5_0.tlb /out: "%BITSTEMP%"\BITSReference5_0.dll
33 | TLBIMP "%BITSTEMP%"\bits10_1.tlb /out: "%BITSTEMP%"\BITSReference10_1.dll
34 | TLBIMP "%BITSTEMP%"\bits10_2.tlb /out: "%BITSTEMP%"\BITSReference10_2.dll
35 | DEL "%BITSTEMP%"\bits*.tlb
36 | POPD
--------------------------------------------------------------------------------
/src/AgentInfo.cs:
--------------------------------------------------------------------------------
1 | namespace PSWindowsUpdate
2 | {
3 | ///
4 | /// OutputType
5 | /// OutputType for AgentInfo objects.
6 | ///
7 | public class AgentInfo
8 | {
9 | /// ComputerName
10 | public string ComputerName { get; set; }
11 |
12 | /// ApiVersion
13 | public string ApiVersion { get; set; }
14 |
15 | /// WuapiDll
16 | public string WuapiDll { get; set; }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/CredentialType.cs:
--------------------------------------------------------------------------------
1 | namespace PSWindowsUpdate
2 | {
3 | ///
4 | /// Enum CredentialType
5 | ///
6 | /// The type of the credential. This member cannot be changed after the credential is created.
7 | ///
8 | public enum CredentialType : uint
9 | {
10 | /// The lack of credential type
11 | None,
12 |
13 | ///
14 | /// Generic credential type
15 | ///
16 | /// The credential is a generic credential. The credential will not be used by any particular authentication package.
17 | /// The credential will be stored securely but has no other significant characteristics.
18 | ///
19 | Generic,
20 |
21 | ///
22 | /// Domain password credential type
23 | ///
24 | /// The credential is a password credential and is specific to Microsoft's authentication packages.
25 | /// The NTLM, Kerberos, and Negotiate authentication packages will automatically use this credential when connecting to the named target.
26 | ///
27 | DomainPassword,
28 |
29 | ///
30 | /// Domain certificate credential type
31 | ///
32 | /// The credential is a certificate credential and is specific to Microsoft's authentication packages.
33 | /// The Kerberos, Negotiate, and Schannel authentication packages automatically use this credential when connecting to the named target.
34 | ///
35 | DomainCertificate
36 | }
37 | }
--------------------------------------------------------------------------------
/src/GetWUInstallerStatus.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.ObjectModel;
4 | using System.Management.Automation;
5 | using System.Security.Principal;
6 | using WUApiLib;
7 |
8 | namespace PSWindowsUpdate
9 | {
10 | ///
11 | /// Get Windows Update Installer status.
12 | /// Use Get-WUInstallerStatus cmdlet to show Windows Update Installer status.
13 | ///
14 | /// Author Blog
15 | ///
16 | ///
17 | /// Check if Windows Update Installer is busy.
18 | ///
19 | /// Get-WUInstallerStatus
20 | ///
21 | /// ComputerName IsBusy
22 | /// ------------ ------
23 | /// MG-PC False
24 | ///
25 | ///
26 | ///
27 | ///
28 | /// Check if Windows Update Installer is busy in silent mode. Return only True (isBusy) or False (isFree).
29 | ///
30 | /// Get-WUInstallerStatus -Silent
31 | ///
32 | /// False
33 | ///
34 | ///
35 | [Cmdlet("Get", "WUInstallerStatus", ConfirmImpact = ConfirmImpact.Medium, SupportsShouldProcess = true)]
36 | [OutputType(typeof(InstallerStatus))]
37 | public class GetWUInstallerStatus : PSCmdlet
38 | {
39 | private Hashtable _PSWUSettings = new Hashtable();
40 |
41 | ///
42 | /// Specify one or more computer names for remote connection.
43 | ///
44 | [Parameter(ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)]
45 | private string[] ComputerName { get; set; }
46 |
47 | ///
48 | /// Specify alternative credential.
49 | ///
50 | [Parameter]
51 | private PSCredential Credential { get; set; }
52 |
53 | ///
54 | /// Send report email to specific recipients.
55 | /// Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path.
56 | ///
57 | [Parameter]
58 | public SwitchParameter SendReport { get; set; }
59 |
60 | ///
61 | /// Required parameter for -SendReport.
62 | /// Passes the parameters (as hashtable) necessary to send the report:
63 | /// \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25];[Subject="Alternative Subject"];[Properties="Alternative object properties"];[Style="Table|List"]}
64 | /// Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path:
65 | /// \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25]}"
66 | ///
67 | [Parameter]
68 | public Hashtable PSWUSettings
69 | {
70 | get => _PSWUSettings;
71 | set => _PSWUSettings = value;
72 | }
73 |
74 | ///
75 | /// Return true/false only.
76 | ///
77 | [Parameter]
78 | public SwitchParameter Silent { get; set; }
79 |
80 | ///
81 | /// Debuger return original exceptions.
82 | ///
83 | [Parameter]
84 | public SwitchParameter Debuger { get; set; }
85 |
86 | private static WUImpersonator ImpersonatorObj { get; set; }
87 |
88 | private static WUTools WUToolsObj { get; set; }
89 |
90 | private static Collection OutputObj { get; set; }
91 |
92 | private static UpdateInstaller InstallerObj { get; set; }
93 |
94 | private static DateTime CmdletStart { get; set; }
95 |
96 | private static DateTime CmdletEnd { get; set; }
97 |
98 | /// Begin
99 | protected override void BeginProcessing()
100 | {
101 | CmdletStart = DateTime.Now;
102 | WriteDebug(DateTime.Now + " CmdletStart: " + MyInvocation.InvocationName);
103 | if (!new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator))
104 | {
105 | WriteWarning("To perform some operations you must run an elevated Windows PowerShell console.");
106 | }
107 |
108 | WUToolsObj = new WUTools();
109 | OutputObj = [];
110 | if (SendReport)
111 | {
112 | WriteDebug(DateTime.Now + " Test smtp settings");
113 | if (!PSWUSettings.ContainsKey("Properties"))
114 | {
115 | PSWUSettings.Add("Properties", new InstallerStatus());
116 | }
117 |
118 | var psObject = WUToolsObj.TestMail(PSWUSettings);
119 | if (psObject.Properties.Match("ErrorRecord").Count == 1)
120 | {
121 | WriteError((ErrorRecord)psObject.Properties["ErrorRecord"].Value);
122 | SendReport = false;
123 | WriteDebug(DateTime.Now + " Disabling -SendReport");
124 | }
125 | }
126 |
127 | if (ComputerName != null)
128 | {
129 | return;
130 | }
131 |
132 | ComputerName =
133 | [
134 | Environment.MachineName
135 | ];
136 | }
137 |
138 | private void CoreProcessing()
139 | {
140 | foreach (var target in ComputerName)
141 | {
142 | WriteDebug(DateTime.Now + " " + target + ": Connecting...");
143 | try
144 | {
145 | var pswuModule = WUToolsObj.GetPSWUModule(target);
146 | WriteDebug(DateTime.Now + " Module version: " + pswuModule.Properties["Version"].Value);
147 | WriteDebug(DateTime.Now + " Dll version: " + pswuModule.Properties["PSWUDllVersion"].Value);
148 | }
149 | catch
150 | {
151 | }
152 |
153 | if (ShouldProcess(target, "(" + DateTime.Now + ") Get Windows Update installer status"))
154 | {
155 | var wuApiInstallerObj = WUToolsObj.GetWUApiInstallerObj(target);
156 | WriteDebug(DateTime.Now + " InstallerObj mode: " + wuApiInstallerObj.Mode);
157 | if (wuApiInstallerObj.Status)
158 | {
159 | InstallerObj = (UpdateInstaller)wuApiInstallerObj.Object;
160 | var isBusy = InstallerObj.IsBusy;
161 | var sendToPipeline = new PSObject();
162 | sendToPipeline.Properties.Add(new PSNoteProperty("ComputerName", target));
163 | sendToPipeline.Properties.Add(new PSNoteProperty("IsBusy", isBusy));
164 | OutputObj.Add(sendToPipeline);
165 | if (!Silent)
166 | {
167 | WriteObject(sendToPipeline, true);
168 | }
169 | else
170 | {
171 | WriteObject(isBusy, true);
172 | }
173 | }
174 | else if (Debuger)
175 | {
176 | WriteError(new ErrorRecord(wuApiInstallerObj.Exception, "Debug", ErrorCategory.CloseError, null));
177 | }
178 | else
179 | {
180 | WriteError(wuApiInstallerObj.Error);
181 | }
182 | }
183 | }
184 | }
185 |
186 | /// Process
187 | protected override void ProcessRecord()
188 | {
189 | var flag = false;
190 | if (Credential != null)
191 | {
192 | var userName = Credential.GetNetworkCredential().UserName;
193 | var domain = Credential.GetNetworkCredential().Domain;
194 | var password = Credential.GetNetworkCredential().Password;
195 | WriteDebug(DateTime.Now + " UserName: " + userName + "; Domain: " + domain + "; Password: " + password.Substring(0, 1) +
196 | "*****");
197 | var windowsPrincipal1 = new WindowsPrincipal(WindowsIdentity.GetCurrent());
198 | var str1 = "";
199 | if (windowsPrincipal1.IsInRole(WindowsBuiltInRole.Administrator))
200 | {
201 | str1 = "RunAs";
202 | }
203 |
204 | var strArray1 = new string[5];
205 | var now = DateTime.Now;
206 | strArray1[0] = now.ToString();
207 | strArray1[1] = " Before User: ";
208 | strArray1[2] = WindowsIdentity.GetCurrent().Name;
209 | strArray1[3] = " ";
210 | strArray1[4] = str1;
211 | WriteDebug(string.Concat(strArray1));
212 | var logonType = WUImpersonator.LogonSessionType.Interactive;
213 | var logonProvider = WUImpersonator.LogonProvider.Default;
214 | if (!WUToolsObj.IsLocalHost(ComputerName[0]))
215 | {
216 | logonType = WUImpersonator.LogonSessionType.NewCredentials;
217 | logonProvider = WUImpersonator.LogonProvider.WinNT50;
218 | }
219 |
220 | using (new WUImpersonator(userName, domain, password, logonType, logonProvider))
221 | {
222 | if (new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator))
223 | {
224 | var str2 = "RunAs";
225 | var strArray2 = new string[9];
226 | now = DateTime.Now;
227 | strArray2[0] = now.ToString();
228 | strArray2[1] = " Impersonated User (";
229 | strArray2[2] = logonType.ToString();
230 | strArray2[3] = "|";
231 | strArray2[4] = logonProvider.ToString();
232 | strArray2[5] = "): ";
233 | strArray2[6] = WindowsIdentity.GetCurrent().Name;
234 | strArray2[7] = " ";
235 | strArray2[8] = str2;
236 | WriteDebug(string.Concat(strArray2));
237 | try
238 | {
239 | CoreProcessing();
240 | flag = false;
241 | }
242 | catch (Exception ex)
243 | {
244 | WriteDebug(DateTime.Now + " Something goes wrong: " + ex.Message);
245 | flag = true;
246 | }
247 | }
248 | else
249 | {
250 | var str3 = "Can't RunAs";
251 | var strArray3 = new string[9];
252 | now = DateTime.Now;
253 | strArray3[0] = now.ToString();
254 | strArray3[1] = " Impersonated User (";
255 | strArray3[2] = logonType.ToString();
256 | strArray3[3] = "|";
257 | strArray3[4] = logonProvider.ToString();
258 | strArray3[5] = "): ";
259 | strArray3[6] = WindowsIdentity.GetCurrent().Name;
260 | strArray3[7] = " ";
261 | strArray3[8] = str3;
262 | WriteDebug(string.Concat(strArray3));
263 | flag = true;
264 | }
265 |
266 | now = DateTime.Now;
267 | WriteDebug(now + " Leaving impersonated session");
268 | }
269 |
270 | var windowsPrincipal2 = new WindowsPrincipal(WindowsIdentity.GetCurrent());
271 | var str4 = "";
272 | if (windowsPrincipal2.IsInRole(WindowsBuiltInRole.Administrator))
273 | {
274 | str4 = "RunAs";
275 | }
276 |
277 | WriteDebug(DateTime.Now + " After User: " + WindowsIdentity.GetCurrent().Name + " " + str4);
278 | }
279 | else
280 | {
281 | flag = true;
282 | }
283 |
284 | if (!flag)
285 | {
286 | return;
287 | }
288 |
289 | CoreProcessing();
290 | }
291 |
292 | /// End
293 | protected override void EndProcessing()
294 | {
295 | CmdletEnd = DateTime.Now;
296 | var CmdletInfo = new PSObject();
297 | CmdletInfo.Properties.Add(new PSNoteProperty("CmdletStart", CmdletStart));
298 | CmdletInfo.Properties.Add(new PSNoteProperty("CmdletEnd", CmdletEnd));
299 | CmdletInfo.Properties.Add(new PSNoteProperty("CmdletLine", MyInvocation.Line));
300 | if (SendReport)
301 | {
302 | WriteDebug(DateTime.Now + " Send report");
303 | if (!PSWUSettings.ContainsKey("Properties"))
304 | {
305 | PSWUSettings.Add("Properties", new InstallerStatus());
306 | }
307 |
308 | var psObject = WUToolsObj.SendMail(PSWUSettings, OutputObj, CmdletInfo);
309 | if (psObject.Properties.Match("ErrorRecord").Count == 1)
310 | {
311 | WriteError((ErrorRecord)psObject.Properties["ErrorRecord"].Value);
312 | }
313 | }
314 |
315 | WriteDebug(DateTime.Now + " CmdletEnd");
316 | }
317 | }
318 | }
--------------------------------------------------------------------------------
/src/GetWULastResults.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.ObjectModel;
4 | using System.Management.Automation;
5 | using System.Security.Principal;
6 |
7 | namespace PSWindowsUpdate
8 | {
9 | ///
10 | /// Get Windows Update results.
11 | /// Use Get-WULastResults cmdlet to get Windows Update LastSearchSuccessDate and LastInstallationSuccessDate.
12 | ///
13 | /// Author Blog
14 | ///
15 | ///
16 | /// Get last Windows Update results.
17 | ///
18 | /// Get-WULastResults
19 | ///
20 | /// ComputerName LastSearchSuccessDate LastInstallationSuccessDate
21 | /// ------------ --------------------- ---------------------------
22 | /// MG-PC 30.08.2017 14:02:11 03.07.2017 07:35:27
23 | ///
24 | ///
25 | [Cmdlet("Get", "WULastResults", ConfirmImpact = ConfirmImpact.Medium, SupportsShouldProcess = true)]
26 | [OutputType(typeof(LastResults))]
27 | public class GetWULastResults : PSCmdlet
28 | {
29 | private Hashtable _PSWUSettings = new Hashtable();
30 |
31 | ///
32 | /// Specify one or more computer names for remote connection.
33 | ///
34 | [Parameter(ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)]
35 | public string[] ComputerName { get; set; }
36 |
37 | ///
38 | /// Specify alternative credential.
39 | ///
40 | [Parameter]
41 | private PSCredential Credential { get; set; }
42 |
43 | ///
44 | /// Send report email to specific recipients.
45 | /// Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path.
46 | ///
47 | [Parameter]
48 | public SwitchParameter SendReport { get; set; }
49 |
50 | ///
51 | /// Required parameter for -SendReport.
52 | /// Passes the parameters (as hashtable) necessary to send the report:
53 | /// \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25];[Subject="Alternative Subject"];[Properties="Alternative object properties"];[Style="Table|List"]}
54 | /// Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path:
55 | /// \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25]}"
56 | ///
57 | [Parameter]
58 | public Hashtable PSWUSettings
59 | {
60 | get => _PSWUSettings;
61 | set => _PSWUSettings = value;
62 | }
63 |
64 | ///
65 | /// Debuger return original exceptions.
66 | ///
67 | [Parameter]
68 | public SwitchParameter Debuger { get; set; }
69 |
70 | private static WUImpersonator ImpersonatorObj { get; set; }
71 |
72 | private static WUTools WUToolsObj { get; set; }
73 |
74 | private static Collection OutputObj { get; set; }
75 |
76 | private static DateTime CmdletStart { get; set; }
77 |
78 | private static DateTime CmdletEnd { get; set; }
79 |
80 | /// Begin
81 | protected override void BeginProcessing()
82 | {
83 | CmdletStart = DateTime.Now;
84 | WriteDebug(DateTime.Now + " CmdletStart: " + MyInvocation.InvocationName);
85 | if (!new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator))
86 | {
87 | WriteWarning("To perform some operations you must run an elevated Windows PowerShell console.");
88 | }
89 |
90 | WUToolsObj = new WUTools();
91 | OutputObj = [];
92 | if (SendReport)
93 | {
94 | WriteDebug(DateTime.Now + " Test smtp settings");
95 | if (!PSWUSettings.ContainsKey("Properties"))
96 | {
97 | PSWUSettings.Add("Properties", new LastResults());
98 | }
99 |
100 | var psObject = WUToolsObj.TestMail(PSWUSettings);
101 | if (psObject.Properties.Match("ErrorRecord").Count == 1)
102 | {
103 | WriteError((ErrorRecord)psObject.Properties["ErrorRecord"].Value);
104 | SendReport = false;
105 | WriteDebug(DateTime.Now + " Disabling -SendReport");
106 | }
107 | }
108 |
109 | if (ComputerName != null)
110 | {
111 | return;
112 | }
113 |
114 | ComputerName =
115 | [
116 | Environment.MachineName
117 | ];
118 | }
119 |
120 | private void CoreProcessing()
121 | {
122 | foreach (var target in ComputerName)
123 | {
124 | var now = DateTime.Now;
125 | WriteDebug(now + " " + target + ": Connecting...");
126 | try
127 | {
128 | var pswuModule = WUToolsObj.GetPSWUModule(target);
129 | now = DateTime.Now;
130 | WriteDebug(now + " Module version: " + pswuModule.Properties["Version"].Value);
131 | now = DateTime.Now;
132 | WriteDebug(now + " Dll version: " + pswuModule.Properties["PSWUDllVersion"].Value);
133 | }
134 | catch
135 | {
136 | }
137 |
138 | now = DateTime.Now;
139 | var action = "(" + now + ") Get Windows Update last result";
140 | if (ShouldProcess(target, action))
141 | {
142 | var sendToPipeline = new PSObject();
143 | var apiAutoUpdateObj = WUToolsObj.GetWUApiAutoUpdateObj(target);
144 | now = DateTime.Now;
145 | WriteDebug(now + " psAutoUpdate mode: " + apiAutoUpdateObj.Mode);
146 | if (apiAutoUpdateObj.Status)
147 | {
148 | var psObject = new PSObject(new PSObject(apiAutoUpdateObj.Object).Properties["Results"].Value);
149 | sendToPipeline.Properties.Add(new PSNoteProperty("ComputerName", target));
150 | sendToPipeline.Properties.Add(new PSNoteProperty("LastSearchSuccessDate",
151 | psObject.Properties["LastSearchSuccessDate"].Value));
152 | sendToPipeline.Properties.Add(new PSNoteProperty("LastInstallationSuccessDate",
153 | psObject.Properties["LastInstallationSuccessDate"].Value));
154 | WriteObject(sendToPipeline, true);
155 | OutputObj.Add(sendToPipeline);
156 | }
157 | else if (Debuger)
158 | {
159 | WriteError(new ErrorRecord(apiAutoUpdateObj.Exception, "Debug", ErrorCategory.CloseError, null));
160 | }
161 | else
162 | {
163 | WriteError(apiAutoUpdateObj.Error);
164 | }
165 | }
166 | }
167 | }
168 |
169 | /// Process
170 | protected override void ProcessRecord()
171 | {
172 | var flag = false;
173 | if (Credential != null)
174 | {
175 | var userName = Credential.GetNetworkCredential().UserName;
176 | var domain = Credential.GetNetworkCredential().Domain;
177 | var password = Credential.GetNetworkCredential().Password;
178 | WriteDebug(DateTime.Now + " UserName: " + userName + "; Domain: " + domain + "; Password: " + password.Substring(0, 1) +
179 | "*****");
180 | var windowsPrincipal1 = new WindowsPrincipal(WindowsIdentity.GetCurrent());
181 | var str1 = "";
182 | if (windowsPrincipal1.IsInRole(WindowsBuiltInRole.Administrator))
183 | {
184 | str1 = "RunAs";
185 | }
186 |
187 | var strArray1 = new string[5];
188 | var now = DateTime.Now;
189 | strArray1[0] = now.ToString();
190 | strArray1[1] = " Before User: ";
191 | strArray1[2] = WindowsIdentity.GetCurrent().Name;
192 | strArray1[3] = " ";
193 | strArray1[4] = str1;
194 | WriteDebug(string.Concat(strArray1));
195 | var logonType = WUImpersonator.LogonSessionType.Interactive;
196 | var logonProvider = WUImpersonator.LogonProvider.Default;
197 | if (!WUToolsObj.IsLocalHost(ComputerName[0]))
198 | {
199 | logonType = WUImpersonator.LogonSessionType.NewCredentials;
200 | logonProvider = WUImpersonator.LogonProvider.WinNT50;
201 | }
202 |
203 | using (new WUImpersonator(userName, domain, password, logonType, logonProvider))
204 | {
205 | if (new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator))
206 | {
207 | var str2 = "RunAs";
208 | var strArray2 = new string[9];
209 | now = DateTime.Now;
210 | strArray2[0] = now.ToString();
211 | strArray2[1] = " Impersonated User (";
212 | strArray2[2] = logonType.ToString();
213 | strArray2[3] = "|";
214 | strArray2[4] = logonProvider.ToString();
215 | strArray2[5] = "): ";
216 | strArray2[6] = WindowsIdentity.GetCurrent().Name;
217 | strArray2[7] = " ";
218 | strArray2[8] = str2;
219 | WriteDebug(string.Concat(strArray2));
220 | try
221 | {
222 | CoreProcessing();
223 | flag = false;
224 | }
225 | catch (Exception ex)
226 | {
227 | WriteDebug(DateTime.Now + " Something goes wrong: " + ex.Message);
228 | flag = true;
229 | }
230 | }
231 | else
232 | {
233 | var str3 = "Can't RunAs";
234 | var strArray3 = new string[9];
235 | now = DateTime.Now;
236 | strArray3[0] = now.ToString();
237 | strArray3[1] = " Impersonated User (";
238 | strArray3[2] = logonType.ToString();
239 | strArray3[3] = "|";
240 | strArray3[4] = logonProvider.ToString();
241 | strArray3[5] = "): ";
242 | strArray3[6] = WindowsIdentity.GetCurrent().Name;
243 | strArray3[7] = " ";
244 | strArray3[8] = str3;
245 | WriteDebug(string.Concat(strArray3));
246 | flag = true;
247 | }
248 |
249 | now = DateTime.Now;
250 | WriteDebug(now + " Leaving impersonated session");
251 | }
252 |
253 | var windowsPrincipal2 = new WindowsPrincipal(WindowsIdentity.GetCurrent());
254 | var str4 = "";
255 | if (windowsPrincipal2.IsInRole(WindowsBuiltInRole.Administrator))
256 | {
257 | str4 = "RunAs";
258 | }
259 |
260 | WriteDebug(DateTime.Now + " After User: " + WindowsIdentity.GetCurrent().Name + " " + str4);
261 | }
262 | else
263 | {
264 | flag = true;
265 | }
266 |
267 | if (!flag)
268 | {
269 | return;
270 | }
271 |
272 | CoreProcessing();
273 | }
274 |
275 | /// End
276 | protected override void EndProcessing()
277 | {
278 | CmdletEnd = DateTime.Now;
279 | var CmdletInfo = new PSObject();
280 | CmdletInfo.Properties.Add(new PSNoteProperty("CmdletStart", CmdletStart));
281 | CmdletInfo.Properties.Add(new PSNoteProperty("CmdletEnd", CmdletEnd));
282 | CmdletInfo.Properties.Add(new PSNoteProperty("CmdletLine", MyInvocation.Line));
283 | if (SendReport)
284 | {
285 | WriteDebug(DateTime.Now + " Send report");
286 | if (!PSWUSettings.ContainsKey("Properties"))
287 | {
288 | PSWUSettings.Add("Properties", new LastResults());
289 | }
290 |
291 | var psObject = WUToolsObj.SendMail(PSWUSettings, OutputObj, CmdletInfo);
292 | if (psObject.Properties.Match("ErrorRecord").Count == 1)
293 | {
294 | WriteError((ErrorRecord)psObject.Properties["ErrorRecord"].Value);
295 | }
296 | }
297 |
298 | WriteDebug(DateTime.Now + " CmdletEnd");
299 | }
300 | }
301 | }
--------------------------------------------------------------------------------
/src/GetWUTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.ObjectModel;
4 | using System.Management.Automation;
5 | using System.Security.Principal;
6 |
7 | namespace PSWindowsUpdate
8 | {
9 | ///
10 | /// Test cmdlet.
11 | /// Use Get-WUTest cmdlet to test.
12 | ///
13 | /// Author Blog
14 | ///
15 | ///
16 | /// Test.
17 | ///
18 | /// Get-WUTest
19 | ///
20 | ///
21 | ///
22 | [Cmdlet("Get", "WUTest", ConfirmImpact = ConfirmImpact.Medium, SupportsShouldProcess = true)]
23 | public class GetWUTest : PSCmdlet
24 | {
25 | private Hashtable _PSWUSettings = new Hashtable();
26 |
27 | ///
28 | /// Specify one or more computer names for remote connection.
29 | ///
30 | [Parameter(ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)]
31 | public string[] ComputerName { get; set; }
32 |
33 | ///
34 | /// Specify alternative credential.
35 | ///
36 | [Parameter]
37 | public PSCredential Credential { get; set; }
38 |
39 | ///
40 | /// Send report email to specific recipients.
41 | /// Requires the parameter -PSWUSettings or declare the PSWUSettings.xml file in ModuleBase path.
42 | ///
43 | [Parameter]
44 | public SwitchParameter SendReport { get; set; }
45 |
46 | ///
47 | /// Required parameter for -SendReport.
48 | /// Passes the parameters (as hashtable) necessary to send the report:
49 | /// \r\n@{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25];[Subject="Alternative Subject"];[Properties="Alternative object properties"];[Style="Table|List"]}
50 | /// Send parameters can also be saved to a PSWUSettings.xml file in ModuleBase path:
51 | /// \r\nExport-Clixml @{SmtpServer="your.smtp.server";From="sender@email.address";To="recipient@email.address";[Port=25]}"
52 | ///
53 | [Parameter]
54 | public Hashtable PSWUSettings
55 | {
56 | get => _PSWUSettings;
57 | set => _PSWUSettings = value;
58 | }
59 |
60 | ///
61 | /// Debuger return original exceptions.
62 | ///
63 | [Parameter]
64 | public SwitchParameter Debuger { get; set; }
65 |
66 | ///
67 | /// Test parameter.
68 | ///
69 | [Parameter]
70 | public string TestParam { get; set; }
71 |
72 | private static WUImpersonator ImpersonatorObj { get; set; }
73 |
74 | private static WUTools WUToolsObj { get; set; }
75 |
76 | private static Collection OutputObj { get; set; }
77 |
78 | private static DateTime CmdletStart { get; set; }
79 |
80 | private static DateTime CmdletEnd { get; set; }
81 |
82 | /// Begin
83 | protected override void BeginProcessing()
84 | {
85 | CmdletStart = DateTime.Now;
86 | WriteDebug(DateTime.Now + " CmdletStart: " + MyInvocation.InvocationName);
87 | if (!new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator))
88 | {
89 | WriteWarning("To perform some operations you must run an elevated Windows PowerShell console.");
90 | }
91 |
92 | WUToolsObj = new WUTools();
93 | OutputObj = [];
94 | if (SendReport)
95 | {
96 | WriteDebug(DateTime.Now + " Test smtp settings");
97 | if (!PSWUSettings.ContainsKey("Properties"))
98 | {
99 | PSWUSettings.Add("Properties", new string[1]
100 | {
101 | "*"
102 | });
103 | }
104 |
105 | var psObject = WUToolsObj.TestMail(PSWUSettings);
106 | if (psObject.Properties.Match("ErrorRecord").Count == 1)
107 | {
108 | WriteError((ErrorRecord)psObject.Properties["ErrorRecord"].Value);
109 | SendReport = false;
110 | WriteDebug(DateTime.Now + " Disabling -SendReport");
111 | }
112 | }
113 |
114 | if (ComputerName != null)
115 | {
116 | return;
117 | }
118 |
119 | ComputerName =
120 | [
121 | Environment.MachineName
122 | ];
123 | }
124 |
125 | private void CoreProcessing()
126 | {
127 | foreach (var target in ComputerName)
128 | {
129 | WriteObject(new WUCimSession(target).ScanForUpdates());
130 | }
131 | }
132 |
133 | /// Process
134 | protected override void ProcessRecord()
135 | {
136 | var flag = false;
137 | if (Credential != null)
138 | {
139 | var userName = Credential.GetNetworkCredential().UserName;
140 | var domain = Credential.GetNetworkCredential().Domain;
141 | var password = Credential.GetNetworkCredential().Password;
142 | WriteDebug(DateTime.Now + " UserName: " + userName + "; Domain: " + domain + "; Password: " + password.Substring(0, 1) +
143 | "*****");
144 | var windowsPrincipal1 = new WindowsPrincipal(WindowsIdentity.GetCurrent());
145 | var str1 = "";
146 | if (windowsPrincipal1.IsInRole(WindowsBuiltInRole.Administrator))
147 | {
148 | str1 = "RunAs";
149 | }
150 |
151 | var strArray1 = new string[5];
152 | var now = DateTime.Now;
153 | strArray1[0] = now.ToString();
154 | strArray1[1] = " Before User: ";
155 | strArray1[2] = WindowsIdentity.GetCurrent().Name;
156 | strArray1[3] = " ";
157 | strArray1[4] = str1;
158 | WriteDebug(string.Concat(strArray1));
159 | var logonType = WUImpersonator.LogonSessionType.Interactive;
160 | var logonProvider = WUImpersonator.LogonProvider.Default;
161 | if (!WUToolsObj.IsLocalHost(ComputerName[0]))
162 | {
163 | logonType = WUImpersonator.LogonSessionType.NewCredentials;
164 | logonProvider = WUImpersonator.LogonProvider.WinNT50;
165 | }
166 |
167 | using (new WUImpersonator(userName, domain, password, logonType, logonProvider))
168 | {
169 | if (new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator))
170 | {
171 | var str2 = "RunAs";
172 | var strArray2 = new string[9];
173 | now = DateTime.Now;
174 | strArray2[0] = now.ToString();
175 | strArray2[1] = " Impersonated User (";
176 | strArray2[2] = logonType.ToString();
177 | strArray2[3] = "|";
178 | strArray2[4] = logonProvider.ToString();
179 | strArray2[5] = "): ";
180 | strArray2[6] = WindowsIdentity.GetCurrent().Name;
181 | strArray2[7] = " ";
182 | strArray2[8] = str2;
183 | WriteDebug(string.Concat(strArray2));
184 | try
185 | {
186 | CoreProcessing();
187 | flag = false;
188 | }
189 | catch (Exception ex)
190 | {
191 | WriteDebug(DateTime.Now + " Something goes wrong: " + ex.Message);
192 | flag = true;
193 | }
194 | }
195 | else
196 | {
197 | var str3 = "Can't RunAs";
198 | var strArray3 = new string[9];
199 | now = DateTime.Now;
200 | strArray3[0] = now.ToString();
201 | strArray3[1] = " Impersonated User (";
202 | strArray3[2] = logonType.ToString();
203 | strArray3[3] = "|";
204 | strArray3[4] = logonProvider.ToString();
205 | strArray3[5] = "): ";
206 | strArray3[6] = WindowsIdentity.GetCurrent().Name;
207 | strArray3[7] = " ";
208 | strArray3[8] = str3;
209 | WriteDebug(string.Concat(strArray3));
210 | flag = true;
211 | }
212 |
213 | now = DateTime.Now;
214 | WriteDebug(now + " Leaving impersonated session");
215 | }
216 |
217 | var windowsPrincipal2 = new WindowsPrincipal(WindowsIdentity.GetCurrent());
218 | var str4 = "";
219 | if (windowsPrincipal2.IsInRole(WindowsBuiltInRole.Administrator))
220 | {
221 | str4 = "RunAs";
222 | }
223 |
224 | WriteDebug(DateTime.Now + " After User: " + WindowsIdentity.GetCurrent().Name + " " + str4);
225 | }
226 | else
227 | {
228 | flag = true;
229 | }
230 |
231 | if (!flag)
232 | {
233 | return;
234 | }
235 |
236 | CoreProcessing();
237 | }
238 |
239 | /// End
240 | protected override void EndProcessing()
241 | {
242 | CmdletEnd = DateTime.Now;
243 | var CmdletInfo = new PSObject();
244 | CmdletInfo.Properties.Add(new PSNoteProperty("CmdletStart", CmdletStart));
245 | CmdletInfo.Properties.Add(new PSNoteProperty("CmdletEnd", CmdletEnd));
246 | CmdletInfo.Properties.Add(new PSNoteProperty("CmdletLine", MyInvocation.Line));
247 | if (SendReport)
248 | {
249 | WriteDebug(DateTime.Now + " Send report");
250 | if (!PSWUSettings.ContainsKey("Properties"))
251 | {
252 | PSWUSettings.Add("Properties", "*");
253 | }
254 |
255 | var psObject = WUToolsObj.SendMail(PSWUSettings, OutputObj, CmdletInfo);
256 | if (psObject.Properties.Match("ErrorRecord").Count == 1)
257 | {
258 | WriteError((ErrorRecord)psObject.Properties["ErrorRecord"].Value);
259 | }
260 | }
261 |
262 | WriteDebug(DateTime.Now + " CmdletEnd");
263 | }
264 | }
265 | }
--------------------------------------------------------------------------------
/src/History.cs:
--------------------------------------------------------------------------------
1 | namespace PSWindowsUpdate
2 | {
3 | ///
4 | /// OutputType
5 | /// OutputType for History objects.
6 | ///
7 | public class History
8 | {
9 | /// ComputerName
10 | public string ComputerName { get; set; }
11 |
12 | /// Operationname
13 | public string Operationname { get; set; }
14 |
15 | /// Date
16 | public string Date { get; set; }
17 |
18 | /// KB
19 | public string KB { get; set; }
20 |
21 | /// Title
22 | public string Title { get; set; }
23 | }
24 | }
--------------------------------------------------------------------------------
/src/InstallerStatus.cs:
--------------------------------------------------------------------------------
1 | namespace PSWindowsUpdate
2 | {
3 | ///
4 | /// OutputType
5 | /// OutputType for InstallerStatus objects.
6 | ///
7 | public class InstallerStatus
8 | {
9 | /// ComputerName
10 | public string ComputerName { get; set; }
11 |
12 | /// IsBusy
13 | public bool IsBusy { get; set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/src/LastResults.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace PSWindowsUpdate
4 | {
5 | ///
6 | /// OutputType
7 | /// OutputType for LastResult objects.
8 | ///
9 | public class LastResults
10 | {
11 | /// ComputerName
12 | public string ComputerName { get; set; }
13 |
14 | /// LastSearchSuccessDate
15 | public DateTime LastSearchSuccessDate { get; set; }
16 |
17 | /// LastInstallationSuccessDate
18 | public DateTime LastInstallationSuccessDate { get; set; }
19 | }
20 | }
--------------------------------------------------------------------------------
/src/NativeMethods.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Win32.SafeHandles;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Runtime.InteropServices;
6 | using System.Text;
7 |
8 | namespace PSWindowsUpdate
9 | {
10 | public class NativeMethods
11 | {
12 | ///
13 | /// The CredRead function reads a credential from the user's credential set.
14 | /// The credential set used is the one associated with the logon session of the current token.
15 | /// The token must not have the user's SID disabled.
16 | ///
17 | ///
18 | /// If the value of the Type member of the CREDENTIAL structure specified by the Credential parameter is
19 | /// CRED_TYPE_DOMAIN_EXTENDED, a namespace must be specified in the target name. This function can return only one
20 | /// credential of the specified type.
21 | ///
22 | /// Pointer to a null-terminated string that contains the name of the credential to read.
23 | /// Type of the credential to read. Type must be one of the CRED_TYPE_* defined types.
24 | /// Currently reserved and must be zero.
25 | ///
26 | /// Pointer to a single allocated block buffer to return the credential.
27 | /// Any pointers contained within the buffer are pointers to locations within this single allocated block.
28 | /// The single returned buffer must be freed by calling CredFree.
29 | ///
30 | /// The function returns TRUE on success and FALSE on failure.
31 | [DllImport("Advapi32.dll", EntryPoint = "CredReadW", CharSet = CharSet.Unicode, SetLastError = true)]
32 | internal static extern bool CredRead(
33 | string target,
34 | CredentialType type,
35 | int reservedFlag,
36 | out IntPtr credentialPtr);
37 |
38 | ///
39 | /// The CredWrite function creates a new credential or modifies an existing credential in the user's credential set.
40 | /// The new credential is associated with the logon session of the current token.
41 | /// The token must not have the user's security identifier (SID) disabled.
42 | ///
43 | ///
44 | /// This function creates a credential if a credential with the specified TargetName and Type does not exist. If a
45 | /// credential with the specified TargetName and Type exists, the new specified credential replaces the existing one.
46 | /// When this function writes a CRED_TYPE_CERTIFICATE credential, the Credential->CredentialBlob member specifies the
47 | /// PIN protecting the private key of the certificate specified by the Credential->UserName member. The credential
48 | /// manager does not maintain the PIN. Rather, the PIN is passed to the cryptographic service provider (CSP) indicated
49 | /// on the certificate for later use by the CSP and the authentication packages. The CSP defines the lifetime of the
50 | /// PIN. Most CSPs flush the PIN when the smart card removal from the smart card reader.
51 | /// If the value of the Type member of the CREDENTIAL structure specified by the Credential parameter is
52 | /// CRED_TYPE_DOMAIN_EXTENDED, a namespace must be specified in the target name. This function does not support writing
53 | /// to target names that contain wildcards.
54 | ///
55 | /// A pointer to the CREDENTIAL structure to be written.
56 | /// Flags that control the function's operation. The following flag is defined.
57 | /// If the function succeeds, the function returns TRUE, if the function fails, it returns FALSE.
58 | [DllImport("Advapi32.dll", EntryPoint = "CredWriteW", CharSet = CharSet.Unicode, SetLastError = true)]
59 | internal static extern bool CredWrite([In] ref CREDENTIAL userCredential, [In] uint flags);
60 |
61 | ///
62 | /// The CredFree function frees a buffer returned by any of the credentials management functions.
63 | ///
64 | /// Pointer to the buffer to be freed.
65 | [DllImport("Advapi32.dll", SetLastError = true)]
66 | internal static extern void CredFree([In] IntPtr cred);
67 |
68 | ///
69 | /// The CredDelete function deletes a credential from the user's credential set.
70 | /// The credential set used is the one associated with the logon session of the current token.
71 | /// The token must not have the user's SID disabled.
72 | ///
73 | /// Pointer to a null-terminated string that contains the name of the credential to delete.
74 | ///
75 | /// Type of the credential to delete. Must be one of the CRED_TYPE_* defined types.
76 | /// For a list of the defined types, see the Type member of the CREDENTIAL structure.
77 | /// If the value of this parameter is CRED_TYPE_DOMAIN_EXTENDED,
78 | /// this function can delete a credential that specifies a user name when there are multiple credentials for the same
79 | /// target. The value of the TargetName parameter must specify the user name as Target|UserName.
80 | ///
81 | /// Reserved and must be zero.
82 | /// The function returns TRUE on success and FALSE on failure.
83 | [DllImport("Advapi32.dll", EntryPoint = "CredDeleteW", CharSet = CharSet.Unicode)]
84 | internal static extern bool CredDelete(StringBuilder target, CredentialType type, int flags);
85 |
86 | ///
87 | /// Enumerate credentials in the credential store
88 | /// signature: BOOL CredEnumerate (
89 | /// _In_ LPCTSTR Filter,
90 | /// _In_ DWORD Flags,
91 | /// _Out_ DWORD *Count,
92 | /// _Out_ PCREDENTIAL **Credentials
93 | /// );
94 | /// [in]
95 | /// Pointer to a null-terminated string that contains the filter for the returned credentials.Only credentials with a TargetName matching the filter will be returned.The filter specifies a name prefix followed by an asterisk.For instance, the filter "FRED*" will return all credentials with a TargetName beginning with the string "FRED".
96 | /// If NULL is specified, all credentials will be returned.
97 | /// [in]
98 | /// The value of this parameter can be zero or more of the following values combined with a bitwise-OR operation.
99 | /// Value Meaning
100 | /// CRED_ENUMERATE_ALL_CREDENTIALS 0x1
101 | /// This function enumerates all of the credentials in the user's credential set. The target name of each credential is returned in the "namespace:attribute=target" format. If this flag is set and the Filter parameter is not NULL, the function fails and returns ERROR_INVALID_FLAGS.
102 | /// Windows Server 2003 and Windows XP: This flag is not supported.
103 | ///
104 | /// [out] Count of the credentials returned in the Credentials array.
105 | /// [out]
106 | /// Pointer to an array of pointers to credentials.The returned credential is a single allocated block. Any pointers contained within the buffer are pointers to locations within this single allocated block.The single returned buffer must be freed by calling CredFree.
107 | /// Return value
108 | ///
109 | ///
110 | /// The function returns TRUE on success and FALSE on failure. The GetLastError function can be called to get a more specific status code.The following status codes can be returned.
111 | /// Return code/value Description
112 | /// ERROR_NOT_FOUND
113 | /// 1168 (0x490)
114 | /// No credential exists matching the specified Filter.
115 | /// ERROR_NO_SUCH_LOGON_SESSION
116 | /// 1312 (0x520)
117 | /// The logon session does not exist or there is no credential set associated with this logon session. Network logon sessions do not have an associated credential set.
118 | /// ERROR_INVALID_FLAGS
119 | /// 1004 (0x3EC)
120 | /// A flag that is not valid was specified for the Flags parameter, or CRED_ENUMERATE_ALL_CREDENTIALS is specified for the Flags parameter and the Filter parameter is not NULL.
121 | ///
122 | ///
123 | [DllImport("Advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
124 | internal static extern bool CredEnumerate(
125 | string filter,
126 | int flag,
127 | out int count,
128 | out IntPtr pCredentials);
129 |
130 | internal static IEnumerable CredEnumerate()
131 | {
132 | int count;
133 | IntPtr pCredentials;
134 | if (!CredEnumerate(null, 0, out count, out pCredentials))
135 | {
136 | throw new Exception("Failed to enumerate credentials");
137 | }
138 |
139 | var source = new IntPtr[count];
140 | for (var index = 0; index < count; ++index)
141 | {
142 | source[index] = Marshal.ReadIntPtr(pCredentials, index * Marshal.SizeOf(typeof(IntPtr)));
143 | }
144 |
145 | return source.Select(ptr => (CREDENTIAL)Marshal.PtrToStructure(ptr, typeof(CREDENTIAL)));
146 | }
147 |
148 | ///
149 | /// The CREDENTIAL structure contains an individual credential.
150 | ///
151 | /// See CREDENTIAL structure documentation.
152 | ///
153 | internal struct CREDENTIAL
154 | {
155 | public int Flags;
156 | public int Type;
157 | [MarshalAs(UnmanagedType.LPWStr)] public string TargetName;
158 | [MarshalAs(UnmanagedType.LPWStr)] public string Comment;
159 | public long LastWritten;
160 | public int CredentialBlobSize;
161 | public IntPtr CredentialBlob;
162 | public int Persist;
163 | public int AttributeCount;
164 | public IntPtr Attributes;
165 | [MarshalAs(UnmanagedType.LPWStr)] public string TargetAlias;
166 | [MarshalAs(UnmanagedType.LPWStr)] public string UserName;
167 | }
168 |
169 | internal sealed class CriticalCredentialHandle : CriticalHandleZeroOrMinusOneIsInvalid
170 | {
171 | internal CriticalCredentialHandle(IntPtr preexistingHandle)
172 | {
173 | SetHandle(preexistingHandle);
174 | }
175 |
176 | internal CREDENTIAL GetCredential()
177 | {
178 | if (!IsInvalid)
179 | {
180 | return (CREDENTIAL)Marshal.PtrToStructure(handle, typeof(CREDENTIAL));
181 | }
182 |
183 | throw new InvalidOperationException("Invalid CriticalHandle!");
184 | }
185 |
186 | protected override bool ReleaseHandle()
187 | {
188 | if (IsInvalid)
189 | {
190 | return false;
191 | }
192 |
193 | CredFree(handle);
194 | SetHandleAsInvalid();
195 | return true;
196 | }
197 | }
198 | }
199 | }
--------------------------------------------------------------------------------
/src/OfflineMSU.cs:
--------------------------------------------------------------------------------
1 | namespace PSWindowsUpdate
2 | {
3 | ///
4 | /// OutputType
5 | /// OutputType for MSU objects.
6 | ///
7 | public class OfflineMSU
8 | {
9 | /// Status
10 | public string Status { get; set; }
11 |
12 | /// ComputerName
13 | public string Title { get; set; }
14 |
15 | /// KB
16 | public string Product { get; set; }
17 |
18 | /// Size
19 | public string LastUpdated { get; set; }
20 |
21 | /// Title
22 | public string Size { get; set; }
23 | }
24 | }
--------------------------------------------------------------------------------
/src/PSCredMan.cs:
--------------------------------------------------------------------------------
1 | namespace PSWindowsUpdate
2 | {
3 | ///
4 | /// OutputType
5 | /// OutputType for credentials from Credential Manager.
6 | ///
7 | public class PSCredMan
8 | {
9 | /// Username
10 | public string Username { get; set; }
11 |
12 | /// Password
13 | public string Password { get; set; }
14 |
15 | /// Domain
16 | public string Domain { get; set; }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/PersistenceType.cs:
--------------------------------------------------------------------------------
1 | namespace PSWindowsUpdate
2 | {
3 | ///
4 | /// Wrapper for advapi32.dll library.
5 | /// Advanced Services
6 | /// Provide access to functionality additional to the kernel.
7 | /// Included are things like the Windows registry, shutdown/restart the system (or abort),
8 | /// start/stop/create a Windows service, manage user accounts.
9 | /// These functions reside in advapi32.dll on 32-bit Windows.
10 | ///
11 | ///
12 | /// Enum PersistenceType
13 | /// Defines the persistence of this credential. This member can be read and written.
14 | ///
15 | public enum PersistenceType : uint
16 | {
17 | ///
18 | /// The session persistence type
19 | /// The credential persists for the life of the logon session.
20 | /// It will not be visible to other logon sessions of this same user.
21 | /// It will not exist after this user logs off and back on.
22 | ///
23 | Session = 1,
24 |
25 | ///
26 | /// The local computer persistence type
27 | /// The credential persists for all subsequent logon sessions on this same computer.
28 | /// It is visible to other logon sessions of this same user on this same computer
29 | /// and not visible to logon sessions for this user on other computers.
30 | ///
31 | LocalComputer = 2,
32 |
33 | ///
34 | /// The enterprise persistence type
35 | /// The credential persists for all subsequent logon sessions on this same computer. It is visible to other logon
36 | /// sessions of this same user on this same computer and to logon sessions for this user on other computers.
37 | /// this option can be implemented as locally persisted credential if the administrator or user configures the user
38 | /// account to not have roam-able state. For instance, if the user has no roaming profile, the credential will only
39 | /// persist locally.
40 | ///
41 | Enterprise = 3
42 | }
43 | }
--------------------------------------------------------------------------------
/src/RebootStatus.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace PSWindowsUpdate
4 | {
5 | ///
6 | /// OutputType
7 | /// OutputType for RebootStatus objects.
8 | ///
9 | public class RebootStatus
10 | {
11 | /// ComputerName
12 | public string ComputerName { get; set; }
13 |
14 | public bool RebootRequired { get; set; }
15 |
16 | public DateTime? RebootScheduled { get; set; }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/SecureStringHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using System.Security;
4 |
5 | namespace PSWindowsUpdate
6 | {
7 | [SuppressUnmanagedCodeSecurity]
8 | internal static class SecureStringHelper
9 | {
10 | internal static unsafe SecureString CreateSecureString(string plainString)
11 | {
12 | if (string.IsNullOrEmpty(plainString))
13 | {
14 | return new SecureString();
15 | }
16 |
17 | SecureString secureString;
18 | fixed (char* chPtr = plainString)
19 | {
20 | secureString = new SecureString(chPtr, plainString.Length);
21 | secureString.MakeReadOnly();
22 | }
23 |
24 | return secureString;
25 | }
26 |
27 | internal static string CreateString(SecureString secureString)
28 | {
29 | if (secureString == null || secureString.Length == 0)
30 | {
31 | return string.Empty;
32 | }
33 |
34 | var num = IntPtr.Zero;
35 | string stringBstr;
36 | try
37 | {
38 | num = Marshal.SecureStringToBSTR(secureString);
39 | stringBstr = Marshal.PtrToStringBSTR(num);
40 | }
41 | finally
42 | {
43 | if (num != IntPtr.Zero)
44 | {
45 | Marshal.ZeroFreeBSTR(num);
46 | }
47 | }
48 |
49 | return stringBstr;
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/src/ServiceManager.cs:
--------------------------------------------------------------------------------
1 | namespace PSWindowsUpdate
2 | {
3 | ///
4 | /// OutputType
5 | /// OutputType for ServiceManager objects.
6 | ///
7 | public class ServiceManager
8 | {
9 | /// ComputerName
10 | public string ComputerName { get; set; }
11 |
12 | /// Name
13 | public string Name { get; set; }
14 |
15 | /// ServiceID
16 | public string ServiceID { get; set; }
17 |
18 | /// IsManaged
19 | public string IsManaged { get; set; }
20 |
21 | /// IsDefaultAUService
22 | public string IsDefaultAUService { get; set; }
23 | }
24 | }
--------------------------------------------------------------------------------
/src/ValidateDateTimeAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Management.Automation;
3 |
4 | namespace PSWindowsUpdate
5 | {
6 | /// ValidateScheduleJobAttribute
7 | internal class ValidateDateTimeAttribute : ValidateArgumentsAttribute
8 | {
9 | protected override void Validate(object arguments, EngineIntrinsics engineIntrinsics)
10 | {
11 | if ((DateTime)arguments < DateTime.Now)
12 | {
13 | throw new SystemException("Execution time is gone.");
14 | }
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/src/ValidateIntGt0Attribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Management.Automation;
3 |
4 | namespace PSWindowsUpdate
5 | {
6 | /// Int must be gt 0
7 | internal class ValidateIntGt0Attribute : ValidateArgumentsAttribute
8 | {
9 | protected override void Validate(object arguments, EngineIntrinsics engineIntrinsics)
10 | {
11 | if ((int)arguments <= 0)
12 | {
13 | throw new SystemException("Value must be greater than 0.");
14 | }
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/src/ValidateRecurseCycleAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Management.Automation;
3 |
4 | namespace PSWindowsUpdate
5 | {
6 | /// ValidateRecurseCycleAttribute
7 | internal class ValidateRecurseCycleAttribute : ValidateArgumentsAttribute
8 | {
9 | protected override void Validate(object arguments, EngineIntrinsics engineIntrinsics)
10 | {
11 | if ((int)arguments <= 1)
12 | {
13 | throw new SystemException("Recursive cycle must be greater than 1. First run is the main cycle.");
14 | }
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/src/ValidateTestAttribute.cs:
--------------------------------------------------------------------------------
1 | using System.Management.Automation;
2 |
3 | namespace PSWindowsUpdate
4 | {
5 | /// ValidateTestAttribute
6 | internal class ValidateTestAttribute : ValidateArgumentsAttribute
7 | {
8 | protected override void Validate(object arguments, EngineIntrinsics engineIntrinsics)
9 | {
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/src/WUAPIObject.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Management.Automation;
3 |
4 | namespace PSWindowsUpdate
5 | {
6 | /// Return Windows Update API COM object.
7 | public class WUAPIObject
8 | {
9 | /// ComputerName
10 | public string ComputerName { get; set; }
11 |
12 | /// Status
13 | public bool Status { get; set; }
14 |
15 | /// Object
16 | public object Object { get; set; }
17 |
18 | /// Error
19 | public ErrorRecord Error { get; set; }
20 |
21 | /// Exception
22 | public Exception Exception { get; set; }
23 |
24 | /// Mode
25 | public string Mode { get; set; }
26 | }
27 | }
--------------------------------------------------------------------------------
/src/WUApiCode.cs:
--------------------------------------------------------------------------------
1 | namespace PSWindowsUpdate
2 | {
3 | /// Return error code description.
4 | public class WUApiCode
5 | {
6 | /// ErrorCode in Hex
7 | public string HResult { get; set; }
8 |
9 | /// Short message
10 | public string Message { get; set; }
11 |
12 | /// Full Description
13 | public string Description { get; set; }
14 |
15 | /// Type of WUApiCode
16 | public int CodeType { get; set; }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/WUBits.cs:
--------------------------------------------------------------------------------
1 | using BITSReference4_0;
2 | using System;
3 | using System.Runtime.InteropServices;
4 |
5 | namespace PSWindowsUpdate
6 | {
7 | internal class WUBits
8 | {
9 | /// Download files from url using BITS.
10 | /// Source URL
11 | /// Destination path
12 | public string StartBitsTransfer(string Source, string Destination)
13 | {
14 | var backgroundCopyManager4_ =
15 | (BackgroundCopyManager4_0)Activator.CreateInstance(
16 | Marshal.GetTypeFromCLSID(new Guid("BB6DF56B-CACE-11DC-9992-0019B93A3A84")));
17 | backgroundCopyManager4_.CreateJob("Quick download", BG_JOB_TYPE.BG_JOB_TYPE_DOWNLOAD, out var _, out var ppJob);
18 | ppJob.AddFile(Source, Destination);
19 | ppJob.Resume();
20 | var flag = false;
21 | var result = "";
22 | while (!flag)
23 | {
24 | ppJob.GetState(out var pVal);
25 | switch (pVal)
26 | {
27 | case BG_JOB_STATE.BG_JOB_STATE_ERROR:
28 | result = "ERROR";
29 | flag = true;
30 | break;
31 | case BG_JOB_STATE.BG_JOB_STATE_TRANSFERRED:
32 | ppJob.Complete();
33 | result = "TRANSFERRED";
34 | break;
35 | case BG_JOB_STATE.BG_JOB_STATE_CANCELLED:
36 | result = "CANCELLED";
37 | break;
38 | case BG_JOB_STATE.BG_JOB_STATE_ACKNOWLEDGED:
39 | result = "ACKNOWLEDGED";
40 | flag = true;
41 | break;
42 | }
43 | }
44 |
45 | return result;
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/src/WUCimSession.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Management.Infrastructure;
2 | using System;
3 | using System.ComponentModel;
4 | using System.Globalization;
5 |
6 | namespace PSWindowsUpdate
7 | {
8 | internal class WUCimSession
9 | {
10 | private string ComputerName;
11 |
12 | public WUCimSession(string computerName)
13 | {
14 | ComputerName = computerName;
15 | }
16 |
17 | public CimMethodResult InvokeCimMethod(
18 | string cimClassName,
19 | string cimNamespace,
20 | string cimMethod,
21 | CimMethodParametersCollection cimParameters)
22 | {
23 | var instance = new CimInstance(cimClassName, cimNamespace);
24 | var cimMethodResult = CimSession.Create(ComputerName).InvokeMethod(instance, cimMethod, cimParameters);
25 | var int32 = Convert.ToInt32(cimMethodResult.ReturnValue.Value, (IFormatProvider)CultureInfo.CurrentCulture);
26 | if (int32 != 0)
27 | {
28 | Console.WriteLine(new Win32Exception(int32).Message);
29 | }
30 |
31 | return cimMethodResult;
32 | }
33 |
34 | public CimInstance[] ScanForUpdates(string searchCriteria = "IsInstalled = 0")
35 | {
36 | var className = "MSFT_WUOperations";
37 | var namespaceName = "root/Microsoft/Windows/WindowsUpdate";
38 | var methodName = nameof(ScanForUpdates);
39 | var methodParameters = new CimMethodParametersCollection();
40 | methodParameters.Add(CimMethodParameter.Create("SearchCriteria", (object)searchCriteria, CimType.String, CimFlags.None));
41 | var instance = new CimInstance(className, namespaceName);
42 | return (CimInstance[])CimSession.Create(ComputerName).InvokeMethod(instance, methodName, methodParameters)
43 | .OutParameters["Updates"].Value;
44 | }
45 |
46 | public CimMethodResult InstallUpdates(
47 | object updates,
48 | bool downloadOnly = false,
49 | bool rebootRequired = false)
50 | {
51 | var className = "MSFT_WUOperations";
52 | var namespaceName = "root/Microsoft/Windows/WindowsUpdate";
53 | var methodName = nameof(InstallUpdates);
54 | var methodParameters = new CimMethodParametersCollection();
55 | methodParameters.Add(CimMethodParameter.Create("Updates", updates, CimFlags.None));
56 | if (downloadOnly)
57 | {
58 | methodParameters.Add(CimMethodParameter.Create("DownloadOnly", true, CimFlags.None));
59 | }
60 |
61 | if (rebootRequired)
62 | {
63 | methodParameters.Add(CimMethodParameter.Create("RebootRequired", true, CimFlags.None));
64 | }
65 |
66 | var instance = new CimInstance(className, namespaceName);
67 | var cimSession = CimSession.Create(ComputerName);
68 | var cimMethodResult = (CimMethodResult)null;
69 | try
70 | {
71 | cimMethodResult = cimSession.InvokeMethod(instance, methodName, methodParameters);
72 | }
73 | catch (Exception ex)
74 | {
75 | Console.WriteLine(ex.Message);
76 | }
77 |
78 | return cimMethodResult;
79 | }
80 | }
81 | }
--------------------------------------------------------------------------------
/src/WUImpersonator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Runtime.InteropServices;
4 | using System.Security.Permissions;
5 | using System.Security.Principal;
6 |
7 | namespace PSWindowsUpdate
8 | {
9 | ///
10 | /// Impersonation of a user. Allows to execute code under another user context.
11 | /// Please note that the account that instantiates the Impersonator class
12 | /// needs to have the 'Act as part of operating system' privilege set.
13 | ///
14 | [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
15 | public class WUImpersonator : IDisposable
16 | {
17 | private WindowsImpersonationContext impersonationContext;
18 |
19 | ///
20 | /// Initializes a new instance of the class and
21 | /// impersonates as a built in service account.
22 | ///
23 | /// The built in user to impersonate - either
24 | /// Local Service or Network Service. These users can only be impersonated
25 | /// by code running as System.
26 | public WUImpersonator(BuiltinUser builtinUser)
27 | : this(string.Empty, "NT AUTHORITY", string.Empty, LogonSessionType.Service, builtinUser: BuiltinUser.LocalService)
28 | {
29 | }
30 |
31 | ///
32 | /// Initializes a new instance of the class and
33 | /// impersonates with the specified credentials.
34 | ///
35 | /// his is the name of the user account to log on
36 | /// to. If you use the user principal name (UPN) format,
37 | /// user@DNS_domain_name, the lpszDomain parameter must be null.
38 | /// The name of the domain or server whose account
39 | /// database contains the lpszUsername account. If this parameter is
40 | /// null, the user name must be specified in UPN format. If this
41 | /// parameter is ".", the function validates the account by using only the
42 | /// local account database.
43 | /// The plaintext password for the user account.
44 | public WUImpersonator(string username, string domain, string password)
45 | : this(username, domain, password, LogonSessionType.Interactive)
46 | {
47 | }
48 |
49 | ///
50 | /// Constructor. Starts the impersonation with the given credentials.
51 | /// Please note that the account that instantiates the Impersonator class
52 | /// needs to have the 'Act as part of operating system' privilege set.
53 | ///
54 | /// The name of the user to act as.
55 | /// The domain name of the user to act as.
56 | /// The password of the user to act as.
57 | /// Logon Session Type
58 | /// Logon Provider
59 | /// Builtin User
60 | public WUImpersonator(
61 | string userName,
62 | string domainName,
63 | string password,
64 | LogonSessionType logonType = LogonSessionType.Interactive,
65 | LogonProvider logonProvider = LogonProvider.Default,
66 | BuiltinUser builtinUser = BuiltinUser.None)
67 | {
68 | switch (builtinUser)
69 | {
70 | case BuiltinUser.None:
71 | if (string.IsNullOrEmpty(userName))
72 | {
73 | return;
74 | }
75 |
76 | break;
77 | case BuiltinUser.LocalService:
78 | userName = "LOCAL SERVICE";
79 | break;
80 | case BuiltinUser.NetworkService:
81 | userName = "NETWORK SERVICE";
82 | break;
83 | }
84 |
85 | ImpersonateValidUser(userName, domainName, password, logonType, logonProvider);
86 | }
87 |
88 | /// Destructor
89 | public void Dispose()
90 | {
91 | UndoImpersonation();
92 | }
93 |
94 | [DllImport("advapi32.dll", SetLastError = true)]
95 | private static extern int LogonUser(
96 | string lpszUserName,
97 | string lpszDomain,
98 | string lpszPassword,
99 | int dwLogonType,
100 | int dwLogonProvider,
101 | out IntPtr phToken);
102 |
103 | [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]
104 | private static extern int DuplicateToken(
105 | IntPtr hToken,
106 | int impersonationLevel,
107 | out IntPtr hNewToken);
108 |
109 | [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]
110 | private static extern bool RevertToSelf();
111 |
112 | [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
113 | private static extern bool CloseHandle(IntPtr handle);
114 |
115 | /// Does the actual impersonation.
116 | /// The name of the user to act as.
117 | /// The domain name of the user to act as.
118 | /// The password of the user to act as.
119 | /// Logon Session Type
120 | /// Logon Provider
121 | private void ImpersonateValidUser(
122 | string userName,
123 | string domainName,
124 | string password,
125 | LogonSessionType logonType,
126 | LogonProvider logonProvider)
127 | {
128 | var phToken = IntPtr.Zero;
129 | var hNewToken = IntPtr.Zero;
130 | try
131 | {
132 | if (!RevertToSelf())
133 | {
134 | throw new Win32Exception(Marshal.GetLastWin32Error());
135 | }
136 |
137 | if (LogonUser(userName, domainName, password, (int)logonType, (int)logonProvider, out phToken) == 0)
138 | {
139 | throw new Win32Exception(Marshal.GetLastWin32Error());
140 | }
141 |
142 | if (DuplicateToken(phToken, 3, out hNewToken) == 0)
143 | {
144 | throw new Win32Exception(Marshal.GetLastWin32Error());
145 | }
146 |
147 | impersonationContext = new WindowsIdentity(hNewToken).Impersonate();
148 | }
149 | finally
150 | {
151 | if (phToken != IntPtr.Zero)
152 | {
153 | CloseHandle(phToken);
154 | }
155 |
156 | if (hNewToken != IntPtr.Zero)
157 | {
158 | CloseHandle(hNewToken);
159 | }
160 | }
161 | }
162 |
163 | /// Reverts the impersonation.
164 | private void UndoImpersonation()
165 | {
166 | if (impersonationContext == null)
167 | {
168 | return;
169 | }
170 |
171 | impersonationContext.Undo();
172 | }
173 |
174 | /// Specifies the type of login session used.
175 | public enum LogonSessionType
176 | {
177 | ///
178 | /// Intended for users who are interactively using the machine, such as a user being logged on by a terminal server, remote shell, or similar process.
179 | ///
180 | Interactive = 2,
181 |
182 | ///
183 | /// Intended for high-performance servers to authenticate clear text passwords. LogonUser does not cache credentials for this logon type.
184 | ///
185 | Network = 3,
186 |
187 | ///
188 | /// Intended for batch servers, where processes can be executed on behalf of a user without their direct intervention; or for higher performance servers that process many clear-text authentication attempts at a time, such as mail or web servers. LogonUser does not cache credentials for this logon type.
189 | ///
190 | Batch = 4,
191 |
192 | ///
193 | /// Indicates a service-type logon. The account provided must have the service privilege enabled.
194 | ///
195 | Service = 5,
196 |
197 | /// Indicates a proxy-type logon.
198 | Proxy = 6,
199 |
200 | ///
201 | /// This logon type is intended for GINA DLLs logging on users who are interactively using the machine. This logon type allows a unique audit record to be generated that shows when the workstation was unlocked.
202 | ///
203 | Unlock = 7,
204 |
205 | ///
206 | /// Preserves the name and password in the authentication packages, allowing the server to make connections to other network servers while impersonating the client. This allows a server to accept clear text credentials from a client, call LogonUser, verify that the user can access the system across the network, and still communicate with other servers.
207 | ///
208 | NetworkCleartext = 8,
209 |
210 | ///
211 | /// Allows the caller to clone its current token and specify new credentials for outbound connections. The new logon session has the same local identify, but uses different credentials for other network connections.
212 | ///
213 | NewCredentials = 9,
214 |
215 | ///
216 | /// Terminal Services session that is both remote and interactive.
217 | ///
218 | RemoteInteractive = 10, // 0x0000000A
219 |
220 | ///
221 | /// Attempt cached credentials without accessing the network.
222 | ///
223 | CachedInteractive = 11, // 0x0000000B
224 |
225 | ///
226 | /// Same as RemoteInteractive. This is used for internal auditing.
227 | ///
228 | CachedRemoteInteractive = 12, // 0x0000000C
229 |
230 | /// Workstation logon.
231 | CachedUnlock = 13 // 0x0000000D
232 | }
233 |
234 | /// Specifies the logon provider.
235 | public enum LogonProvider
236 | {
237 | ///
238 | /// Use the standard logon provider for the system. The default security provider is negotiate, unless you pass NULL for the domain name and the user name is not in UPN format. In this case, the default provider is NTLM.
239 | ///
240 | Default,
241 |
242 | ///
243 | ///
244 | WinNT35,
245 |
246 | /// Use the NTLM logon provider.
247 | WinNT40,
248 |
249 | /// Use the negotiate logon provider.
250 | WinNT50
251 | }
252 |
253 | /// Specifies the impersonation level.
254 | public enum ImpersonationLevel
255 | {
256 | ///
257 | /// The client is anonymous to the server. The server process can impersonate the client, but the impersonation token does not contain any information about the client. This level is only supported over the local interprocess communication transport. All other transports silently promote this level to identify.
258 | ///
259 | Anonymous,
260 |
261 | ///
262 | /// The system default level. The server can obtain the client's identity, and the server can impersonate the client to do ACL checks.
263 | ///
264 | Identify,
265 |
266 | ///
267 | /// The server can impersonate the client's security context while acting on behalf of the client. The server can access local resources as the client. If the server is local, it can access network resources as the client. If the server is remote, it can access only resources that are on the same computer as the server.
268 | ///
269 | Impersonate,
270 |
271 | ///
272 | /// The most powerful impersonation level. When this level is selected, the server (whether local or remote) can impersonate the client's security context while acting on behalf of the client. During impersonation, the client's credentials (both local and network) can be passed to any number of computers.
273 | ///
274 | Delegate
275 | }
276 |
277 | /// Specifies the BuiltinUser type.
278 | public enum BuiltinUser
279 | {
280 | /// None.
281 | None,
282 |
283 | /// Local Service.
284 | LocalService,
285 |
286 | /// Network Service.
287 | NetworkService
288 | }
289 | }
290 | }
--------------------------------------------------------------------------------
/src/WUJob.cs:
--------------------------------------------------------------------------------
1 | namespace PSWindowsUpdate
2 | {
3 | ///
4 | /// OutputType
5 | /// OutputType for WUJob.
6 | ///
7 | public class WUJob
8 | {
9 | /// ComputerName
10 | public string ComputerName { get; set; }
11 |
12 | /// Name
13 | public string Name { get; set; }
14 |
15 | /// Action
16 | public string Action { get; set; }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/WUServiceController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ServiceProcess;
3 | using System.Threading;
4 |
5 | namespace PSWindowsUpdate
6 | {
7 | internal class WUServiceController
8 | {
9 | private string ComputerName;
10 | private string ServiceName;
11 |
12 | public WUServiceController(string computerName, string serviceName)
13 | {
14 | ComputerName = computerName;
15 | ServiceName = serviceName;
16 | }
17 |
18 | /// Restart service on specific machine.
19 | public void RestartService()
20 | {
21 | try
22 | {
23 | var serviceController = new ServiceController(ServiceName, ComputerName);
24 | Thread.Sleep(500);
25 | serviceController.WaitForStatus(ServiceControllerStatus.Stopped);
26 | Thread.Sleep(500);
27 | serviceController.WaitForStatus(ServiceControllerStatus.Running);
28 | serviceController.Dispose();
29 | }
30 | catch (Exception ex)
31 | {
32 | Console.WriteLine(ex);
33 | }
34 | }
35 |
36 | /// Stope service on specific machine.
37 | public void StopService()
38 | {
39 | try
40 | {
41 | var serviceController = new ServiceController(ServiceName, ComputerName);
42 | if (serviceController.Status == ServiceControllerStatus.Running)
43 | {
44 | Thread.Sleep(500);
45 | serviceController.Stop();
46 | serviceController.WaitForStatus(ServiceControllerStatus.Stopped);
47 | }
48 |
49 | serviceController.Dispose();
50 | }
51 | catch (Exception ex)
52 | {
53 | Console.WriteLine(ex);
54 | }
55 | }
56 |
57 | /// Start service on specific machine.
58 | public void StartService()
59 | {
60 | try
61 | {
62 | var serviceController = new ServiceController(ServiceName, ComputerName);
63 | if (serviceController.Status == ServiceControllerStatus.Stopped)
64 | {
65 | Thread.Sleep(500);
66 | serviceController.Start();
67 | serviceController.WaitForStatus(ServiceControllerStatus.Running);
68 | }
69 |
70 | serviceController.Dispose();
71 | }
72 | catch (Exception ex)
73 | {
74 | Console.WriteLine(ex);
75 | }
76 | }
77 | }
78 | }
--------------------------------------------------------------------------------
/src/WUSettings.cs:
--------------------------------------------------------------------------------
1 | namespace PSWindowsUpdate
2 | {
3 | ///
4 | /// OutputType
5 | /// OutputType for WUSettings objects.
6 | ///
7 | public class WUSettings
8 | {
9 | /// ComputerName
10 | public string ComputerName { get; set; }
11 |
12 | /// AcceptTrustedPublisherCerts
13 | public int AcceptTrustedPublisherCerts { get; set; }
14 |
15 | /// WUServer
16 | public string WUServer { get; set; }
17 |
18 | /// WUStatusServer
19 | public string WUStatusServer { get; set; }
20 |
21 | /// DetectionFrequencyEnabled
22 | public int DetectionFrequencyEnabled { get; set; }
23 |
24 | /// DetectionFrequency
25 | public int DetectionFrequency { get; set; }
26 |
27 | /// NoAutoRebootWithLoggedOnUsers
28 | public int NoAutoRebootWithLoggedOnUsers { get; set; }
29 |
30 | /// RebootRelaunchTimeoutEnabled
31 | public int RebootRelaunchTimeoutEnabled { get; set; }
32 |
33 | /// RebootRelaunchTimeout
34 | public int RebootRelaunchTimeout { get; set; }
35 |
36 | /// IncludeRecommendedUpdates
37 | public int IncludeRecommendedUpdates { get; set; }
38 |
39 | /// NoAutoUpdate
40 | public int NoAutoUpdate { get; set; }
41 |
42 | /// AUOptions
43 | public string AUOptions { get; set; }
44 |
45 | /// ScheduledInstallDay
46 | public string ScheduledInstallDay { get; set; }
47 |
48 | /// ScheduledInstallTime
49 | public int ScheduledInstallTime { get; set; }
50 |
51 | /// UseWUServer
52 | public int UseWUServer { get; set; }
53 | }
54 | }
--------------------------------------------------------------------------------
/src/WindowsUpdate.cs:
--------------------------------------------------------------------------------
1 | namespace PSWindowsUpdate
2 | {
3 | ///
4 | /// OutputType
5 | /// OutputType for WindowsUpdate objects.
6 | ///
7 | public class WindowsUpdate
8 | {
9 | /// ComputerName
10 | public string ComputerName { get; set; }
11 |
12 | /// Status
13 | public string Status { get; set; }
14 |
15 | /// KB
16 | public string KB { get; set; }
17 |
18 | /// Size
19 | public string Size { get; set; }
20 |
21 | /// Title
22 | public string Title { get; set; }
23 | }
24 | }
--------------------------------------------------------------------------------