Reputation: 3276
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)
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
Passw0rd!
--> New password => vagrant
... etc.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()
Upvotes: 1
Views: 5435
Reputation: 36328
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 computerDefaultUserName
- the user account to log intoDefaultPassword
- the password for the user accountFor 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.
Upvotes: 2