Lusrmgr.exe __hot__ -

$SecurePassword = Read-Host "Enter password" -AsSecureString New-LocalUser -Name "ServiceAccount" -Password $SecurePassword Automation Script Example # Complete user provisioning script param( [Parameter(Mandatory=$true)] [string]$UserName, [string]$FullName, [string]$GroupName = "Users" ) Elevation check if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) Start-Process powershell.exe -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File "$PSCommandPath " $UserName $FullName $GroupName" -Verb RunAs exit

# Export all local users and groups $output = @() Get-LocalUser | ForEach-Object $output += [PSCustomObject]@ Username = $_.Name Enabled = $_.Enabled LastLogin = $_.LastLogon Groups = (Get-LocalGroup lusrmgr.exe

if (user.SchemaClassName == "User")

foreach (DirectoryEntry user in users.Children) lusrmgr.exe