How can I provide elevation to an operation?

10

4

In Windows 10 Pro, I tried to install linux subsystem, but it says

> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Enable-WindowsOptionalFeature : The requested operation requires elevation.        
`At line:1 char:1 + Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~        
+ CategoryInfo          : NotSpecified: (:) [Enable-WindowsOptionalFeature], COMExcep
+ FullyQualifiedErrorId : Microsoft.Dism.Commands.EnableWindowsOptionalFeatureCommand`

What can I do?

Tim

Posted 2017-01-17T18:29:30.903

Reputation: 12 647

It may be talking about elevated privileges. If so then you will need to be admin. – ctrl-alt-delor – 2017-01-17T18:32:52.510

Yes, I an the local admin, but the problem is why it asks for it? – Tim – 2017-01-17T18:34:09.067

It is probably run as a virtual machine, if the hypervisor is not installed then it will need privileges to install it. There is no way around this for a hypervisor. Or it could be trying to install it in system folders. – ctrl-alt-delor – 2017-01-17T18:38:33.387

I didn't run Windows in virtual machine. I let it install in default directory. – Tim – 2017-01-17T18:41:12.057

The Linux subsystem is probably run as a virtual machine, if the hypervisor is not installed then it will need privileges to install it. There is no way around this for a hypervisor. Or it could be trying to install it in system folders. – ctrl-alt-delor – 2017-01-17T18:44:42.740

1"but the problem is why it asks for it?" - Because adding ANY Windows feature to an installation requires an Administrator elevation. – Ramhound – 2017-01-17T20:47:06.553

1@Richard - "The Linux subsystem is probably run as a virtual machine. ... There is no way around this for a hypervisor." - This is false. Please research this feature before you speak to how it works. – Ramhound – 2017-01-17T20:47:20.200

@Ramhound are you saying that the linux subsystem is not run in a virtual machine? Or that it is possible to install a hypervisor with elevated privileges? It is hard to tell which. – ctrl-alt-delor – 2017-01-18T19:14:18.760

I am indeed saying that the linux subsystem is not a virtual machine. If it was a virtual machine, the feature itself would require you to enable Hyper-V, and it does not. To put it simply, its a compatability layer, WSL allows the linux kernel to run within Windows. The specific version of the kernel is Ubuntu, with the interface maintained by Microsoft, and the kernel maintain by Canonical. – Ramhound – 2017-01-18T19:15:23.490

have you done what I wrote in the answer and selected "Run as administrator"? This is the elevation you want – magicandre1981 – 2017-01-21T07:46:17.520

Answers

17

You have to start powershell as admin

enter image description here

and here run the command.

magicandre1981

Posted 2017-01-17T18:29:30.903

Reputation: 86 560

Why, oh why is this not documented in any of the installation instructions? Thank you so much for the answer! – KateYoak – 2019-10-11T17:41:24.317

@KateYoak it is documented: Open PowerShell as Administrator and run

– magicandre1981 – 2019-10-12T14:11:18.837