Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6992791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:40:50+00:00 2026-05-27T19:40:50+00:00

I currently have the below code, but obviously I am not that skilled on

  • 0

I currently have the below code, but obviously I am not that skilled on working with collections. Hence I cannot seem to work out how to get each name value, out of the rule property, in each round of the loop.

dim c,ExistingRules
set objFWP = createobject("HNetCfg.FwPolicy2")
set colRules = objFWP.rules

for c = 1 to colRules.count - 1
   ExistingRules = ExistingRules & colRules(c).name
next

In place of colRules(c).name, I have tried things like:

  • colRules.item(c).name
  • colRules.name(c)
  • t = colRules.name / t(c)

… etc

Despite researching how to iterate through a collection without for…each on the web, and learn more about how to work with collections, I am sure that the community here could help me out with a solution/sources to learn more quickly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:40:50+00:00Added an answer on May 27, 2026 at 7:40 pm

    The Rules object is an instance of the COM interface INetFwRules. As it turns out, there is no way to retrieve an item from this collection by index. The definition of the Item method
    shows that it retrieves the rule by name. So in this particular case, you must use For Each ... In.

    Dim rule
    For Each rule In colRules
       WScript.Echo "Rule: " & rule.Name
    Next
    

    If you want to break the loop early and then re-enumerate, you need to reassign the rules collection:

    Dim rule
    Dim colRules
    
    Set colRules = objFWP.Rules
    WScript.Echo "Loop first time..."
    For Each rule In colRules
       WScript.Echo "Rule: " & rule.Name
       Exit For
    Next
    
    ' Reassign colRules
    Set colRules = objFWP.Rules
    WScript.Echo "Loop again..."
    For Each rule In colRules
       WScript.Echo "Rule: " & rule.Name
       Exit For
    Next
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a python psp page code is shown below. Currently it only prints
I currently have a workable Django admin on the left mockup below but want
I currently have the below function within my code:- def openFiles(): file1 = open('file1.txt',
I have a feeling that I'm missing something obvious but can't seem to resolve
I currently have an MS Access application that connects to a PostgreSQL database via
I currently have a fairly robust server-side validation system in place, but I'm looking
We currently have code like this: Dim xDoc = XDocument.Load(myXMLFilePath) The only way we
I have created an app capable of live streaming, but I currently have no
I have a large function (I know, see below) that breaks proguard during its
I have a simple bit of jQuery which displays the row below the current

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.