Dim oAPI
Set oAPI = CreateObject("MOM.ScriptAPI")
If Err<>0 Then
Call oAPI.LogScriptEvent("FSSPLicensingDiscovery.vbs", 10121, EVENT_TYPE_ERROR, "FSSPLicensingDiscovery.vbs: Error of creating oAPI object")
Quit
Else
Call oAPI.LogScriptEvent("FSSPLicensingDiscovery.vbs", 10122, EVENT_TYPE_SUCCESS, "FSSPLicensingDiscovery.vbs: Success of creating oAPI object")
End if
Dim oArgs
Set oArgs = WScript.Arguments
SourceId = oArgs(0)
If Err<>0 Then
Call oAPI.LogScriptEvent("FSSPLicensingDiscovery.vbs", 10123, EVENT_TYPE_ERROR, "FSSPLicensingDiscovery.vbs: Error of getting SourceID")
Quit
Else
Call oAPI.LogScriptEvent("FSSPLicensingDiscovery.vbs", 10124, EVENT_TYPE_SUCCESS, "FSSPLicensingDiscovery.vbs: Success of getting SourceID")
End if
ManagedEntityId = oArgs(1)
If Err<>0 Then
Call oAPI.LogScriptEvent("FSSPLicensingDiscovery.vbs", 10125, EVENT_TYPE_ERROR, "FSSPLicensingDiscovery.vbs: Error of getting ManagedEntityId")
Quit
Else
Call oAPI.LogScriptEvent("FSSPLicensingDiscovery.vbs", 10126, EVENT_TYPE_SUCCESS, "FSSPLicensingDiscovery.vbs: Success of getting ManagedEntityId")
End if
TargetComputer = oArgs(2)
If Err<>0 Then
Call oAPI.LogScriptEvent("FSSPLicensingDiscovery.vbs", 10127, EVENT_TYPE_ERROR, "FSSPLicensingDiscovery.vbs: Error of getting TargetComputer")
Quit
Else
Call oAPI.LogScriptEvent("FSSPLicensingDiscovery.vbs", 10128, EVENT_TYPE_SUCCESS, "FSSPLicensingDiscovery.vbs: Success of getting TargetComputer")
End if
Dim oDiscoveryData
set oDiscoveryData = oAPI.CreateDiscoveryData(0, SourceId, ManagedEntityId)
If Err<>0 Then
Call oAPI.LogScriptEvent("FSSPLicensingDiscovery.vbs", 10129, EVENT_TYPE_ERROR, "FSSPLicensingDiscovery.vbs: Error of creating oDiscoveryData object")
Quit
Else
Call oAPI.LogScriptEvent("FSSPLicensingDiscovery.vbs", 10130, EVENT_TYPE_SUCCESS, "FSSPLicensingDiscovery.vbs: Success of creating oDiscoveryData object")
End if
Dim oInstance
Set oInstance = oDiscoveryData.CreateClassInstance("$MPElement[Name='Microsoft.ForefrontProtection.FPSP.Licensing']$")
If Err<>0 Then
Call oAPI.LogScriptEvent("FSSPLicensingDiscovery.vbs", 10131, EVENT_TYPE_ERROR, "FSSPLicensingDiscovery.vbs: Error of creating oInstance object")
Quit
Else
Call oAPI.LogScriptEvent("FSSPLicensingDiscovery.vbs", 10132, EVENT_TYPE_SUCCESS, "FSSPLicensingDiscovery.vbs: Success of creating oInstance object")
End if
Call oInstance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$",TargetComputer)
If Err<>0 Then
Call oAPI.LogScriptEvent("FSSPLicensingDiscovery.vbs", 10133, EVENT_TYPE_ERROR, "FSSPServicesDiscovery.vbs: Error of adding PrincipalName property")
Quit
Else
Call oAPI.LogScriptEvent("FSSPLicensingDiscovery.vbs", 10134, EVENT_TYPE_SUCCESS, "FSSPLicensingDiscovery.vbs: Success of adding PrincipalName property")
End if
Call oInstance.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$","Licensing")
If Err<>0 Then
Call oAPI.LogScriptEvent("FSSPLicensingDiscovery.vbs", 10135, EVENT_TYPE_ERROR, "FSSPLicensingDiscovery.vbs: Error of adding DisplayName property")
Quit
Else
Call oAPI.LogScriptEvent("FSSPLicensingDiscovery.vbs", 10136, EVENT_TYPE_SUCCESS, "FSSPLicensingDiscovery.vbs: Success of adding DisplayName property")
End if
Call oDiscoveryData.AddInstance(oInstance)
If Err<>0 Then
Call oAPI.LogScriptEvent("FSSPLicensingDiscovery.vbs", 10137, EVENT_TYPE_ERROR, "FSSPLicensingDiscovery.vbs: Error of adding Instance")
Quit
Else
Call oAPI.LogScriptEvent("FSSPLicensingDiscovery.vbs", 10138, EVENT_TYPE_SUCCESS, "FSSPLicensingDiscovery.vbs: Success of adding Instance")
End if
Call oAPI.Return(oDiscoveryData)
If Err<>0 Then
Call oAPI.LogScriptEvent("FSSPLicensingDiscovery.vbs", 10139, EVENT_TYPE_ERROR, "FSSPLicensingDiscovery.vbs: Error of returning")
Quit
Else
Call oAPI.LogScriptEvent("FSSPLicensingDiscovery.vbs", 10140, EVENT_TYPE_SUCCESS, "FSSPLicensingDiscovery.vbs: Success of returning")
End if</Script></ScriptBody>
<TimeoutSeconds>300</TimeoutSeconds>
</DataSource>
</Discovery>