Quantcast
Channel: THWACK: Message List
Viewing all articles
Browse latest Browse all 20490

Re: Windows SA monitoring

$
0
0

Hi Ashley,

 

You can use the Windows PowerShell Monitor component and call the Active Directory Search-ADAccount cmlet. I pasted the script below but this is for checking SA accounts that are locked out. I think you'll want to actually use the -AccountExpired parameter and the SA account's Distinguished Name (DN). You will also need to have to have the RSAT Powershell module installed. Instructions here: http://blogs.technet.com/b/heyscriptingguy/archive/2011/08/30/install-active-directory-management-service-for-easy-powershell-access.aspx. As Leon Adato mentioned, no credentials and execution mode set to Local Host.

 

Code here:

 

Import-Module ActiveDirectory
#$is_locked = Search-ADAccount -LockedOut -Server <domain> -SearchBase "<DN>"

if ($is_locked)
    {
Write-Host 'Statistic: 1'
Write-Host 'message: Locked Account Found'

    }else{
Write-Host 'Statistic: 0'
Write-Host 'message: Locked Account Not Found'

 

Hopes this helps.


Viewing all articles
Browse latest Browse all 20490

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>