SYS255 Entry for: Custom GPO - Oliver-Mustoe/Oliver-Mustoe-Tech-Journal GitHub Wiki

In this lab we created a custom GPO.

Prerequisites:

You should have completed the week 4 assessment, and SYS255 Entry for: ADDS Group Policy.

Setup notes

As the setup is quite uniform, it is contained all on 1 page:

Custom GPO Setup Notes

Code

LastLogon.bat

File on github: https://github.com/Oliver-Mustoe/DNE-255-FA21/blob/main/week05/homework/LastLogon.bat

cmd /c start %windir%\System32\WindowsPowershell\v1.0\powershell.exe -windowstyle hidden -ExecutionPolicy Bypass -file "%~dp0LastLogon.ps1"

LastLogon.ps1

File on github: https://github.com/Oliver-Mustoe/DNE-255-FA21/blob/main/week05/homework/LastLogon.ps1

#Get the userprofile environment variable $user = $ENV:USERPROFILE

#Get Current date and time
$theTime = Get-Date

#Write a message with the time to a file as a string.
echo "You logged in at: $theTime" | Out-File -Encoding ASCII -Append -FilePath "$user\Desktop\Login-time.txt"