我运行以下命令:
Get-WindowsOptionalFeature -Online -FeatureName TelnetClient | ConvertTo-Json -Depth 100
它产生以下输出:
{
"DisplayName": "Telnet Client",
"Description": "Allows you to connect to other computers remotely.",
"RestartRequired": 1,
"CustomProperties": [
{
"Name": "Description",
"Value": "Telnet Client uses the Telnet protocol to connect to a remote Telnet server and run applications on that server.",
"Path": "ServerComponent"
},
{
"Name": "DisplayName",
"Value": "Telnet Client",
"Path": "ServerComponent"
},
{
"Name": "Id",
"Value": "44",
"Path": "ServerComponent"
},
{
"Name": "Type",
"Value": "Feature",
"Path": "ServerComponent"
},
{
"Name": "UniqueName",
"Value": "Telnet-Client",
"Path": "ServerComponent"
},
{
"Name": "Major",
"Value": "10",
"Path": "ServerComponent\\Version"
},
{
"Name": "Minor",
"Value": "0",
"Path": "ServerComponent\\Version"
},
{
"Name": "Name",
"Value": "TelnetClient",
"Path": "ServerComponent\\Deploys\\Update"
}
],
"FeatureName": "TelnetClient",
"State": 0,
"Path": null,
"Online": true,
"WinPath": null,
"SysDrivePath": null,
"RestartNeeded": false,
"LogPath": "C:\\Windows\\Logs\\DISM\\dism.log",
"ScratchDirectory": null,
"LogLevel": 2
}
我的问题特别是关于“RestartNeeded”和“RestartRequired”之间的区别是什么?他们似乎都在谈论同一个话题。它们之间究竟有什么区别?
"RestartRequired"
实际上是一个Microsoft.Dism.Commands.RestartType
具有值的枚举 ( ):
姓名 | 价值 |
---|---|
不 | 0 |
可能的 | 1 |
必需的 | 2 |
(很遗憾,我仍在使用 PowerShell 5.1,它缺少在 PowerShell 6 和 7 中添加的-EnumsAsStrings
选项。)ConvertTo-Json