Create a custom action, and use the following code to get LAPS password for your asset.
objToFind = WScript.Arguments.Item(0)
Set objShell = Wscript.CreateObject("Wscript.Shell")
ExecuteSearch = SearchDistinguishedName(objToFind)
Public Function SearchDistinguishedName(ByVal vSAN)
Const ADS_SCOPE_SUBTREE = 2
Dim oRootDSE, oConnection, oCommand, oRecordSet
Set oRootDSE = GetObject("LDAP://rootDSE")
Set oConnection = CreateObject("ADODB.Connection")
oConnection.Open "Provider=ADsDSOObject;"
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = oConnection
ldstring = "'LDAP://" & oRootDSE.get("defaultNamingContext") & "'"
objCommand.CommandText = "Select Name, distinguishedName from "& ldstring & " where objectClass='computer'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Timeout") = 30
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
If lcase(objRecordSet.Fields("Name").Value) = lcase(vSan) Then
Set objComputer = GetObject _
("LDAP://" & objRecordSet.Fields("distinguishedName").Value )
objProperty = objComputer.Get("ms-Mcs-AdmPwd")
If IsNull(objProperty) Then
objShell.Popup "The ms-Mcs-AdmPwd has not been set."
Else
objShell.Popup "Password sent to clipboard " & objToFind & ": " & objProperty
QuickClip(objProperty)
End If
'Wscript.Quit
End If
objRecordSet.MoveNext
Loop
End Function
Function QuickClip(input)
If IsNull(input) Then
With CreateObject("HTMLFile")
QuickClip = .parentWindow.clipboardData.getData("Text")
If IsNull(clip) Or IsEmpty(clip) Then : clip = "" : End If : End With
Else : With CreateObject("WScript.Shell")
.Run "mshta javascript:eval(""document.parentWindow.clipboardData.setData('text','" _
& Replace(Replace(input,"'","\\u0027"),"""", "\\u0022") & "');window.close()"")",0,True
End With : End If
End Function