PowerShell 技能连载 - 安装 PowerShell 7

PowerShell 7 是便携式应用程序,可以与 Windows PowerShell 平行运行。您只需要下载并安装它。

这部分很容易,因为 PowerShell 团队提供了自动安装脚本。只需一点技巧,您就可以下载此代码并将其绑定到新的 PowerShell 功能,从而可以非常容易地从现有 Windows PowerShell 安装 PowerShell 7:

1
2
3
4
5
6
7
8
# Download installation script
$code = Invoke-RestMethod -Uri https://aka.ms/install-powershell.ps1

# Dynamically create PowerShell function
New-Item -Path function: -Name Install-PowerShell -Value $code

# Run PowerShel function and install the latest PowerShell
Install-PowerShell -UseMSI -Preview

PowerShell 技能连载 - 允许 PowerPoint 中的点击操作

在 PowerPoint 演示文稿中使用点击操作对于启动 Visual Studio Code 或 PowerShell ISE 以及无缝打开和演示 PowerShell 代码非常有用。

但是,出于安全原因,默认情况下禁止通过插入的“操作”项启动程序,并且没有启用它的简便方法。而且,即使您确实启用了此功能,PowerPoint 也会在短时间后将其恢复为保护模式。

这是一个快速的 PowerShell脚本,您可以在演示之前立即运行它,以确保所有可点击的“操作”点击后能生效。

1
2
$path = 'HKCU:\Software\Microsoft\Office\16.0\PowerPoint\Security'
Set-ItemProperty -Path $path -Name RunPrograms -Value 1 -Type DWord

PowerShell 技能连载 - 管理自动磁盘检测

当 Windows 检测到存储驱动器有异常,它就会启用自动完整性检查。对于系统分区,在下次启动时,Windows 会显示用户提示,并要求获得执行检查的权限。

要找出启用了这种检查的所有驱动器,请运行以下命令:

1
2
3
4
5
PS> Get-CimInstance -ClassName Win32_AutochkSetting | Select-Object -Property SettingID, UserInputDelay

SettingID UserInputDelay
--------- --------------
Microsoft Windows 10 Pro|C:\Windows|\Device\Harddisk0\Partition3 8

UserInputDelay 属性指定 Windows 在启动时等待用户提示的秒数。如果届时用户仍未响应,则将自动执行磁盘完整性检查。

WMI 可以更改此设置。如果要将延迟增加到 20 秒,请使用管理员权限运行以下命令:

1
Set-CimInstance -Query "Select * From Win32_AutochkSetting" -Property @{UserInputDelay=20}

请注意,此命令为所有受支持的磁盘驱动器设置 UserInputDelay。要仅对选定的驱动器进行设置,请优化提交的查询,然后添加一个过滤器,例如:

1
Set-CimInstance -Query 'Select * From Win32_AutochkSetting Where SettingID LIKE "%\\Device\\Harddisk0\\Partition3"' -Property @{UserInputDelay=30}

有关WMI查询的更多信息,请访问 http://powershell.one/wmi/wql

PowerShell 技能连载 - 获取可用的显示分辨率

WMI 可以返回显示适配器可用的显示分辨率列表:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
PS> Get-CimInstance -ClassName CIM_VideoControllerResolution |
Select-Object -Property SettingID

SettingID
---------
640 x 480 x 4294967296 colors @ 60 Hertz
640 x 480 x 4294967296 colors @ 67 Hertz
640 x 480 x 4294967296 colors @ 72 Hertz
640 x 480 x 4294967296 colors @ 75 Hertz
720 x 400 x 4294967296 colors @ 70 Hertz
720 x 480 x 4294967296 colors @ 60 Hertz
720 x 576 x 4294967296 colors @ 50 Hertz (Interlaced)
800 x 600 x 4294967296 colors @ 60 Hertz
800 x 600 x 4294967296 colors @ 72 Hertz
800 x 600 x 4294967296 colors @ 75 Hertz
832 x 624 x 4294967296 colors @ 75 Hertz
1024 x 768 x 4294967296 colors @ 60 Hertz
1024 x 768 x 4294967296 colors @ 70 Hertz
1024 x 768 x 4294967296 colors @ 75 Hertz
1152 x 864 x 4294967296 colors @ 75 Hertz
1152 x 870 x 4294967296 colors @ 75 Hertz
1280 x 720 x 4294967296 colors @ 50 Hertz (Interlaced)
1280 x 720 x 4294967296 colors @ 60 Hertz
1280 x 800 x 4294967296 colors @ 60 Hertz
1280 x 1024 x 4294967296 colors @ 60 Hertz
1280 x 1024 x 4294967296 colors @ 75 Hertz
1440 x 900 x 4294967296 colors @ 60 Hertz
1600 x 900 x 4294967296 colors @ 60 Hertz
1680 x 1050 x 4294967296 colors @ 60 Hertz
1920 x 1080 x 4294967296 colors @ 24 Hertz (Interlaced)
1920 x 1080 x 4294967296 colors @ 25 Hertz (Interlaced)
1920 x 1080 x 4294967296 colors @ 30 Hertz (Interlaced)
1920 x 1080 x 4294967296 colors @ 50 Hertz (Interlaced)
1920 x 1080 x 4294967296 colors @ 60 Hertz
1920 x 1440 x 4294967296 colors @ 60 Hertz
2048 x 1152 x 4294967296 colors @ 60 Hertz
3840 x 2160 x 4294967296 colors @ 24 Hertz (Interlaced)
3840 x 2160 x 4294967296 colors @ 25 Hertz (Interlaced)
3840 x 2160 x 4294967296 colors @ 30 Hertz (Interlaced)
4096 x 2160 x 4294967296 colors @ 24 Hertz (Interlaced)
4096 x 2160 x 4294967296 colors @ 25 Hertz (Interlaced)
4096 x 2160 x 4294967296 colors @ 30 Hertz (Interlaced)

WMI 是否可以返回视频模式取决于您的视频适配器和驱动程序。如果没有可用的视频模式,则不返回任何内容。

要检查您的视频适配器,请使用 Win32_VideoController WMI类:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
PS> Get-CimInstance -ClassName CIM_VideoController -Property *


Caption : Intel(R) Iris(R) Plus Graphics
Description : Intel(R) Iris(R) Plus Graphics
InstallDate :
Name : Intel(R) Iris(R) Plus Graphics
Status : OK
Availability : 3
ConfigManagerErrorCode : 0
ConfigManagerUserConfig : False
CreationClassName : Win32_VideoController
DeviceID : VideoController3
ErrorCleared :
ErrorDescription :
LastErrorCode :
PNPDeviceID : PCI\VEN_8086&DEV_8A52&SUBSYS_08B01028&REV_07\3&11583659&0&10
PowerManagementCapabilities :
PowerManagementSupported :
StatusInfo :
SystemCreationClassName : Win32_ComputerSystem
SystemName : DESKTOP-8DVNI43
MaxNumberControlled :
ProtocolSupported :
TimeOfLastReset :
AcceleratorCapabilities :
CapabilityDescriptions :
CurrentBitsPerPixel : 32
CurrentHorizontalResolution : 3840
CurrentNumberOfColors : 4294967296
CurrentNumberOfColumns : 0
CurrentNumberOfRows : 0
CurrentRefreshRate : 59
CurrentScanMode : 4
CurrentVerticalResolution : 2400
MaxMemorySupported :
MaxRefreshRate : 0
MinRefreshRate :
NumberOfVideoPages :
VideoMemoryType : 2
VideoProcessor : Intel(R) Iris(R) Graphics Family
NumberOfColorPlanes :
VideoArchitecture : 5
VideoMode :
AdapterCompatibility : Intel Corporation
AdapterDACType : Internal
AdapterRAM : 1073741824
ColorTableEntries :
DeviceSpecificPens :
DitherType : 0
DriverDate : 06.11.2019 01:00:00
DriverVersion : 26.20.100.7463
ICMIntent :
ICMMethod :
InfFilename : oem105.inf
InfSection : iICLD_w10_DS_N
InstalledDisplayDrivers : C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_fdbe15db86939fb5\igdumdim64.dll,C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf
_amd64_fdbe15db86939fb5\igd10iumd64.dll,C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_fdbe15db86939fb5\igd10iumd64.dll,C:\Windows\System3
2\DriverStore\FileRepository\iigd_dch.inf_amd64_fdbe15db86939fb5\igd12umd64.dll
Monochrome : False
ReservedSystemPaletteEntries :
SpecificationVersion :
SystemPaletteEntries :
VideoModeDescription : 3840 x 2400 x 4294967296 colors
PSComputerName :
CimClass : root/cimv2:Win32_VideoController
CimInstanceProperties : {Caption, Description, InstallDate, Name...}
CimSystemProperties : Microsoft.Management.Infrastructure.CimSystemProperties

有关这两个类的文档,请访问 http://powershell.one/wmi/root/cimv2/cim_videocontrollerresolutionhttp://powershell.one/wmi/root/cimv2/win32_videocontroller

PowerShell 技能连载 - 谨慎使用某些命令

以下是在 PowerShell 脚本中经常发现的三个命令,您应该注意这些命令,因为它们可能会产生严重的副作用:

exit

exit“ 实际上不是命令,而是语言的一部分。它会立即退出PowerShell,您可以选择提交一个数字,该数字将成为调用者可以获取到的 “error level”。

仅当您确实要退出 PowerShell 时才使用 “exit“。不要在旨在由其他人调用的函数或脚本中使用它。您可以试试:在函数下方运行时,它输出“ A”,然后退出。但是,您的 PowerShell 环境也将关闭。

1
2
3
4
5
6
function test
{
"A"
exit
"B"
}

如果只想“退出”部分代码而不退出整个 PowerShell 环境,请改用 “return“:

1
2
3
4
5
6
function test
{
"A"
return
"B"
}

Set-StrictMode -Version Latest

此命令使 PowerShell 的行为更加严格,即当您读取变量或调用实际上不存在的方法时抛出异常。在默认模式下,PowerShell 将仅返回 $null

对于专业的 PowerShell 用户,在编写脚本代码时启用严格模式是个好主意,因为 PowerShell 会强制您编写更简洁的代码。但是,切勿将此命令添加到生产代码中!

一方面,这没有任何意义:您的生产代码已完成,因此启用严格检查不会改变任何事情。更糟糕的是:您在生产机器上强加了自己的首选项,这可能会导致意外的(和不必要的)异常。假设您的代码调用了其他代码或使用了其他模块中的命令,并且它们的作者使用了 PowerShell 的懒惰模式。现在,当您的代码启用严格模式时,将相同的严格规则应用于从您的代码中调用的所有代码。

即使在测试过程中效果很好,您也不知道其他作者何时更新他们的代码,而导致出现问题。

如果在代码中找到 “Set-StrictMode“ 调用,只需删除它们即可。如果您喜欢严格模式,请改为在您的个人 PowerShell 配置文件中启用它,或者在需要时手动将其启用。

Invoke-Expression

该命令采用任何字符串,并像执行 PowerShell 命令一样执行它。尽管这是非常强大的功能,有时甚至是绝对必要的,但它带来了类似所谓“SQL注入”安全问题的所有风险。请看以下代码:

1
2
3
4
5
6
7
8
# get user input
$Path = Read-Host -Prompt 'Enter path to find .log files'

# compose command
$code = "Get-ChildItem -Path $Path -Recurse -Filter *.log -ErrorAction SilentlyContinue"

# invoke command
Invoke-Expression -Command $code

运行此代码时,系统会要求您提供路径,并在输入例如 “C:\Windows“ 时看到日志文件列表。但是,执行的代码直接取决于用户输入的内容。当您再次运行代码时,请尝试以下操作:$(Get-Service | Out-GridView; c:\Windows)

这次,PowerShell 首先列出所有服务,并将它们输出到网格视图窗口。您使用 “$()“ “注入”了代码。

尽可能避免使用 Invoke-Expression,当然,上面的示例是有意构造的。您可以将用户输入直接提交给适当的命令参数,而不是编写字符串命令:

1
2
3
4
5
# get user input
$Path = Read-Host -Prompt 'Enter path to find .log files'

# invoke command
Get-ChildItem -Path $Path -Recurse -Filter *.log -ErrorAction SilentlyContinue

如果必须使用 Invoke-Expression,请格外小心,验证任何用户输入,并确保用户无法注入代码。

PowerShell 技能连载 - 处理 Out-GridView 的 Bug

当添加 -PassThru 参数时,Out-GridView 可以用作通用的选择对话框。下面的单行停止了您在网格视图窗口中选择的所有服务(嗯,不是真的停止。在删除 -WhatIf 参数之前,都可以安全地运行):

1
Get-Service | Out-GridView -Title 'Select Service' -PassThru | Stop-Service -WhatIf

但是,Out-GridView 中存在一个长期存在的错误:将信息填充到网格视图窗口中时,启用了用于选择项目的按钮,但不返回任何内容。这是一个测试用例:我用 Windows 文件夹中大于 10MB 的所有文件填充网格视图窗口:

1
2
3
Get-ChildItem -Path C:\Windows -Recurse -File -ErrorAction SilentlyContinue |
Where-Object Length -gt 10MB |
Out-GridView -Title 'Select a file' -PassThru

枚举文件可能要花费一些时间,由于优雅的实时特性,过一会儿会在网格视图窗口看到列出的文件,并且可以选择一些文件,然后单击右下角的“确定”按钮将其返回到控制台。

注意:如果在所有文件都发送到网格视图窗口之前单击“确定”按钮,则网格视图窗口将关闭但不返回任何内容。为了使确定按钮正常工作,您必须知道网格视图窗口的输出何时完成。

除此以外,您无法知道什么时候结束。您可以稍等片刻,以期获得最好的结果,但是没有任何提示告诉您网格视图窗口已完全填充完毕。

一种解决方法是先将数据存储在变量中,然后将其快速发送到网格视图窗口:

1
2
3
4
$files = Get-ChildItem -Path C:\Windows -Recurse -File -ErrorAction SilentlyContinue |
Where-Object Length -gt 10MB

$files | Out-GridView -Title 'Select a file' -PassThru

但是,这么做失去了实时性,并且可能需要等待几秒钟才能收集数据并打开网格视图窗口。

一种更聪明的方法是利用 PowerShell 的管道体系结构并使用管道感知功能。完成所有管道处理后,将调用其 “end“ 代码块,因此您可以在此处放置代码以提示所有数据已完成:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function Send-PipelineEndNotification
{
begin {
Write-Host "Collecting Data..." -NoNewline -ForegroundColor DarkYellow
}
process { $_ }
end {
Write-Host "Completed." -ForegroundColor Green
[Console]::Beep()
}
}


Get-ChildItem -Path C:\Windows -Recurse -File -ErrorAction SilentlyContinue |
Where-Object Length -gt 10MB |
Send-PipelineEndNotification |
Out-GridView -Title 'Select a file' -PassThru

只需在 Out-GridView 之前调用 Send-PipelineEndNotification。现在,在控制台中,您会看到一条警告,告知您仍在收集信息,并在网格视图窗口完成并准备返回所选项目时显示绿色的通知文本和提示音。

PowerShell 技能连载 - 使用 PowerShell 探索 WMI

Win32_LogicalDevice WMI 类代表计算机中可用的所有逻辑设备,通过查询此“超类”,您可以获取所有专用的单个类。这是找出 WMI 可以为您提供哪些信息以及 WMI 类的名称的简单方法:

1
2
3
Get-CimInstance -ClassName CIM_LogicalDevice |
Select-Object -Property Name, CreationClassName, DeviceID, SystemName |
Out-GridView -Title 'Select one or more (hold CTRL)' -PassThru

在网格视图窗口中,选择一个或多个您感兴趣的实例(按住CTRL键选择多个实例),然后将选定的实例转储到控制台。请等待网格视图窗口填充完毕,然后再尝试选择某些内容。

在我的笔记本上,我选择了一个“音频设备”:

Name                   CreationClassName DeviceID
----                   ----------------- --------
Intel(R) Display-Audio Win32_SoundDevice INTELAUDIO\FUNC_01&VEN_8086&DEV_280...

要查找有关它的更多信息,请使用 “CreationClassName“ 中的 WMI 类(即 Win32_SoundDevice)查询特定信息,运行以下命令:

1
2
3
4
5
6
7
PS> Get-CimInstance -ClassName Win32_SoundDevice

Manufacturer Name Status StatusInfo
------------ ---- ------ ----------
Intel(R) Corporation Intel(R) Display-Audio OK 3
DisplayLink DisplayLink USB Audio Adapter OK 3
Realtek Realtek Audio OK 3

显然,我的机器中有三个声音设备。要查看所有详细信息,请将数据发送到 Select-Object

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
PS> Get-CimInstance -ClassName Win32_SoundDevice | Select-Object *


ConfigManagerUserConfig : False
Name : Intel(R) Display-Audio
Status : OK
StatusInfo : 3
Caption : Intel(R) Display-Audio
Description : Intel(R) Display-Audio
InstallDate :
Availability :
ConfigManagerErrorCode : 0
CreationClassName : Win32_SoundDevice
DeviceID : INTELAUDIO\FUNC_01&VEN_8086&DEV_280F&SUBSYS_80860
101&REV_1000\5&6790FB4&0&0201
ErrorCleared :
ErrorDescription :
LastErrorCode :
PNPDeviceID : INTELAUDIO\FUNC_01&VEN_8086&DEV_280F&SUBSYS_80860
101&REV_1000\5&6790FB4&0&0201
PowerManagementCapabilities :
PowerManagementSupported : False
SystemCreationClassName : Win32_ComputerSystem
SystemName : DESKTOP-8DVNI43
DMABufferSize :
Manufacturer : Intel(R) Corporation
MPU401Address :
ProductName : Intel(R) Display-Audio
PSComputerName :
CimClass : root/cimv2:Win32_SoundDevice
CimInstanceProperties : {Caption, Description, InstallDate, Name...}
CimSystemProperties : Microsoft.Management.Infrastructure.CimSystemProp
erties

ConfigManagerUserConfig : False
Name : DisplayLink USB Audio Adapter
Status : OK
StatusInfo : 3
Caption : DisplayLink USB Audio Adapter
...

并且,如果您想进一步了解此类(或其它类),请访问PowerShell WMI参考:http://powershell.one/wmi/root/cimv2/win32_sounddevice。只需将WMI类名替换为您要使用的类名即可。

PowerShell 技能连载 - 用 Carbon 添加新的 PowerShell 命令

Carbon 是 PowerShell Gallery 中最受欢迎的免费 PowerShell 模块之一。它类似于瑞士军刀,具有多种辅助功能。要安装它,请运行以下命令:

1
PS> Install-Module -Name Carbon -Scope CurrentUser -Force

显然,该模块的所有者添加了有用的功能。这就是测试您的 PowerShell 当前是否处于提升状态所需的全部操作:

1
2
PS> Test-CAdminPrivilege
False

要加密或解密字符串,请使用以下命令:

1
2
3
4
5
6
7
8
9
PS> $secret = "Secret Text" | Protect-CString -ForUser

PS> $secret
AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAf0R6lgTIWkqgPubPNRqOXwAAAAACAAAAAAAQZgAAAAEAACAAAADiVJHgXqE+4kLGfPISsvSg+cBG4m8Q0c5W1nqzl/pHDgAAAAAOgAAAAA
IAACAAAACIF/xsRNBKG2cDnwCACA59JZaeOK/zedzmMrEMML0upxAAAABSmKyvYw4ul+jKW35NZdzmQAAAACE/4MFiRHJVhYOu65P/Vc7hVH5wuUfV0elFtwTfYdN+92h3aguob/Rq
fEANeUZfUotBOE4dxJDdr950rR4ss0I=

PS> $secret | Unprotect-CString
Secret Text

有很多参数可以通过其他方式进行加密,还有大量命令可以发现。显然,模块作者已将其命令名称前面添加了 “C”,也就是 “Carbon” 的意思,并且包括不带前缀的命令名称的别名。

命令的完整列表非常详尽:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
PS> Get-Command -Module Carbon


CommandType Name Version Source
----------- ---- ------- ------
Alias Add-GroupMember 2.9.2 Carbon
Alias Add-GroupMembers 2.9.2 Carbon
Alias Add-IisDefaultDocument 2.9.2 Carbon
Alias Add-TrustedHost 2.9.2 Carbon
Alias Add-TrustedHosts 2.9.2 Carbon
Alias Assert-AdminPrivilege 2.9.2 Carbon
Alias Assert-AdminPrivileges 2.9.2 Carbon
Alias Assert-FirewallConfigurable 2.9.2 Carbon
Alias Assert-Service 2.9.2 Carbon
Alias Clear-DscLocalResourceCache 2.9.2 Carbon
Alias Clear-MofAuthoringMetadata 2.9.2 Carbon
Alias Clear-TrustedHost 2.9.2 Carbon
Alias Clear-TrustedHosts 2.9.2 Carbon
Alias Complete-Job 2.9.2 Carbon
Alias Complete-Jobs 2.9.2 Carbon
Alias Compress-Item 2.9.2 Carbon
Alias ConvertFrom-Base64 2.9.2 Carbon
Alias Convert-SecureStringToString 2.9.2 Carbon
Alias ConvertTo-Base64 2.9.2 Carbon
Alias ConvertTo-ContainerInheritanceFlags 2.9.2 Carbon
Alias ConvertTo-FullPath 2.9.2 Carbon
Alias ConvertTo-InheritanceFlag 2.9.2 Carbon
Alias ConvertTo-InheritanceFlags 2.9.2 Carbon
Alias ConvertTo-PropagationFlag 2.9.2 Carbon
Alias ConvertTo-PropagationFlags 2.9.2 Carbon
Alias ConvertTo-SecurityIdentifier 2.9.2 Carbon
Alias Convert-XmlFile 2.9.2 Carbon
Alias Copy-DscResource 2.9.2 Carbon
Alias Disable-AclInheritance 2.9.2 Carbon
Alias Disable-FirewallStatefulFtp 2.9.2 Carbon
Alias Disable-IEEnhancedSecurityConfiguration 2.9.2 Carbon
Alias Disable-IisSecurityAuthentication 2.9.2 Carbon
Alias Disable-NtfsCompression 2.9.2 Carbon
Alias Enable-AclInheritance 2.9.2 Carbon
Alias Enable-FirewallStatefulFtp 2.9.2 Carbon
Alias Enable-IEActivationPermission 2.9.2 Carbon
Alias Enable-IEActivationPermissions 2.9.2 Carbon
Alias Enable-IisDirectoryBrowsing 2.9.2 Carbon
Alias Enable-IisSecurityAuthentication 2.9.2 Carbon
Alias Enable-IisSsl 2.9.2 Carbon
Alias Enable-NtfsCompression 2.9.2 Carbon
Alias Expand-Item 2.9.2 Carbon
Alias Find-ADUser 2.9.2 Carbon
Alias Format-ADSearchFilterValue 2.9.2 Carbon
Alias Format-ADSpecialCharacters 2.9.2 Carbon
Alias Get-ADDomainController 2.9.2 Carbon
Alias Get-Certificate 2.9.2 Carbon
Alias Get-CertificateStore 2.9.2 Carbon
Alias Get-ComPermission 2.9.2 Carbon
Alias Get-ComPermissions 2.9.2 Carbon
Alias Get-ComSecurityDescriptor 2.9.2 Carbon
Alias Get-DscError 2.9.2 Carbon
Alias Get-DscWinEvent 2.9.2 Carbon
Alias Get-FileShare 2.9.2 Carbon
Alias Get-FileSharePermission 2.9.2 Carbon
Alias Get-FirewallRule 2.9.2 Carbon
Alias Get-FirewallRules 2.9.2 Carbon
Alias Get-Group 2.9.2 Carbon
Alias Get-HttpUrlAcl 2.9.2 Carbon
Alias Get-IisApplication 2.9.2 Carbon
Alias Get-IisAppPool 2.9.2 Carbon
Alias Get-IisConfigurationSection 2.9.2 Carbon
Alias Get-IisHttpHeader 2.9.2 Carbon
Alias Get-IisHttpRedirect 2.9.2 Carbon
Alias Get-IisMimeMap 2.9.2 Carbon
Alias Get-IisSecurityAuthentication 2.9.2 Carbon
Alias Get-IisVersion 2.9.2 Carbon
Alias Get-IisWebsite 2.9.2 Carbon
Alias Get-IPAddress 2.9.2 Carbon
Alias Get-Msi 2.9.2 Carbon
Alias Get-MsmqMessageQueue 2.9.2 Carbon
Alias Get-MsmqMessageQueuePath 2.9.2 Carbon
Alias Get-PathCanonicalCase 2.9.2 Carbon
Alias Get-PathProvider 2.9.2 Carbon
Alias Get-PathToHostsFile 2.9.2 Carbon
Alias Get-PerformanceCounter 2.9.2 Carbon
Alias Get-PerformanceCounters 2.9.2 Carbon
Alias Get-Permission 2.9.2 Carbon
Alias Get-Permissions 2.9.2 Carbon
Alias Get-PowerShellModuleInstallPath 2.9.2 Carbon
Alias Get-PowershellPath 2.9.2 Carbon
Alias Get-Privilege 2.9.2 Carbon
Alias Get-Privileges 2.9.2 Carbon
Alias Get-ProgramInstallInfo 2.9.2 Carbon
Alias Get-RegistryKeyValue 2.9.2 Carbon
Alias Get-ScheduledTask 2.9.2 Carbon
Alias Get-ServiceAcl 2.9.2 Carbon
Alias Get-ServiceConfiguration 2.9.2 Carbon
Alias Get-ServicePermission 2.9.2 Carbon
Alias Get-ServicePermissions 2.9.2 Carbon
Alias Get-ServiceSecurityDescriptor 2.9.2 Carbon
Alias Get-SslCertificateBinding 2.9.2 Carbon
Alias Get-SslCertificateBindings 2.9.2 Carbon
Alias Get-TrustedHost 2.9.2 Carbon
Alias Get-TrustedHosts 2.9.2 Carbon
Alias Get-User 2.9.2 Carbon
Alias Get-WmiLocalUserAccount 2.9.2 Carbon
Alias Grant-ComPermission 2.9.2 Carbon
Alias Grant-ComPermissions 2.9.2 Carbon
Alias Grant-HttpUrlPermission 2.9.2 Carbon
Alias Grant-MsmqMessageQueuePermission 2.9.2 Carbon
Alias Grant-MsmqMessageQueuePermissions 2.9.2 Carbon
Alias Grant-Permission 2.9.2 Carbon
Alias Grant-Permissions 2.9.2 Carbon
Alias Grant-Privilege 2.9.2 Carbon
Alias Grant-ServiceControlPermission 2.9.2 Carbon
Alias Grant-ServicePermission 2.9.2 Carbon
Alias Initialize-Lcm 2.9.2 Carbon
Alias Install-Certificate 2.9.2 Carbon
Alias Install-Directory 2.9.2 Carbon
Alias Install-FileShare 2.9.2 Carbon
Alias Install-Group 2.9.2 Carbon
Alias Install-IisApplication 2.9.2 Carbon
Alias Install-IisAppPool 2.9.2 Carbon
Alias Install-IisVirtualDirectory 2.9.2 Carbon
Alias Install-IisWebsite 2.9.2 Carbon
Alias Install-Junction 2.9.2 Carbon
Alias Install-Msi 2.9.2 Carbon
Alias Install-Msmq 2.9.2 Carbon
Alias Install-MsmqMessageQueue 2.9.2 Carbon
Alias Install-PerformanceCounter 2.9.2 Carbon
Alias Install-RegistryKey 2.9.2 Carbon
Alias Install-ScheduledTask 2.9.2 Carbon
Alias Install-Service 2.9.2 Carbon
Alias Install-SmbShare 2.9.2 Carbon
Alias Install-User 2.9.2 Carbon
Alias Invoke-AppCmd 2.9.2 Carbon
Alias Invoke-PowerShell 2.9.2 Carbon
Alias Invoke-WindowsInstaller 2.9.2 Carbon
Alias Join-IisVirtualPath 2.9.2 Carbon
Alias Lock-IisConfigurationSection 2.9.2 Carbon
Alias New-Credential 2.9.2 Carbon
Alias New-Junction 2.9.2 Carbon
Alias New-RsaKeyPair 2.9.2 Carbon
Alias New-TempDir 2.9.2 Carbon
Alias New-TempDirectory 2.9.2 Carbon
Alias Protect-Acl 2.9.2 Carbon
Alias Protect-String 2.9.2 Carbon
Alias Read-File 2.9.2 Carbon
Alias Remove-Certificate 2.9.2 Carbon
Alias Remove-DotNetAppSetting 2.9.2 Carbon
Alias Remove-EnvironmentVariable 2.9.2 Carbon
Alias Remove-GroupMember 2.9.2 Carbon
Alias Remove-HostsEntry 2.9.2 Carbon
Alias Remove-IisMimeMap 2.9.2 Carbon
Alias Remove-IniEntry 2.9.2 Carbon
Alias Remove-Junction 2.9.2 Carbon
Alias Remove-MsmqMessageQueue 2.9.2 Carbon
Alias Remove-RegistryKeyValue 2.9.2 Carbon
Alias Remove-Service 2.9.2 Carbon
Alias Remove-SslCertificateBinding 2.9.2 Carbon
Alias Remove-User 2.9.2 Carbon
Alias Reset-HostsFile 2.9.2 Carbon
Alias Reset-MsmqQueueManagerID 2.9.2 Carbon
Alias Resolve-FullPath 2.9.2 Carbon
Alias Resolve-Identity 2.9.2 Carbon
Alias Resolve-IdentityName 2.9.2 Carbon
Alias Resolve-NetPath 2.9.2 Carbon
Alias Resolve-PathCase 2.9.2 Carbon
Alias Resolve-RelativePath 2.9.2 Carbon
Alias Restart-RemoteService 2.9.2 Carbon
Alias Revoke-ComPermission 2.9.2 Carbon
Alias Revoke-ComPermissions 2.9.2 Carbon
Alias Revoke-HttpUrlPermission 2.9.2 Carbon
Alias Revoke-Permission 2.9.2 Carbon
Alias Revoke-Privilege 2.9.2 Carbon
Alias Revoke-ServicePermission 2.9.2 Carbon
Alias Set-DotNetAppSetting 2.9.2 Carbon
Alias Set-DotNetConnectionString 2.9.2 Carbon
Alias Set-EnvironmentVariable 2.9.2 Carbon
Alias Set-HostsEntry 2.9.2 Carbon
Alias Set-IisHttpHeader 2.9.2 Carbon
Alias Set-IisHttpRedirect 2.9.2 Carbon
Alias Set-IisMimeMap 2.9.2 Carbon
Alias Set-IisWebsiteID 2.9.2 Carbon
Alias Set-IisWebsiteSslCertificate 2.9.2 Carbon
Alias Set-IisWindowsAuthentication 2.9.2 Carbon
Alias Set-IniEntry 2.9.2 Carbon
Alias Set-RegistryKeyValue 2.9.2 Carbon
Alias Set-ServiceAcl 2.9.2 Carbon
Alias Set-SslCertificateBinding 2.9.2 Carbon
Alias Set-TrustedHost 2.9.2 Carbon
Alias Set-TrustedHosts 2.9.2 Carbon
Alias Split-Ini 2.9.2 Carbon
Alias Start-DscPullConfiguration 2.9.2 Carbon
Alias Test-AdminPrivilege 2.9.2 Carbon
Alias Test-AdminPrivileges 2.9.2 Carbon
Alias Test-DotNet 2.9.2 Carbon
Alias Test-DscTargetResource 2.9.2 Carbon
Alias Test-FileShare 2.9.2 Carbon
Alias Test-FirewallStatefulFtp 2.9.2 Carbon
Alias Test-Group 2.9.2 Carbon
Alias Test-GroupMember 2.9.2 Carbon
Alias Test-Identity 2.9.2 Carbon
Alias Test-IisAppPool 2.9.2 Carbon
Alias Test-IisConfigurationSection 2.9.2 Carbon
Alias Test-IisSecurityAuthentication 2.9.2 Carbon
Alias Test-IisWebsite 2.9.2 Carbon
Alias Test-IPAddress 2.9.2 Carbon
Alias Test-MsmqMessageQueue 2.9.2 Carbon
Alias Test-NtfsCompression 2.9.2 Carbon
Alias Test-OSIs32Bit 2.9.2 Carbon
Alias Test-OSIs64Bit 2.9.2 Carbon
Alias Test-PathIsJunction 2.9.2 Carbon
Alias Test-PerformanceCounter 2.9.2 Carbon
Alias Test-PerformanceCounterCategory 2.9.2 Carbon
Alias Test-Permission 2.9.2 Carbon
Alias Test-PowerShellIs32Bit 2.9.2 Carbon
Alias Test-PowerShellIs64Bit 2.9.2 Carbon
Alias Test-Privilege 2.9.2 Carbon
Alias Test-RegistryKeyValue 2.9.2 Carbon
Alias Test-ScheduledTask 2.9.2 Carbon
Alias Test-Service 2.9.2 Carbon
Alias Test-SslCertificateBinding 2.9.2 Carbon
Alias Test-TypeDataMember 2.9.2 Carbon
Alias Test-UncPath 2.9.2 Carbon
Alias Test-User 2.9.2 Carbon
Alias Test-WindowsFeature 2.9.2 Carbon
Alias Test-ZipFile 2.9.2 Carbon
Alias Uninstall-Certificate 2.9.2 Carbon
Alias Uninstall-Directory 2.9.2 Carbon
Alias Uninstall-FileShare 2.9.2 Carbon
Alias Uninstall-Group 2.9.2 Carbon
Alias Uninstall-IisAppPool 2.9.2 Carbon
Alias Uninstall-IisWebsite 2.9.2 Carbon
Alias Uninstall-Junction 2.9.2 Carbon
Alias Uninstall-MsmqMessageQueue 2.9.2 Carbon
Alias Uninstall-PerformanceCounterCategory 2.9.2 Carbon
Alias Uninstall-ScheduledTask 2.9.2 Carbon
Alias Uninstall-Service 2.9.2 Carbon
Alias Uninstall-User 2.9.2 Carbon
Alias Unlock-IisConfigurationSection 2.9.2 Carbon
Alias Unprotect-AclAccessRules 2.9.2 Carbon
Alias Unprotect-String 2.9.2 Carbon
Alias Write-DscError 2.9.2 Carbon
Alias Write-File 2.9.2 Carbon
Function Add-CGroupMember 2.9.2 Carbon
Function Add-CTrustedHost 2.9.2 Carbon
Function Assert-CAdminPrivilege 2.9.2 Carbon
Function Assert-CFirewallConfigurable 2.9.2 Carbon
Function Assert-CService 2.9.2 Carbon
Function Clear-CDscLocalResourceCache 2.9.2 Carbon
Function Clear-CMofAuthoringMetadata 2.9.2 Carbon
Function Clear-CTrustedHost 2.9.2 Carbon
Function Complete-CJob 2.9.2 Carbon
Function Compress-CItem 2.9.2 Carbon
Function Convert-CSecureStringToString 2.9.2 Carbon
Function Convert-CXmlFile 2.9.2 Carbon
Function ConvertFrom-CBase64 2.9.2 Carbon
Function ConvertTo-CBase64 2.9.2 Carbon
Function ConvertTo-CContainerInheritanceFlags 2.9.2 Carbon
Function ConvertTo-CInheritanceFlag 2.9.2 Carbon
Function ConvertTo-CPropagationFlag 2.9.2 Carbon
Function ConvertTo-CSecurityIdentifier 2.9.2 Carbon
Function Copy-CDscResource 2.9.2 Carbon
Function Disable-CAclInheritance 2.9.2 Carbon
Function Disable-CFirewallStatefulFtp 2.9.2 Carbon
Function Disable-CIEEnhancedSecurityConfiguration 2.9.2 Carbon
Function Disable-CNtfsCompression 2.9.2 Carbon
Function Enable-CAclInheritance 2.9.2 Carbon
Function Enable-CFirewallStatefulFtp 2.9.2 Carbon
Function Enable-CIEActivationPermission 2.9.2 Carbon
Function Enable-CNtfsCompression 2.9.2 Carbon
Function Expand-CItem 2.9.2 Carbon
Function Find-CADUser 2.9.2 Carbon
Function Format-CADSearchFilterValue 2.9.2 Carbon
Function Get-CADDomainController 2.9.2 Carbon
Function Get-CCertificate 2.9.2 Carbon
Function Get-CCertificateStore 2.9.2 Carbon
Function Get-CComPermission 2.9.2 Carbon
Function Get-CComSecurityDescriptor 2.9.2 Carbon
Function Get-CDscError 2.9.2 Carbon
Function Get-CDscWinEvent 2.9.2 Carbon
Function Get-CFileShare 2.9.2 Carbon
Function Get-CFileSharePermission 2.9.2 Carbon
Function Get-CFirewallRule 2.9.2 Carbon
Function Get-CGroup 2.9.2 Carbon
Function Get-CHttpUrlAcl 2.9.2 Carbon
Function Get-CIPAddress 2.9.2 Carbon
Function Get-CMsi 2.9.2 Carbon
Function Get-CMsmqMessageQueue 2.9.2 Carbon
Function Get-CMsmqMessageQueuePath 2.9.2 Carbon
Function Get-CPathProvider 2.9.2 Carbon
Function Get-CPathToHostsFile 2.9.2 Carbon
Function Get-CPerformanceCounter 2.9.2 Carbon
Function Get-CPermission 2.9.2 Carbon
Function Get-CPowerShellModuleInstallPath 2.9.2 Carbon
Function Get-CPowershellPath 2.9.2 Carbon
Function Get-CPrivilege 2.9.2 Carbon
Function Get-CProgramInstallInfo 2.9.2 Carbon
Function Get-CRegistryKeyValue 2.9.2 Carbon
Function Get-CScheduledTask 2.9.2 Carbon
Function Get-CServiceAcl 2.9.2 Carbon
Function Get-CServiceConfiguration 2.9.2 Carbon
Function Get-CServicePermission 2.9.2 Carbon
Function Get-CServiceSecurityDescriptor 2.9.2 Carbon
Function Get-CSslCertificateBinding 2.9.2 Carbon
Function Get-CTrustedHost 2.9.2 Carbon
Function Get-CUser 2.9.2 Carbon
Function Get-CWmiLocalUserAccount 2.9.2 Carbon
Function Grant-CComPermission 2.9.2 Carbon
Function Grant-CHttpUrlPermission 2.9.2 Carbon
Function Grant-CMsmqMessageQueuePermission 2.9.2 Carbon
Function Grant-CPermission 2.9.2 Carbon
Function Grant-CPrivilege 2.9.2 Carbon
Function Grant-CServiceControlPermission 2.9.2 Carbon
Function Grant-CServicePermission 2.9.2 Carbon
Function Initialize-CLcm 2.9.2 Carbon
Function Install-CCertificate 2.9.2 Carbon
Function Install-CDirectory 2.9.2 Carbon
Function Install-CFileShare 2.9.2 Carbon
Function Install-CGroup 2.9.2 Carbon
Function Install-CJunction 2.9.2 Carbon
Function Install-CMsi 2.9.2 Carbon
Function Install-CMsmq 2.9.2 Carbon
Function Install-CMsmqMessageQueue 2.9.2 Carbon
Function Install-CPerformanceCounter 2.9.2 Carbon
Function Install-CRegistryKey 2.9.2 Carbon
Function Install-CScheduledTask 2.9.2 Carbon
Function Install-CService 2.9.2 Carbon
Function Install-CUser 2.9.2 Carbon
Function Invoke-CAppCmd 2.9.2 Carbon
Function Invoke-CPowerShell 2.9.2 Carbon
Function New-CCredential 2.9.2 Carbon
Function New-CJunction 2.9.2 Carbon
Function New-CRsaKeyPair 2.9.2 Carbon
Function New-CTempDirectory 2.9.2 Carbon
Function Read-CFile 2.9.2 Carbon
Function Remove-CDotNetAppSetting 2.9.2 Carbon
Function Remove-CEnvironmentVariable 2.9.2 Carbon
Function Remove-CGroupMember 2.9.2 Carbon
Function Remove-CHostsEntry 2.9.2 Carbon
Function Remove-CIniEntry 2.9.2 Carbon
Function Remove-CJunction 2.9.2 Carbon
Function Remove-CRegistryKeyValue 2.9.2 Carbon
Function Remove-CSslCertificateBinding 2.9.2 Carbon
Function Reset-CHostsFile 2.9.2 Carbon
Function Reset-CMsmqQueueManagerID 2.9.2 Carbon
Function Resolve-CFullPath 2.9.2 Carbon
Function Resolve-CIdentity 2.9.2 Carbon
Function Resolve-CIdentityName 2.9.2 Carbon
Function Resolve-CNetPath 2.9.2 Carbon
Function Resolve-CPathCase 2.9.2 Carbon
Function Resolve-CRelativePath 2.9.2 Carbon
Function Restart-CRemoteService 2.9.2 Carbon
Function Revoke-CComPermission 2.9.2 Carbon
Function Revoke-CHttpUrlPermission 2.9.2 Carbon
Function Revoke-CPermission 2.9.2 Carbon
Function Revoke-CPrivilege 2.9.2 Carbon
Function Revoke-CServicePermission 2.9.2 Carbon
Function Set-CDotNetAppSetting 2.9.2 Carbon
Function Set-CDotNetConnectionString 2.9.2 Carbon
Function Set-CEnvironmentVariable 2.9.2 Carbon
Function Set-CHostsEntry 2.9.2 Carbon
Function Set-CIniEntry 2.9.2 Carbon
Function Set-CRegistryKeyValue 2.9.2 Carbon
Function Set-CServiceAcl 2.9.2 Carbon
Function Set-CSslCertificateBinding 2.9.2 Carbon
Function Set-CTrustedHost 2.9.2 Carbon
Function Split-CIni 2.9.2 Carbon
Function Start-CDscPullConfiguration 2.9.2 Carbon
Function Test-CAdminPrivilege 2.9.2 Carbon
Function Test-CDotNet 2.9.2 Carbon
Function Test-CDscTargetResource 2.9.2 Carbon
Function Test-CFileShare 2.9.2 Carbon
Function Test-CFirewallStatefulFtp 2.9.2 Carbon
Function Test-CGroup 2.9.2 Carbon
Function Test-CGroupMember 2.9.2 Carbon
Function Test-CIdentity 2.9.2 Carbon
Function Test-CIPAddress 2.9.2 Carbon
Function Test-CMsmqMessageQueue 2.9.2 Carbon
Function Test-CNtfsCompression 2.9.2 Carbon
Function Test-COSIs32Bit 2.9.2 Carbon
Function Test-COSIs64Bit 2.9.2 Carbon
Function Test-CPathIsJunction 2.9.2 Carbon
Function Test-CPerformanceCounter 2.9.2 Carbon
Function Test-CPerformanceCounterCategory 2.9.2 Carbon
Function Test-CPermission 2.9.2 Carbon
Function Test-CPowerShellIs32Bit 2.9.2 Carbon
Function Test-CPowerShellIs64Bit 2.9.2 Carbon
Function Test-CPrivilege 2.9.2 Carbon
Function Test-CRegistryKeyValue 2.9.2 Carbon
Function Test-CScheduledTask 2.9.2 Carbon
Function Test-CService 2.9.2 Carbon
Function Test-CSslCertificateBinding 2.9.2 Carbon
Function Test-CTypeDataMember 2.9.2 Carbon
Function Test-CUncPath 2.9.2 Carbon
Function Test-CUser 2.9.2 Carbon
Function Test-CWindowsFeature 2.9.2 Carbon
Function Test-CZipFile 2.9.2 Carbon
Function Uninstall-CCertificate 2.9.2 Carbon
Function Uninstall-CDirectory 2.9.2 Carbon
Function Uninstall-CFileShare 2.9.2 Carbon
Function Uninstall-CGroup 2.9.2 Carbon
Function Uninstall-CJunction 2.9.2 Carbon
Function Uninstall-CMsmqMessageQueue 2.9.2 Carbon
Function Uninstall-CPerformanceCounterCategory 2.9.2 Carbon
Function Uninstall-CScheduledTask 2.9.2 Carbon
Function Uninstall-CService 2.9.2 Carbon
Function Uninstall-CUser 2.9.2 Carbon
Function Write-CDscError 2.9.2 Carbon
Function Write-CFile 2.9.2 Carbon
Filter Protect-CString 2.9.2 Carbon
Filter Unprotect-CString 2.9.2 Carbon

The Largest PowerShell Community in China has 1885 Members Now!

The largest PowerShell community “PowerShell Tech Interact” in China has 1885 members up to March 23, 2020!

The goal of this community is to:

  1. Help new PowerShellers to get up to PowerShell language
  2. Help every PowerSheller overcome any PowerShell technical difficulties
  3. Share code and information to accelerate the learning process

To contact with the community manager, please visit this MVP link.

Join Us Now! (you may need to install QQ client first)

PowerShell 技能连载 - 使用 PSWindowsUpdate 管理更新

在 PowerShell Gallery 中有许多有用的 PowerShell 模块。有一个能帮助您管理更新。要下载和安装它,请运行:

1
PS> Install-Module -Name PSWindowsUpdate -Scope CurrentUser -Force

它添加了一系列与 Windows Update 相关的新命令:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
PS> Get-Command -Module PSWindowsUpdate

CommandType Name Version Source
----------- ---- ------- ------
Alias Clear-WUJob 2.1.1.2 PSWindowsUpdate
Alias Download-WindowsUpdate 2.1.1.2 PSWindowsUpdate
Alias Get-WUInstall 2.1.1.2 PSWindowsUpdate
Alias Get-WUList 2.1.1.2 PSWindowsUpdate
Alias Hide-WindowsUpdate 2.1.1.2 PSWindowsUpdate
Alias Install-WindowsUpdate 2.1.1.2 PSWindowsUpdate
Alias Show-WindowsUpdate 2.1.1.2 PSWindowsUpdate
Alias UnHide-WindowsUpdate 2.1.1.2 PSWindowsUpdate
Alias Uninstall-WindowsUpdate 2.1.1.2 PSWindowsUpdate
Cmdlet Add-WUServiceManager 2.1.1.2 PSWindowsUpdate
Cmdlet Enable-WURemoting 2.1.1.2 PSWindowsUpdate
Cmdlet Get-WindowsUpdate 2.1.1.2 PSWindowsUpdate
Cmdlet Get-WUApiVersion 2.1.1.2 PSWindowsUpdate
Cmdlet Get-WUHistory 2.1.1.2 PSWindowsUpdate
Cmdlet Get-WUInstallerStatus 2.1.1.2 PSWindowsUpdate
Cmdlet Get-WUJob 2.1.1.2 PSWindowsUpdate
Cmdlet Get-WULastResults 2.1.1.2 PSWindowsUpdate
Cmdlet Get-WURebootStatus 2.1.1.2 PSWindowsUpdate
Cmdlet Get-WUServiceManager 2.1.1.2 PSWindowsUpdate
Cmdlet Get-WUSettings 2.1.1.2 PSWindowsUpdate
Cmdlet Invoke-WUJob 2.1.1.2 PSWindowsUpdate
Cmdlet Remove-WindowsUpdate 2.1.1.2 PSWindowsUpdate
Cmdlet Remove-WUServiceManager 2.1.1.2 PSWindowsUpdate
Cmdlet Set-PSWUSettings 2.1.1.2 PSWindowsUpdate
Cmdlet Set-WUSettings 2.1.1.2 PSWindowsUpdate
Cmdlet Update-WUModule 2.1.1.2 PSWindowsUpdate

大多数命令需要提升权限的 shell 才能正常工作,但每个人都可以获得基本信息。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
PS> Get-WULastResults
WARNING: To perform some operations you must run an elevated Windows PowerShell console.

ComputerName LastSearchSuccessDate LastInstallationSuccessDate
------------ --------------------- ---------------------------
DESKTOP-8DVNI43 22.01.2020 11:29:24 22.01.2020 11:29:52



PS> Get-WUApiVersion
WARNING: To perform some operations you must run an elevated Windows PowerShell console.

ComputerName PSWindowsUpdate PSWUModuleDll ApiVersion WuapiDllVersion
------------ --------------- ------------- ---------- ---------------
DESKTOP-8... 2.1.1.2 2.0.6995.28496 8.0 10.0.18362.387