How to change default admin user name and password of a modern.ie Windows 10 virtual machine (VM) manually and/or programmatically? -- [Question Asked]

Query asked by user

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()

Answer we found from sources

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.

Answered By – Harry Johnston

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0


Who we are?

We are team of software engineers in multiple domains like Programming and coding, Fundamentals of computer science, Design and architecture, Algorithms and data structures, Information analysis, Debugging software and Testing software. We are working on Systems developer and application developer. We are curious, methodical, rational, analytical, and logical. Some of us are also conventional, meaning we're conscientious and conservative.

Answer collected from stackoverflow and other sources, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0