'*************************************************************************
' Script Name - Windows Computer IP Subnet Discovery
'
' Purpose - Discovers the subnet a computer's network adapter is a member of
'
' Parameters - IPAddress, IPSubnet, PrincipalName
'
' (c) Copyright 2007, Microsoft Corporation, All Rights Reserved
' Proprietary and confidential to Microsoft Corporation
'*************************************************************************
Dim oAPI,oDiscoveryData, oDiscObject, oDiscObject2, oRel
On Error Resume Next
'Variables
Dim oArgs, SourceType, SourceID, strIPAddress, strSubnetMask, strPrincipalName, ManagedEntityId, strSubnet
'calculate the subnet
strSubnet = calculateSubnet(strIPAddress, strSubnetMask)
'Add to the discovery bag
Set oDiscObject= oDiscoveryData.CreateClassInstance("$MPElement[Name='Microsoft.Windows.Computer.IPSubnetMembership']$")
oDiscObject.AddProperty "$MPElement[Name='Microsoft.Windows.Computer.IPSubnetMembership']/IPSubnet$", strSubnet
oDiscObject.AddProperty "$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", strPrincipalName