Banner user logon

Raul Guchinife 120 Reputation points


I need that when a user logs in to the computer, a banner with the date of the last login will appear.

I have to take this configuration to Azure AD.

How can I do it?


Windows Server 2019
Windows Server 2019
A Microsoft server operating system that supports enterprise-level management updated to data storage.
3,540 questions
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,432 questions
Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
6,075 questions
Windows Server Security
Windows Server Security
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Security: The precautions taken to guard against crime, attack, sabotage, espionage, or another threat.
1,763 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Wesley Li 5,800 Reputation points


    To display the last login date when a user logs in, you can use the Azure Active Directory (Azure AD) sign-in logs and PowerShell. Here’s a step-by-step guide:


    Install the Azure AD PowerShell Module: You’ll need to download the Azure AD (or Azure AD Preview) module.

    Import the Azure AD Module

    Import-Module AzureADPreview


    Connect to Azure AD: Use your Azure Admin account to connect to Azure AD.

    Connect to Azure AD

    Connect-AzureAD -AccountId


    Get the Last Login Date: Use the Get-AzureADAuditSignInLogs cmdlet to get the last login date.

    Get-AzureADAuditSignInLogs -Filter "UserPrincipalName eq ''" -Top 1 | `

    select CreatedDateTime, UserPrincipalName, IsInteractive, AppDisplayName, IpAddress, TokenIssuerType, @{Name =  'DeviceOS'; Expression = {$_.DeviceDetail.OperatingSystem}}


    Replace '' with the user’s User Principal Name (UPN). This script will return the last login date and other details for the specified user.


    Display the Last Login Date: To display the last login date as a banner when a user logs in, you’ll need to incorporate this script into your login script or Group Policy. Please note that this would require additional scripting and testing to ensure it works as expected in your environment.


    Remember to replace '' and '' with your actual Azure Admin account and the user’s UPN, respectively.


    This solution requires administrative access to Azure AD and knowledge of PowerShell. Always test scripts in a controlled environment before deploying them in a production environment. If you’re not comfortable with PowerShell, you may want to consider seeking assistance from someone who is.


    Also, please be aware that pulling sign-in logs from Azure AD could have implications for privacy and compliance depending on your organization’s policies and the jurisdiction in which you operate. Always ensure you have appropriate permissions and legal clearance before accessing and displaying user login information.