I am trying to install the Windows Enterprise WDK on a Docker image based on windowsservercore. The application installs by unziping and I have already done that and committed that image to Docker. Now I need to run a script that sets environment variables. According to the Enterprise WDK install instructions I must run this script as administrator. I've done this directly on my desktop machine and it works file. Within the Docker Container, the default login user is

PS C:\> whoami
user manager\containeradministrator

I've tried enabling the admin account.

PS C:\> net user administrator /active:yes
The command completed successfully.
PS C:\> net user administrator Pa$$w0rd
The command completed successfully.

I try to start a shell as administrator, but the user does not change.

PS C:\> runas /user:administrator powershell
Enter the password for administrator:
Attempting to start powershell as user "C597C386289A\administrator" ...
PS C:\> whoami
user manager\containeradministrator

And if I run my script it fails to have set any of the environment values specified in the script.


  • 3
    Did you manage to solve this? – fons Mar 28 '17 at 11:24
  • 1
    You might have an issue with UAC, could you temporarily disable it? Runas as you wrote it does not allow opening an elevated command prompt, see here. I'd give NirCmd a try :-) – simlev Mar 28 '17 at 14:03
  • 1
    How are you connecting to the container? RDP? Remote powershell? – harrymc Mar 28 '17 at 17:49
  • 1
    @harrymc Running the container in interactive mode. – Daniel Mar 29 '17 at 15:35
  • 1
    Because the local Administrator account is a very special account, a login might be required. Why can't you use another "normal" administrator account? – harrymc Mar 29 '17 at 18:52

Your problem is not insufficient rights at all. See this article.

UAC is not available in Server Core, since it is a command line only interface, doesn’t have IE, or support for user applications. In addition, to use UAC with the command prompt you need to have the Explorer Shell so that you can click Start, right click on Command Prompt, and select run as administrator, which obviously isn’t possible on Server Core.

You are already running commands as an administrator, otherwise commands like

net user administrator Pa$$w0rd

would fail inevitably.

Your problem is something else.

Windows Server Core is not supported for installing WDK. About setting environment variables on Server Core see this answer.

You should take a look at that script and what it actually does, if it uses SET or SETX commands or something else and there you can find a clue why the variables are not being set properly. It might be that they are set permanently but not in your current window.

  • 2
    I had replaced the set commands with setx trying to debug other problems. That's what led me down the path of trying to get real admin privilege. – Daniel Apr 3 '17 at 21:26
  • 1
    your second link doesn't redirect to anything meaningful anymore – Rainb Feb 16 at 22:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.