Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn Windows features on and off #556

Closed
blogcraft opened this issue Sep 4, 2020 · 16 comments
Closed

Turn Windows features on and off #556

blogcraft opened this issue Sep 4, 2020 · 16 comments
Labels
Issue-Feature This is a feature request for the Windows Package Manager client.
Milestone

Comments

@blogcraft
Copy link

Part of my setup is using Docker for Windows, obviously it works best with WSL2.

It would be nice to be able to turn things on in windows for my setup to be complete.

@ghost ghost added the Needs-Triage Issue need to be triaged label Sep 4, 2020
@denelon denelon added Issue-Feature This is a feature request for the Windows Package Manager client. and removed Needs-Triage Issue need to be triaged labels Sep 8, 2020
@megamorf
Copy link

megamorf commented Sep 8, 2020

This can be done easily with PowerShell or the Deployment Image Servicing and Management (DISM) tool. I don't see how winget would help with that...

@maciejpankanin
Copy link

It would be nice if winget install telnet turned on telnet in Windows features.

@megamorf
Copy link

Sorry but that's really just Install-WindowsFeature Telnet-Client in PowerShell with less ambiguity about what's going to happen. Or alternatively dism /online /Enable-Feature /FeatureName:TelnetClient with DISM.

@denelon denelon added this to the Package Manager Backlog milestone Sep 15, 2020
@jedieaston
Copy link
Contributor

It would help for installing the RSAT, since that's been split up into 20-someodd packages in optional features. Chocolatey has a choco install rsat that installs all of them via a PowerShell script.

Maybe PowerShell script support as an installer type would be the real feature request? Although that may encourage bad habits, since people could bypass the manifest creation step and put all of the logic inside of a non-standard script which then has to be debugged in a different way.

@megamorf
Copy link

megamorf commented Sep 20, 2020

If all you know is a hammer everything looks like a nail.

I'm a strong proponent of using the right tool for the job and the RSAT installation in PowerShell really is just a single line:

#### Client OS (Windows 10) - uses DISM behind the scenes

# List RSAT components that are not installed
Get-WindowsCapability -Name RSAT* -Online | Where-Object { $_.State -eq "NotPresent" }

# Install all RSAT components
Get-WindowsCapability -Name RSAT* -Online | Add-WindowsCapability –Online


#### Server OS (Server 201X) - uses Server Manager behind the scenes

# List RSAT components that are not installed
Get-WindowsFeature -Name RSAT* | Where-Object { $_.Installed -ne $true }

# Install all RSAT components
Install-WindowsFeature -Name RSAT -IncludeAllSubFeature -IncludeManagementTools

See https://hahndorf.eu/blog/WindowsFeatureViaCmd for details.

@denelon
Copy link
Contributor

denelon commented Sep 30, 2020

This could be part of #163 "Support for package dependencies". If you winget install ubuntu we should be able to see if WSL is enabled or not, and take care of that for you.

@doctordns
Copy link

If it were me, I;d keep the focus on WInget being a tool to lay down applications on developer workstations.
If you need to configure a system after installation, you just use the existing PowerShell tool. THat has considerable advantages for not causing the winget guys to have to reinvent more wheels and would certainly end up with less confusing commands.

@catthehacker
Copy link

What could be done is to allow packages to define post installation configuration (like apt has debconf) but I'm strongly against adding option such as enabling features via winget.

@quangkieu
Copy link

I would suggest that when we have dependencies in winget, and the app manifest define that it depend on some windows features, winget would check if that exist and installed
If condition not meet, winget would just throw error with helpful message like suggest powershell command to install as that would allow user to communicate to IT management to enable if allowed.
As Windows feature is mostly need to be control by Administration

@doctordns
Copy link

doctordns commented Jan 6, 2021

If you want to add/remove features, there are cmdlets for that.

Let WInget do its job and not all the other jobs it could do. Winget might have some great use cases and a great vision, but let's not reinvent wheels we do not need to.

@jantari
Copy link

jantari commented Feb 23, 2023

I would suggest that when we have dependencies in winget, and the app manifest define that it depend on some windows features, winget would check if that exist and installed
If condition not meet, winget would just throw error with helpful message like suggest powershell command to install as that would allow user to communicate to IT management to enable if allowed.
As Windows feature is mostly need to be control by Administration

I can see this being useful. winget does not need to install features or optional components, Get-WindowsCapability -Name RSAT* -Online | Add-WindowsCapability –Online works just fine as we've established but it would maybe be useful if windows features can be listed as dependencies of a package.

It pains me to say but we all know there's some software out there that requires .NET 3.5 for example. winget could test for the feaure and throw an error that a dependency is not satisfied.

@denelon
Copy link
Contributor

denelon commented Feb 23, 2023

@jantari we're working on the experimental dependency flow to enable Windows features. We've started seeing more packages that require .NET 3.5, and this would essentially unblock them.

It would be some future feature to look at something like winget enable <Windows feature> and the corrolary winget disable <Windows feature>.

@denelon
Copy link
Contributor

denelon commented Feb 23, 2023

@cgerke
Copy link

cgerke commented Feb 24, 2023

This would be a very nice addition to assist enterprise management and simplify how its done within Intune. I'm doing something like this at the moment.

`# Pro-Active Remediation Detect
[int32]$SkipRemediate = 0
[int32]$Remediate = 1

#endregion

try
{
if ($(Get-WindowsOptionalFeature -Online -FeatureName 'NetFx3' -ErrorAction Stop).State -eq "Enabled")
{
exit $Remediate
}
else
{
exit $SkipRemediate
}
}
catch
{
Write-Host $_.Exception.Message
exit $Remediate
}
`

`# Pro-Active Remediation Remediate
#region DoNotModify

[int32]$Success = 0
[int32]$Failure = 1

#endregion

try {
# Disable AND remove source?
# Disable-WindowsOptionalFeature -Online -FeatureName "NetFx3" -NoRestart -Remove
# Disable
Disable-WindowsOptionalFeature -Online -FeatureName "NetFx3" -NoRestart -ErrorAction Stop
exit $Success
}
catch
{
Write-Host $_.Exception.Message
exit $Failure
}
`

  • or -

`

Win32App Requirement

If ((Get-WindowsCapability -Online -Name NetFX3~~~~).Name -eq 'NetFX3~~~~') {
$Requirement = "NetFX3"
}
`

`

Win32App Detection

If ((Get-WindowsCapability -Online -Name NetFX3~~~~).State -eq 'Installed') {
$Detection = "NetFX3"
}
`

@denelon
Copy link
Contributor

denelon commented Mar 6, 2024

We've added support for enabling Windows Features in WinGet 1.7 as a dependency of another package. As this version continues to roll out, we will be adding a manifest for WSL including the Windows Feature it depends on.

@denelon denelon closed this as completed Mar 6, 2024
@denelon denelon modified the milestones: Backlog-Client, 1.8 Client Mar 6, 2024
@Croydon
Copy link

Croydon commented May 1, 2024

As this version continues to roll out, we will be adding a manifest for WSL including the Windows Feature it depends on.

Is this still WIP?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Feature This is a feature request for the Windows Package Manager client.
Projects
None yet
Development

No branches or pull requests