SA login history in sql Is there any PowerShell script to get the SA log in history?  I need to do an audit on SA login.
First of all you need to make sure you are auditing both successful and failed logins 


  EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'AuditLevel', REG_DWORD, 1


after a restart you can read the information from the SQL Server errorlog

$server = get-item SQLSERVER:\sql\localhost\default
$server.ReadErrorLog() | ? { $_.processInfo -eq 'Logon' -AND $_.Text -match 'sa'}


or grab it from the application log