' Create an SMS Software Metering Rule



On Error Resume Next

Dim objSWbemLocator
Dim objSWbemServices
Dim objNewSWbemObject
Dim objSWbemObject
Dim ProviderLoc
Dim Location
Dim strClass
Dim strSiteCode

'Creates a Software Metering Rule

strClass="SMS_MeteredProductRule"


set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")

set objSWbemServices= objSWbemLocator.ConnectServer _
    (".", "root\sms")

Set ProviderLoc = objSWbemServices.InstancesOf("SMS_ProviderLocation")

For Each Location In ProviderLoc
    If Location.ProviderForLocalSite = True Then
        Set objSWbemServices = objSWbemLocator.ConnectServer _
             (Location.Machine, "root\sms\site_" + Location.SiteCode)
             strSiteCode=Location.SiteCode
    End If
Next

Set objSWbemObject = objSWbemServices.Get(strClass)
Set objNewSWbemObject = objSWbemObject.SpawnInstance_()

objNewSWbemObject.Properties_.Item("ProductName")="Character Mapper"
objNewSWbemObject.Properties_.Item("FileName")="charmap.exe"
objNewSWbemObject.Properties_.Item("OriginalFileName")="charmap.exe"
objNewSWbemObject.Properties_.Item("FileVersion")="*"
objNewSWbemObject.Properties_.Item("LanguageID")="1033"
objNewSWbemObject.Properties_.Item("SiteCode")= strSiteCode
objNewSWbemObject.Properties_.Item("ApplyToChildSites")="true"

objNewSWbemObject.Put_
search for scripts

VbsEdit contains all these sample scripts!


Download Now!



Download   Home   Scripts

Copyright © 2001-2024 adersοft