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.
You're going to pre-create the email/MS accounts, and you're just looking to create a new Windows user and associate them to that email/MS account, correct? Have you tried using the traditional "Net User" command(s)? – Ƭᴇcʜιᴇ007 – 2013-07-16T18:17:53.640
1@techie007 Yes, in the current case all Microsoft email accounts are already pre-created. But upon reading your comment, I realized it would be very useful for me to be able to create these accounts programmatically. So, if anybody know how to do that, please include it in your answer. Thanks! – Piotr Shatalin – 2013-07-16T18:27:36.163
Automating the creation of email accounts on MS's site would be off-topic for here, that's why I wanted to get clarification on what parts you are trying to automate. :) Aside form that, what exactly have you tried already? Where are you getting stuck in your scripting? – Ƭᴇcʜιᴇ007 – 2013-07-16T18:32:50.070
@techie007 I am quite a newbie in PowerShell scripting, basically only familiar with filesystem/registry/ACL manipulation, general pipelining and scripting constructs and .NET/COM interop. – Piotr Shatalin – 2013-07-16T19:38:40.523