runas Administrator RRS feed

  • Question

  • Hi

    inside the container, how can I do a runas administrator? (activated the administrator already with net user administrator /active:yes). It prompts for password, but the BUILTIN\Administrator's password from ContainerHost does not work. runas /user:<containerid>\Administrator does not work either. Also tried <containerhost>\Administrator

    BTW: What is the difference between containerhosts hostname and the containers hostname? When I type hostname inside the container it shows me the same hostname as in the host. 

    But (@container) Get-WmiObject -Class Win32_UserAccount shows me a different hostname for the container users.

    Has someone already used different users in the container?

    Monday, February 15, 2016 3:32 PM

All replies

  • Not sure how you're connecting to your container but when using winrm you can do it like this:

    Enter-PSSession -ContainerId $container.Id -RunAsAdministrator

    To get administrator acces inside the container.

    • Proposed as answer by William Ayerst Friday, February 19, 2016 11:23 AM
    Thursday, February 18, 2016 11:48 AM
  • docker
    Tuesday, February 23, 2016 11:37 AM
  • Tried it with Powershell (and "New-Container", "Start-Container" etc), but if I Enter-PSSession to my WindowsServerCore based container, executing "whoami" still shows me LocalSystem ("nt authority\system")
    Wednesday, February 24, 2016 2:54 PM