Hi Just try running this command and let me know please.
# Get the current date and time
$DateTime = Get-Date
$Date = $DateTime.ToString("yyyyMMdd")
$Time = $DateTime.ToString("HH:mm:ss")
# Get the computer name and username
$ComputerName = $env:COMPUTERNAME
$Username = $env:USERNAME
# Set the log file path
$LogPath = "\\FS-2024\Logon\"
$LogFileName = "$Date" + "_" + "$ComputerName" + ".txt"
$LogFilePath = Join-Path -Path $LogPath -ChildPath $LogFileName
# Create the log file if it doesn't exist
if (-not (Test-Path -Path $LogFilePath)) {
New-Item -Path $LogFilePath -ItemType File | Out-Null
}
# Write log entry to file
"$Time - $Username" | Out-File -FilePath $LogFilePath -Append