Skip to content

Instantly share code, notes, and snippets.

@nicolonsky
Created April 21, 2023 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicolonsky/77e34dd81e91a92a3b26073e8c2fab5b to your computer and use it in GitHub Desktop.
Save nicolonsky/77e34dd81e91a92a3b26073e8c2fab5b to your computer and use it in GitHub Desktop.
Add-Type -AssemblyName 'System.Web'
$userParams = @{
Name = 'clientadmin'
Description = 'LAPS Client Admin'
Password = [System.Web.Security.Membership]::GeneratePassword(16, 0) | ConvertTo-SecureString -AsPlainText -Force
}
# create user with random password
$user = New-LocalUser @userParams
# Add user to built-in administrators group
Add-LocalGroupMember -SID 'S-1-5-32-544' -Member $user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment