none
Export Address Rate Limits RRS feed

  • Question

  • I'm looking to export all of the Rate Limits for each Address.  I don't believe there is a way to do this from the console.  I've looked into WMI and PowerShell solutions but have not seen one that has successfully worked.  The code I've used below looks to be retrieving the rates, but it always lists 100%.  Any other suggestions?

    ' Force explicit variable declaration 
     Option Explicit 
    
     ' Declare variables 
     Dim objSWbemLocator, objSWbemServices, objProviderLocation, objSCIAddress 
     Dim colProviderLocations, colSCIAddresses 
     Dim strSMSProvider, strSiteCode 
     Dim intHour 
    
     ' Initialise variables 
    strSMSProvider = "SERVER_NAME" 
    strSiteCode = "XXX" 
    
     ' Connect to provider namespace 
     Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator") 
     Set objSWbemServices = objSWbemLocator.ConnectServer(strSMSProvider, "root\sms") 
     Set colProviderLocations = objSWbemServices.InstancesOf("SMS_ProviderLocation") 
     For Each objProviderLocation In colProviderLocations 
         If objProviderLocation.ProviderForLocalSite = True Then 
             Set objSWbemServices = objSWbemLocator.ConnectServer(objProviderLocation.Machine, "root\sms\site_" + objProviderLocation.SiteCode) 
             WScript.Echo "Connected to " & objProviderLocation.Machine & " (" & objProviderLocation.SiteCode & ")" & vbCrLf 
         End If 
     Next 
    
     ' Get addresses 
     Set colSCIAddresses = objSWbemServices.ExecQuery("Select * From SMS_SCI_Address Where SiteCode = '" & strSiteCode & "'") 
    
     ' Enumerate addresses 
     For Each objSCIAddress In colSCIAddresses 
         WScript.Echo "--------------------------------------------------" 
         WScript.Echo objSCIAddress.ItemName 
         WScript.Echo "--------------------------------------------------" 
         WScript.Echo "AddressType: " & objSCIAddress.AddressType 
         WScript.Echo "DesSiteCode: " & objSCIAddress.DesSiteCode 
         WScript.Echo "FileType: " & objSCIAddress.FileType 
         WScript.Echo "ItemName: " & objSCIAddress.ItemName 
         WScript.Echo "ItemType: " & objSCIAddress.ItemType 
         WScript.Echo "Order: " & objSCIAddress.Order 
         WScript.Echo "SiteCode: " & objSCIAddress.SiteCode 
         WScript.Echo "UnlimitedRateForAll: " & objSCIAddress.UnlimitedRateForAll 
         WScript.Echo "RateLimitingSchedule[]:" 
         
         For intHour = 0 to 23 
             If intHour < 10 Then 
                 WScript.Echo vbTab & "0" & intHour & ":00 = " & objSCIAddress.RateLimitingSchedule(intHour) & "%" 
             Else 
                 WScript.Echo vbTab       & intHour & ":00 = " & objSCIAddress.RateLimitingSchedule(intHour) & "%" 
             End If 
         Next 
         
         WScript.Echo vbCr 
     Next 
    
     ' Disassociate objects 
     Set objSWbemLocator = Nothing 
     Set objSWbemServices = Nothing 
     Set objProviderLocation = Nothing 
     Set objSCIAddress = Nothing 
     Set colProviderLocations = Nothing 
     Set colSCIAddresses = Nothing 
    
     ' Quit 
     WScript.Quit


    • Edited by Jason411 Tuesday, September 25, 2012 5:21 PM
    Tuesday, September 25, 2012 5:21 PM