S.DS.AD – netlogon service

The netlogon service has to be running on your domain controller for authentication to work and for the Active Directory connectivity to happen.  How can we check that this is running on all of our DCs?

$type = [System.DirectoryServices.ActiveDirectory.DirectoryContextType]::Domain
$context = New-Object -TypeName System.DirectoryServices.ActiveDirectory.DirectoryContext -ArgumentList $type, "manticore.org"
$dcs = [System.DirectoryServices.ActiveDirectory.DomainController]::FindAll($context)
foreach ($dc in $dcs){
    $s = Get-Service -ComputerName $dc.Name -Name netlogon
    Write-Host "$dc.Name   the netlogon service is $($s.Status)"
}

Get all of the domain controllers in the domain as before.  We then loop through them using get-service to test the service for the individual machines. 

The output is a bit messy so next time we’ll look at tidying that up.

 

Technorati Tags: ,

About these ads
This entry was posted in Powershell. Bookmark the permalink.

2 Responses to S.DS.AD – netlogon service

  1. Thomas says:

    How about modifying the forach loop to be:foreach ($dc in $dcs){ $s = Get-Service -ComputerName $dc.Name -Name netlogon "The netlogon service is {0} on {1}" -f $s.Status, $dc.Name }???

  2. Richard says:

    Yep that would work and improve the formatting.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s