Well Known Service Principal Names
Double %% marks in event logs Double %% marks in event logs 2 Audit Detailed File Share event logs
## Multiple filters | |
$searchOU = "OU=Workstations,DC=XX,DC=XXXX, DC=org" | |
$date = (get-date).AddDays(-60) | |
$Workstations = Get-ADComputer -Filter {LastLogonTimeStamp -lt $date -and enabled -eq $true} -SearchBase $SearchOU -Properties Enabled, LastLogonTimeStamp, LastLogonDate | |
$Workstations | select name, lastlogondate | |
## Find MS SQL servers by SPN | |
Get-ADComputer -Filter { serviceprincipalname -like 'MSSQLSvc/*' } | |
Get-ADComputer -LDAPFilter "(servicePrincipalName=MSSQLSvc/*)" | |
Get-ADObject -Filter { (serviceprincipalname -like 'MSSQLSvc/*') -and (objectcategory -eq 'computer') } | |
Get-ADObject -LDAPFilter "(&(objectcategory=computer)(servicePrincipalName=MSSQLSvc/*))" | |
## Find MS SQL CLUSTER virtual servers | |
Get-ADObject -Filter { (serviceprincipalname -like 'MSClusterVirtualServer/*') -and (objectcategory -eq 'computer') } | |
Get-ADObject -LDAPFilter "(&(objectcategory=computer)(servicePrincipalName=MSClusterVirtualServer/*))" |