(view source code of login_log_access.ps as plain text)
# Get today's date in YYYYMMDD format and time in HHmmss format
$Today = Get-Date -Format 'yyyyMMdd'
$Now = Get-Date -Format 'HHmmss'
# Create the directory if it doesn't exist
if ( !( Test-Path "\\Server\Logs\$Today" -PathType Container ) ) {
New-Item -Path "\\Server\Logs" -Name $Today -ItemType "directory"
}
# Log current computer access
"$Env:ComputerName,$Today,$Now\n" | Out-File -FilePath "\\Server\Logs\$Today\$Env:UserName.log" -Encoding ASCII
page last modified: 2024-04-16; loaded in 0.0085 seconds