Skip to content

Creating SMS/SCCM addresses with VB scripting


Wondering how creating SMS/SCCM addresses with VB script ? There are many resources available like SCCM SDK and other VB and PowerShell scripting against SMS/SCCM but not always that clear.

Migrating 150 sites…some automatization would be nice :-) By using VB scripting we will be enabled to fully migrate 150 SMS 2003 sites to SCCM 2007. Including site boundaries, site system roles , properties and addresses. In this post I’d like to share some part of the migration proces,  how to configure addresses with VB scripting.

The SMS_SCI_Address Windows Management Instrumentation (WMI) class is an SMS Provider server class, in Configuration Manager, that represents a sender address, which is a link between the site for which the site control file exists and another site.

The following syntax is simplified from Managed Object Format (MOF) code and includes all inherited properties.

 
Class SMS_SCI_Address : SMS_SiteControlItem
{
     String AddressType;
     String DesSiteCode;
     UInt32 FileType;
     String ItemName;
     String ItemType;
     UInt32 Order;
     SMS_EmbeddedPropertyList PropLists[];
     SMS_EmbeddedProperty Props[];
     UInt32 RateLimitingSchedule[24];
     String SiteCode;
     Boolean UnlimitedRateForAll;
     SMS_SiteControlDaySchedule UsageSchedule[7];
};

Schedule and Rate Limits tab of the Addresses the following will be configured by the SMS_SiteControlDaySchedule WMI class.

The following snapshot of the code sample shows you how to configure the Schedule an Rate Limits of addresses:

 
Set WbemInst = WbemServices.Get("SMS_SCI_Address").SpawnInstance_()
if (err <> 0) then wscript.quit (err.number)

wbeminst.AddressType = "MS_LAN"
wbeminst.DesSiteCode = SiteCode
wbeminst.ItemName = SiteCode & "|MS_LAN"
wbeminst.ItemType = "Address"
wbeminst.Order = 1
wbeminst.SiteCode = ParentSiteCode 
wbeminst.UnlimitedRateForAll = True

Set newp1 = WbemServices.Get("SMS_EmbeddedProperty").SpawnInstance_()
if (err <> 0) then wscript.quit (err.number)

newp1.PropertyName = "Connection Point"
newp1.Value = 0
newp1.Value1 = SiteServer
newp1.Value2 = "SMS_SITE"

Set newp3 = WbemServices.Get("SMS_EmbeddedProperty").SpawnInstance_()
if (err <> 0) then wscript.quit (err.number)

newp3.PropertyName = "LAN Login"
newp3.Value = 0
newp3.Value1 = "" 
newp3.Value2 = "" 

Set newp7 = WbemServices.Get("SMS_EmbeddedPropertyList").SpawnInstance_()
if (err <> 0) then wscript.quit (err.number)

newp7.PropertyListName = "Pulse Mode"
newp7.Values = pulsemode

WbemInst.Props = Array(newp1,newp3)
WbemInst.Proplists = Array(newp7)
WbemInst.Put_ , WbemContext
WbemInst.RateLimitingSchedule = ParentRates

WbemServices.Get("SMS_SiteControlDaySchedule").SpawnInstance_()
If (err <> 0) then wscript.quit (err.number)

Set newp6 = WbemServices.Get("SMS_SiteControlDaySchedule").SpawnInstance_()
If (err <> 0) then wscript.quit (err.number)
newp6.Backup = BackupSchedule
newp6.HourUsage = Schedule1
newp6.Update = 1

newp5.Backup = BackupSchedule
newp5.HourUsage = Schedule
newp5.Update = 1
WbemInst.UsageSchedule = Array(newp6,newp5,newp5,newp5,newp5,newp5,newp6)
WbemInst.Put_ , WbemContext

If (err <> 0) then wscript.quit (err.number)

WbemServices.ExecMethod "SMS_SiteControlFile.Filetype=1,Sitecode=""" & ParentSiteCode & """", "Commit", , , WbemContext
if (err <> 0) then wscript.quit (err.number)

WbemServices.Get("SMS_SiteControlFile").ReleaseSessionHandle WbemContext.Item("SessionHandle").Value
if (err <> 0) then wscript.quit (err.number)

Booth arrays PulseMode and Schedule can be configured as follow:

 
Dim Schedule(24), pulsemode(2)
pulsemode(0) = 0
pulsemode(1) = 3
pulsemode(2) = 5

Schedule(0)= 1
Schedule(1)= 1
Schedule(2)= 1
Schedule(3)= 1
Schedule(4)= 1
Schedule(5)= 1
Schedule(6)= 3
Schedule(7)= 3
Schedule(8)= 3
Schedule(9)= 3
Schedule(10)= 3
Schedule(11)= 3
Schedule(12)= 3
Schedule(13)= 3
Schedule(14)= 3
Schedule(15)= 3
Schedule(16)= 3
Schedule(17)= 3
Schedule(18)= 3
Schedule(19)= 3
Schedule(20)= 1
Schedule(21)= 1
Schedule(22)= 1
Schedule(23)= 1

If you doesn’t configure the pulse mode, the rate limit will be set but the “Unlimited when sending to this address’  checkbox is set instead of ‘Limited to specified maximum transfer rates by hour”.

Categories

.

Tags

, ,

3 thoughts on “Creating SMS/SCCM addresses with VB scripting Leave a comment

  1. Hello,
    nice job. I found your side from a thread in the http://social.technet.microsoft.com forum.

    My question is. How to read the SMS_SiteControlDaySchedule only?
    I found only example to write the SMS_SiteControlDaySchedule value but only read?

    Have you for this part a example ?

    tnx

    Alex

  2. I’d like to see how to read the SMS_SiteControlDaySchedule also. That way I can export the current values for import later. Also is there a delete method for the SMS_SCI_Address class so I can delete the old address from the old site after exporting the values?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: