1

Is it possible to find a SharePoint server machine in a domain?

3

I would try this way.

  • 1
    this is very clever! – Mike Mar 29 '16 at 17:57
  • Thank you! Wonderful Idea! Still I face some issue with this.. i can able to track other services like "MpsSvc", "WinRM" but not the SharePoint services like "SPAdminV4" ,"SPTimerV4" – Gokul Mar 29 '16 at 18:27
0

To detect all your servers in a domain, here is what you could do:

Use the following PowerShell code to retrieve the list of all your servers from AD. You can further filter by operating system or OU if necessary.

Import-Module ActiveDirectory

Get-ADComputer -Filter 'ObjectClass -eq "Computer"' | Select -Expand DNSHostName

Once you have the list of servers you can run the following PowerShell code to check if SharePoint was installed on that machine (replace the COMPUTER_NAME_HERE with the actual FQDN of the computer you are targeting):

 Invoke-Command -ComputerName COMPUTER_NAME_HERE -ScriptBlock { 

    Function Test-RegistryValue($regkey, $name) {
    $exists = Get-ItemProperty -Path "$regkey" -Name "$name" -ErrorAction SilentlyContinue
    If (($exists -ne $null) -and ($exists.Length -ne 0)) {
        Return $true
        }

        Return $false
    }

    return ((Test-RegistryValue "HKLM:\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0" "Version") -or
            (Test-RegistryValue "HKLM:\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0" "Version") -or
            (Test-RegistryValue "HKLM:\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\16.0" "Version"))

}

You can combine the above approach with the services approach already mentioned in another answer if you would like to check if SharePoint Timer service is running on that box.

As an alternative I can suggest you take a look at our free tool called SPDocKit Pulse that can perform auto-discover of SharePoint servers for you but it also provides additional info about your servers, SQL servers, roles and overall health.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.