Make a simulated corporate network with a VM for a domain controller and a VM for a client interface
Create a script to have users added to their respective OUs within Active Directory
Create a script to offboard / disable users
Environment Setup
I first had to create the virtual machines to begin -- this was done with VirtualBox w/ a Windows Server 2019 ISO (domain controller) and a Windows 10 x64 ISO (client)
From the Domain Controller, I configured the domain and DHCP per the lab diagram above.
Following setup the Client is able to access the internet as demonstrated from the ping tests (outside test & domain test)
Employee Onboarding Script
The goal of these scripts is to make a rudimentary console app to handle the requested changes
Because of this, I need to store and consistently reference the correct variables to ensure cohesion
Initial delcarations:
# Define when accounts expire$TSpan=New-TimeSpan-Days 365# Declare OUs$OrgList=@('_Admins','Help Desk','Development','Executive Office')
$Org=Read-Host"Please enter Department (_Admins, Help Desk, Development, Executive Office)"# Validate Department Inputif ($Org-in$OrgList) {
Clear-Host
}
# Entry does not exist else {
Write-Host"Department not found"Start-Sleep-Seconds 10
}
# Input User Info$FirstName=Read-Host"Please enter first name"$LastName=Read-Host"Please enter last name"$UserName= ($FirstName+"."+$LastName)
$DisplayName= ($FirstName+""+$LastName)
$UPN= ($UserName+'@mydomain.com')
$CurrentDate=Get-Date-Format "yyyy/MM/dd"$AccExpiration= (Get-Date) +$TSpan
Next I am going to begin writing the logic needed to utilize these variable declarations with if/elseif