IT:AD:Powershell:HowTo:Script/Admin Operations/Users

Summary

The following are common Admin IT:AD:Powershell snippets.

Processes

Create a Local User Account:

Common setup operations are: * Service accounts to run IT:AD:Jenkins or other CI services, * Accounts for remote guest access to look but not touch, * etc.

$hostname = HOSTNAME
$username = "SomeName"
$pwd = "P@ssword1"
$cn = [ADSI]"WinNT:$hostname"
$user = $cn.Create("User",$username)
$user.SetPassword($pwd)
$user.setInfo()

Adding a Local User to a Group

PS C:\Windows\system32> net localgroup Administrators $hostname\$username /ADD