diff --git a/configureVM.ps1 b/configureVM.ps1 new file mode 100644 index 0000000..53f13fe --- /dev/null +++ b/configureVM.ps1 @@ -0,0 +1,29 @@ +#configureVM + +# THIS SCRIPT MUST BE RUN AS ADMINISTRATOR ON SRV1, CLI1 and MGR +<# CHECKLIST: + - Windows Update is up to date + - Time zone is correct + - Set-TimeZone -id 'W. Europe Standard Time' + - Computer name is correct + - IP address is correct (non relevant for this lab) + - Keyboard layout is correct (Norwegian) +#> + +# VM's for the lab needs DC1 IP-address as DNS server (must be done on VM's: SRV1, CLI1 and MGR) +# Why? Because the DNS server is the only one that knows about the domain +$ipaddressdc1 = "192.168.111.193" # IP-address of DC1 +Get-NetAdapter | Set-DnsClientServerAddress -ServerAddresses $ipaddressdc1 + +# Check if configuration is correct +# Find DNS Servers . . . . . . . . . . . : IP.ADR.TIL.DC (192.168.111.193) +ipconfig /all + +# Add the computer to the domain +$domainName = "RohanIT.sec" # replace with your domain name (e.g. InfraIT.sec) + +$cred = Get-Credential -UserName "@$domainName" -Message 'Provide credentials for a domain admin' +Add-Computer -Credential $cred -DomainName $domainName -PassThru -Verbose +Restart-Computer + +# When restarted, the computer will be joinedto the domain, and you can log in with a domain admin or user account \ No newline at end of file diff --git a/usersetup.ps1 b/usersetup.ps1 index e1e2f46..d1c4910 100644 --- a/usersetup.ps1 +++ b/usersetup.ps1 @@ -3,10 +3,10 @@ # Define new user parameters $username = "Wormtongue" # Change this to the desired username $Password = Read-Host -Prompt 'Enter Password' -AsSecureString -$userPrincipalName = $username + "@" # Change to your domain -$displayName = "" # Change this to the desired display name -$description = "" # Change this to a suitable description -$path = "CN=Users,DC=,DC=" # Change the path to the appropriate path in your AD structure +$userPrincipalName = $username + "Wormtongue@RohanIT.sec" # Change to your domain +$displayName = "Wormtongue" # Change this to the desired display name +$description = "SysAdm" # Change this to a suitable description +$path = "CN=Users,DC=,DC=" # Change the path to the appropriate path in your AD structure # My path in the video CN=Users,DC=InfraIT,DC=sec (CN stands for Common Name, and DC stands for Domain Component) # Users is a container in the root of the domain and not a OU (Organizational Unit)