Monday, 9 June 2025

DBA - Get the list of AD users

Get the list  of AD users. 

SELECT 

   name AS [AD Account Name],
    type_desc AS [Account Type],
    create_date AS [Creation Date],     modify_date AS [Last Modified Date]
FROM 
    sys.server_principals
WHERE 
    type_desc IN ('WINDOWS_LOGIN', 'WINDOWS_GROUP')
ORDER BY 
    name;

 

No comments:

Post a Comment

SQL_DBA- Ip Address Ping

Start-Transcript - path C:/Script/PingLog.txt -Append   Ping.exe -t spiceworks.com | ForEach { "{0} - {1}" -f (Get-Date), $_ } ...