Added support for local admins being created across different remote

hosts
main
John Hammond 2022-05-28 01:16:37 -07:00
parent a7ceadc6cf
commit 4b26fe07c7
2 changed files with 17 additions and 4 deletions

View File

@ -10,14 +10,24 @@
"users": [
{
"local_admin": ["ws01"],
"name": "Alice Lice",
"password":"P@ssw0rd789",
"password":"bubbles",
"groups": [
"Employees"
]
},
{
"local_admin": ["ws02"],
"name": "Bob Ob",
"password":"ashley",
"groups": [
"Employees"
]
},
{
"local_admin": ["ws01", "ws02", "dc1"],
"name": "Charlie Harlie",
"password":"P@ssw0rdABC",
"groups": [
"Employees"

View File

@ -47,10 +47,13 @@ function CreateADUser(){
}
# Add to local admin as needed
if ( $userObject.local_admin -eq $True){
net localgroup administrators $Global:Domain\$username /add
# if ( $userObject.local_admin -eq $True){
# net localgroup administrators $Global:Domain\$username /add
# }
$add_command="net localgroup administrators $Global:Domain\$username /add"
foreach ($hostname in $userObject.local_admin){
echo "Invoke-Command -Computer $hostname -ScriptBlock { $add_command }" | Invoke-Expression
}
}
function RemoveADUser(){