[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 702
  • Last Modified:

VBScript-- select from multiple arrays

I would like to begin a vbscript with a simple input box that allows me to enter a keyword, which in turn calls a specific array contained within the script. The script would then run against that array.

To clarify, my network consists of multiple subnets. My vbscript includes an array for each individual subnet ( IP scope ). When I execute the script, I want it to ask me which subnet (array) I wish to run the script against or if I want to run the script against all subnets (all of the arrays).
0
jcb431
Asked:
jcb431
  • 3
  • 3
1 Solution
 
Bill PrewCommented:
A couple of the more obvious ways to do this would be a 2 dimensional array, or using a dictionary.

In the first case you just add another dimension to you array and size it for as many subnets as you have.  You would need another array though of the subnet "names" so that you know the dimension value for the new 2 dimension array.

I'd prefer the dictionary approach though, which is basically a key / value pair structure.  You can place one entry in the dictionary for each subnet, with the name of the subnet as the "key", and then the data could be the existing array that you are using.

If you can provide the code you have now I can adjust for the dictionary approach, once you see it I think you will find it very easy to work with.

~bp
0
 
jcb431Author Commented:
0
 
BullmanTechCommented:
See the attachment. Prompt user with Yes/No for 'Use All Subnets'. If No, display an InputBox for entering which subnet. Subnet, or "ALL" is stored in a string which can be used by an IF or SELECT CASE statement.
ChooseSubnet.vbs
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
jcb431Author Commented:
Thanks Bill!
0
 
Bill PrewCommented:
So you are all set with this I gather, you thanked "Bill" but it wasn't my response above, so wanted to make sure I didn't miss something.

~bp
0
 
jcb431Author Commented:
My apologies! I thought I was responding to you. The suggested code worked, but I'm interested to know if using your dictionary approach would not be a better alternative. I've posted another related question for which I have not awarded any points. Would you be interested in taking a look? It involves the same code that I posted here. Perhaps you could incorporate your current idea into the solution.
0
 
Bill PrewCommented:
Okay, let me take a look...

~bp
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now