How to change default admin user name and password of a modern.ie Windows 10 virtual machine (VM) manually and/or programmatically?
<h2>Intention</h2>
<p>I would like to use a Windows 10 virtual machine (VM) downloaded from Microsoft´s <a href="https://developer.microsoft.com/en-us/microsoft-edge/" rel="nofollow noreferrer">modern.ie</a> website with <a href="https://www.vagrantup.com/" rel="nofollow noreferrer">Vagrant</a>. 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 <a href="https://gist.github.com/uchagani/48d25871e7f306f1f8af" rel="nofollow noreferrer">configuration</a> (<a href="https://gist.github.com/uchagani/48d25871e7f306f1f8af" rel="nofollow noreferrer">e.g. as described here</a>). One thing which needs to be configured is user &amp; password to boot with. The Machine defaults to boot with admin user <code>IEUser</code> and password <code>Passw0rd!</code>. 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)</p>
<p>Picture 01:
<a href="https://i.stack.imgur.com/drSUO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/drSUO.png" alt="Picture 01" /></a></p>
<h2>Question 1</h2>
<p>Which detailed steps I need to go through the Windows GUI to &quot;really&quot; change name &amp; password of admin user <code>IEUser</code>/ <code>Passw0rd!</code> to e.g. <code>vagrant</code>/ <code>vagrant</code>?</p>
<p>NOTE: I already tried the obvious way</p>
<ol>
<li>User Accounts --&gt; Change your account name --&gt; vagrant</li>
<li>User Account --&gt; Make changes to my account in PC settings --&gt; Sign-in option --&gt; Password/Change --&gt; Current password =&gt; <code>Passw0rd!</code> --&gt; New password =&gt; <code>vagrant</code> ... etc.</li>
<li>I ended up booting with IEUser and wrong password</li>
<li>I guess it is somehow related to the profile which I didn´t managed to change through the GUI (s. picture 02</li>
</ol>
<p>Picture 02:
<a href="https://i.stack.imgur.com/kZQhM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kZQhM.png" alt="Picture 02" /></a></p>
<h2>Question 2</h2>
<p>How to accomplish change of admin user and it´s password (<code>IEUser</code> / <code>Passw0rd!</code>) from command line (cmd)? The aim of that is to have a script which can be called e.g. from Vagrantfile at <code>vagrant up</code>-time.</p>
<p>I tried the following PowerShell commands which I found <a href="http://www.hurryupandwait.io/blog/in-search-of-a-light-weight-windows-vagrant-box" rel="nofollow noreferrer">here</a> but they did not work for me (maybe because they are meant for Windows Server 2012 R2(?)):</p>
<pre><code>$admin=[adsi]&quot;WinNT://./Administrator,user&quot;
$admin.psbase.rename(&quot;vagrant&quot;)
$admin.SetPassword(&quot;vagrant&quot;)
$admin.UserFlags.value = $admin.UserFlags.value -bor 0x10000
$admin.CommitChanges()
</code></pre>