⚡ PowerShell
PowerShell Script to Create Local Admin Account via Intune
Create a local admin account on managed devices using a PowerShell script deployed through Intune
▾
Create a new local admin account on Intune-managed Windows devices. The script checks for existence before creating and adds the user to the Administrators group.
$Username = "LocalAdmin"
$Password = ConvertTo-SecureString "Net@admin$1" -AsPlainText -Force
if (-not (Get-LocalUser -Name $Username -ErrorAction SilentlyContinue)) {
New-LocalUser -Name $Username -Password $Password -PasswordNeverExpires
Add-LocalGroupMember -Group "Administrators" -Member $Username
Write-Output "Account created."
} else { Write-Output "Account already exists." }