it:ad:powershell:howto:script_admin_operations_users

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

Summary

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

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

  • /home/skysigal/public_html/data/pages/it/ad/powershell/howto/script_admin_operations_users.txt
  • Last modified: 2023/11/04 23:01
  • by 127.0.0.1