Create Users and Group

In this section, I will use Powershell script to automaticallly create users and groups in the homelab domain. These users will have weak password credential and will be join in 1 or multiple groups in the domain

I will have one script file named gen_ad.ps1 and one database of users in a JSON file named output.json. You can check these cript in my Github link

Now, on the Manager Client, after cloning my code from GitHub, we will copy gen_ad.ps1 and output.json to the DC1 machine. We will use the following command lines:

// on Management Client powershell
$cred = (Get-Credential)
$dc = New-PSSession 192.168.126.155 -Credential $cred
cp .\gen_ad.ps1 -ToSession $dc C:\Windows\Tasks

After successfully transferring these files, to run them on DC1, we need to set the policy to allow script execution. Use the following command:

// on DC1 terminal
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

Now we will run gen_ad.ps1 at on DC1 terminal

// on DC1 terminal
cd C:\Windows\Tasks
./gen_ad.ps1

After running the script, the users and groups will be created, and the users will be automatically added to their respective groups

You can check if the script was run successfull by login a random credential (from output.js)

For example, I will log in to the Workstation with the username 'Nicoke Burke'. The credentials I will use are 'nburke:danielle'.

Successfully logged in

Last updated