How can I create a new user account on Windows 8 associated with a Microsoft email account?

08
2013-11
  • Piotr Shatalin

    How can I create a new local user account on Windows 8 associated with a Microsoft email account (e.g. MicrosoftAccount\[email protected]) programmatically, using PowerShell or another scripting language available on Windows. The script will be provided with the email address and password for the Microsoft account.

    Thanks in advance for your help!

  • Answers
  • TomEus

    Yes, creating the Live account automatically is against TOS for the Live service thus off topic here. But I think what you are looking for is this:

    # Create new local Admin user for script purposes
    $Computer = [ADSI]"WinNT://$Env:COMPUTERNAME,Computer"
    
    $LocalAdmin = $Computer.Create("User", "LocalAdmin")
    $LocalAdmin.SetPassword("Password01")
    $LocalAdmin.SetInfo()
    $LocalAdmin.FullName = "Local Admin by Powershell"
    $LocalAdmin.SetInfo()
    $LocalAdmin.UserFlags = 64 + 65536 # ADS_UF_PASSWD_CANT_CHANGE + ADS_UF_DONT_EXPIRE_PASSWD
    $LocalAdmin.SetInfo()
    

    Or you can use the old method:

    Another alternative is the old school NET USER commands:

    NET USER username "password" /ADD
    

    OK - you can't set all the options but it's a lot less convoluted for simple user creation & easy to script up in Powershell.

    NET LOCALGROUP "group" "user" /add to set group membership.
    
  • Peter Hahndorf

    Windows accounts associated with Microsoft accounts are just normal Windows accounts with a little bit extra information added to them in the SAM.

    You first use your favourite method to create your new accounts (net user, PowerShell, WMI) and then add the extra information to the new accounts.

    This is actually rather tricky to do, because Microsoft does not provide a public API for it. Luckily someone did all the hard work for us. This blog post explains the details and provides a PowerShell script to add the additional information.


  • Related Question

    In Windows 8, how do you disable the unlock password for Microsoft Accounts?
  • Huckle

    In Windows 8, in the scenario where there is a single user that has a Microsoft Account (i.e., they have created their account via a Microsoft email address) how does one disable the password prompt when unlocking the screen?

    The Windows 7 analogy would be to disable the screensaver password prompt.

    I can do this on a "local" account (one not backed by Microsoft) but the setting seems to have no effect on connected accounts.

    To replicate:

    1. create an account using [email protected] or [email protected]
    2. Lock the screen with WinKey+L
    3. Attempt to unlock, by clicking the mouse, without entering a password.

  • Related Answers
  • Indrek

    To turn on automatic sign in for a local user account or Microsoft account:

    1. press Win+R to open the Run dialog box, then type in netplwiz and press Enter

    2. select the user name of the local user account or Microsoft account that you want to have Windows 8 log on to automatically at startup

    3. uncheck the "Users must enter a username and password to use this computer" box, and click/tap on OK

    4. enter the password of the selected local user account or Microsoft account twice, and click/tap on OK

  • Moses

    If you have a Microsoft account, utilize netplwiz in run, and disable the password, upon reboot your system then gives two options for signing in; a local account and the Microsoft account. The local account will not require a password, but the Microsoft account does require a password.

    To answer your question about disabling the password on a machine that is already running and you leave it unattended for some time, follow the directions in this article, which does work. http://www.extremetech.com/computing/142482-how-to-disable-the-windows-8-lock-screen

  • random

    Disable the password using Run → netplwiz

    This will disable the password prompt. Even with a Microsoft account.

  • Aditya

    Goto Run (Win + R) Open netplwiz You will get an option to disable the password prompt