Banner user logon

Raul Guchinife 120 Reputation points
2024-06-06T11:18:24.91+00:00

Hello

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?

Thanks

Windows Server 2019
Windows Server 2019
A Microsoft server operating system that supports enterprise-level management updated to data storage.
3,799 questions
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
13,240 questions
Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
6,654 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,853 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Wesley Li 10,240 Reputation points
    2024-06-06T14:42:24.6433333+00:00

    Hello

    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 AzureAdmin@yourdomain.com

     

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

    Get-AzureADAuditSignInLogs -Filter "UserPrincipalName eq 'username@yourdomain.com'" -Top 1 | `

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

     

    Replace 'username@yourdomain.com' 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 'AzureAdmin@yourdomain.com' and 'username@yourdomain.com' 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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.