Windows 10 Pro -- local admin account creation, Powershell Script ?

I have 5 new Windows 10 Pro machines that will NOT be on a domain and will NOT be in Active Directory

How can I create a PowerShell/etc script I can run on each machine to create four local admin accounts (ITDept1/pass1, ITDept2/pass2, ITDept3/pass3) and add these account to the "Local Admin" group ?
finance_teacherAsked:
Who is Participating?
 
oBdAConnect With a Mentor Commented:
Like this, for example:
$Accounts = @{
	'ITDept1' = 'pass1'
	'ITDept2' = 'pass2'
	'ITDept3' = 'pass3'
}
$Accounts.Keys | ForEach-Object {
	& net.exe user "`"$_`"" "`"$($Accounts[$_])`"" /add
	& net.exe localgroup Administrators "`"$($ENV:ComputerName)\$($_)`"" /add
}

Open in new window

1
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.