I run the following:
Get-WindowsOptionalFeature -Online -FeatureName TelnetClient | ConvertTo-Json -Depth 100
It produces the following output:
{
"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
}
My question is in particular about what is the difference between "RestartNeeded" and "RestartRequired"? They both appear to be about the same topic. What exactly is the difference between them?
"RestartRequired" is actually an enumeration (Microsoft.Dism.Commands.RestartType) with values:
| Name | Value |
|---|---|
| No | 0 |
| Possible | 1 |
| Required | 2 |
(It is a pity that I am still using PowerShell 5.1 which lacks the -EnumsAsStrings option to ConvertTo-Json which was added in PowerShell 6 and 7.)
Short Answer: On features like
TelnetClientwhich return a[Microsoft.Dism.Commands.AdvancedFeatureObject]:RestartRequireddenotes whether a restart could be required after installing or enabling the featureRestartNeededis used to show whether a restart is currently pending for the feature.Long Version: The
AdvancedFeatureObjecttype never actually gets this value set though. Instead, the property is only used byMicrosoft.Dism.Commands.ImageObjectwhich is returned fromEnable/Disable-WindowsOptionalFeature. For example:I think the
RestartNeededproperty is only present on theAdvancedFeatureObjectdue to some type inheritance, and is not actually a useful property.