Created
April 21, 2023 22:18
-
-
Save nicolonsky/77e34dd81e91a92a3b26073e8c2fab5b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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