Hi,
Please create a GPO on your domain controller and add a logon script under "User Configuration" > "Policies" > "Windows Settings" > "Scripts ( Logon/Logoff)" > "Logon"
The script could look like this.
$file = (Get-Date -format "yyyyMMdd").ToString() + "_" + $env:COMPUTERNAME + ".txt"
$content = (Get-Date -format "hh:mm:ss").ToString() + " - " + $env:USERNAME
$content | Out-File -Path \\file\share\$file
Best Regards,
Ian Xue
If the Answer is helpful, please click "Accept Answer" and upvote it.