1

Intention

I would like to use a Windows 10 virtual machine (VM) downloaded from Microsoft´s modern.ie website with Vagrant. Although Microsoft provides a download option which is prepared for Vagrant (s. picture 01) it actually can't be used out of the box and needs some further configuration (e.g. as described here). One thing which needs to be configured is user & password to boot with. The Machine defaults to boot with admin user IEUser and password Passw0rd!. I would like to know how to accomplish change of user/password in two different manners - manually (s. Question 1) and programmatically (s. Question 2)

Picture 01: Picture 01

Question 1

Which detailed steps I need to go through the Windows GUI to "really" change name & password of admin user IEUser/ Passw0rd! to e.g. vagrant/ vagrant?

NOTE: I already tried the obvious way

  1. User Accounts --> Change your account name --> vagrant
  2. User Account --> Make changes to my account in PC settings --> Sign-in option --> Password/Change --> Current password => Passw0rd! --> New password => vagrant ... etc.
  3. I ended up booting with IEUser and wrong password
  4. I guess it is somehow related to the profile which I didn´t managed to change through the GUI (s. picture 02

Picture 02: Picture 02

Question 2

How to accomplish change of admin user and it´s password (IEUser / Passw0rd!) from command line (cmd)? The aim of that is to have a script which can be called e.g. from Vagrantfile at vagrant up-time.

I tried the following PowerShell commands which I found here but they did not work for me (maybe because they are meant for Windows Server 2012 R2(?)):

$admin=[adsi]"WinNT://./Administrator,user"
$admin.psbase.rename("vagrant")
$admin.SetPassword("vagrant")
$admin.UserFlags.value = $admin.UserFlags.value -bor 0x10000
$admin.CommitChanges()
Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Wlad
  • 2,866
  • 3
  • 28
  • 42
  • What does "I ended up booting with IEUser and wrong password" mean? Is the machine configured to log on automatically? If so, you'll need to change the saved password to correspond to the new password that you've set. (But why do you need to change the username and password anyway? The document you link to uses vagrant/vagrant as an example, there's no obvious indication that you *must* use this combination.) – Harry Johnston Aug 11 '16 at 00:01
  • @HarryJohnston Yes, the machine logs on automatically. – Wlad Aug 11 '16 at 04:37
  • @HarryJohnston " If so, you'll need to change the saved password to correspond to the new password that you've set." - Isn´t that what I´ve done manually as described under Question 1? – Wlad Aug 11 '16 at 04:38
  • I want to chage it to `vagrant`/ `vagrant` because it´s the default combination Vagrant users are used to. And as I want to make it public on Github it should be possible to get started with it as easy as possible - according to my motto: Respect the noobs, too! ;-) – Wlad Aug 11 '16 at 04:44
  • I'm not sure about the automatic logon, I'll get back to you. But one recommendation I can make off the bat: if at all possible, create a new account rather than renaming the existing one. (For one thing, that's the only supported way to make the profile name match the username.) – Harry Johnston Aug 11 '16 at 22:29
  • Here is a [snippet from Vagrantfile](https://gist.github.com/Tset-Noitamotua/6667240380f398996ea231f02305394a) I use to start the VM. Even then I create a new user and edit lines 13 and 14 in [Vagrantfile](https://gist.github.com/Tset-Noitamotua/6667240380f398996ea231f02305394a) accordingly the VM halts on logon screen prompting for password of `IEUser`. – Wlad Aug 12 '16 at 16:31

1 Answers1

2

OK, I'm running build 1607, which is apparently slightly different to the one you're using. But the actions you describe in "Question 1" (when adjusted for build 1607) change the user's password but not the automatic logon password. So does the code you posted in "Question 2".

The Vagrant settings appear to control how Vagrant connects to the VM over the network. I don't believe that they affect the VM itself.

There are instructions here (or Google "windows 10 automatic logon") for configuring/reconfiguring automatic logon, either via the GUI or via the registry. The registry method is easy to program in whatever language you prefer, and the registry keys are documented on Technet (or search for "AutoAdminLogon").

A quick summary of the GUI method: open the Start Menu or a command window and run netplwiz. Untick "Users must enter a user name and password to use this computer", or if it is already unticked, tick it and then untick it. Then press Apply, and a dialog box will appear asking for the credentials to use.

A quick summary of the registry method: create or set various REG_SZ values as described in this registry key:

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
  • AutoAdminLogon - set to "1" to enable automatic logon (note that this is a string value)
  • DefaultDomainName - the name of the computer
  • DefaultUserName - the user account to log into
  • DefaultPassword - the password for the user account

For completeness, see also Protecting the Automatic Logon Password on MSDN. In this context, there is no need to encrypt the password. However, if the VM ships with the automatic logon password encrypted, you might need to remove the encrypted password before adding your plaintext password.

Harry Johnston
  • 35,639
  • 6
  • 68
  • 158
  • Great answer & great links! Thank you. I tried the manual steps and they worked as expected. Will try the programmatic way next. Sidenote: when logged in as `vagrant` User I am not able to open Windows´ start menu by clicking on it with the mouse nor by pressing the Win-Key on the keyboard. Besides that the system seems to be fully functional. May be it´s just a sideeffect of previous experiments it did on that installation(?). – Wlad Aug 15 '16 at 05:54
  • I believe that's a very common Windows 10 problem with a number of possible causes, and if I remember rightly, renaming a user account is one of them. You might be able to find help for that on Super User, or you could try starting again with a clean image and making sure you create `vagrant` as a new account. – Harry Johnston Aug 15 '16 at 21:16