Hey Checkyourlogs fans,

This case occurred today when I was writing a new Hyper-V Reporting Script. The script needed to hunt for all Hyper-V Services in a Domain.

Everything seemed fine until I noticed that a couple of the servers were not picking up in the report.

Let’s start by looking at the query


function Get-HyperVServersInAD {            
[cmdletbinding()]            
param(            
)            
try {            
 Import-Module ActiveDirectory -ErrorAction Stop            
} catch {            
 Write-Warning "Failed to import Active Directory module. Exiting"            
 return            
}            

try {            
 $Hypervs = Get-ADObject -Filter 'ObjectClass -eq "serviceConnectionPoint" -and Name -eq "Microsoft Hyper-V"' -ErrorAction Stop            
} catch {            
 Write-Error "Failed to query active directory. More details : $_"            
}            
foreach($Hyperv in $Hypervs) {            
 $temp = $Hyperv.DistinguishedName.split(",")            
 $HypervDN = $temp[1..$temp.Count] -join ","            
 $Comp = Get-ADComputer -Id $HypervDN -Prop *            
 $OutputObj = New-Object PSObject -Prop (            
 @{            
  HyperVName = $Comp.Name            
  OSVersion = $($comp.operatingSystem)            
 })            
 $OutputObj            
}            
}

I’m merely looking for the Service Connection point via PowerShell.

You can get a copy of the script at https://github.com/dkawula/Operations/blob/master/Hyper-V/Find-HyperVServerFromDomainandVMs-Report.ps1

It is still a work in progress, and I would love feedback.

I did some research on this issue and came across my friend Didier Van Hoye’s blog: https://blog.workinghardinit.work/2017/08/17/missing-hyper-v-service-connection-point-caused-failed-off-host-backup-proxy-jobs/

It described pretty much the exact issue that I was having.

My Computer Objects in Active Directory were also missing as were his.

However, his solution was quite invasive and would have me evicting a node, dis-joining and re-joining the Computer to the domain.

As my environment was already into production, I wanted to try to figure out a softer approach.


(Screenshot Courtesy – Working Hard in IT.)

What I tried was a straightforward fix.

#1 – Opened ADSIedit.msc

#2 – Browsed to the Computer Object

#3 – Right Clicked on the Computer Object and Created a New Service Connection Point

#4 – I found one key attribute ServiceBindingInformation was missing. So, I looked a working copy and cloned the settings with the Computer Name and Listener Port = Value

After this was complete, I tried the script again, and it worked for me.

I hope this saves you some time.

Dave

Advertisements