param
(
   [Parameter(Mandatory=$true)]
   [string]$user
)
$Computer = [ADSI]"WinNT://$Env:COMPUTERNAME,Computer"

$LocalUser = $Computer.Create("User", $user)
$LocalUser.SetPassword("PASsw0r4&!=")
$LocalUser.SetInfo()
net localgroup Administrators $user /ADD

param
(
   [Parameter(Mandatory=$true)]
   [string]$user,
   [Parameter(Mandatory=$false)]
   [string]$password="PASsw0r4&!="
)
$Computer = [ADSI]"WinNT://$Env:COMPUTERNAME,Computer"

$LocalUser = $Computer.Create("User", $user)
$LocalUser.SetPassword($password)
$LocalUser.SetInfo()
net localgroup Administrators $user /ADD

Allow the password for the created user to be supplied at the command line.
Allow the password for the created user to be supplied at the command line.
