Syntax
$Username = “Infrassist”
$Password = “local@DM!N”
$group = “Administrators”
$adsi = [ADSI]”WinNT://$env:COMPUTERNAME”
$existing = $adsi.Children | where {$_.SchemaClassName -eq ‘user’ -and $_.Name -eq $Username }
if ($existing -eq $null) {
Write-Host “Creating new local user $Username.”
& NET USER $Username $Password /add /y /expires:never
Download Full Script
| Purpose: | Create Local User as part of the Administrator Group |
| Modification: | |
| Type: | PowerShell (.ps1) |
| Compatibility: | Run with PowerShell |
| Tags: | |
| Reference link: |