Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

need assistance with a vbscript

Posted on 2011-02-28
2
Medium Priority
?
210 Views
Last Modified: 2012-05-11
I recently posted a question as shown in the link below:
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_26853905.html

the one thing i forgot to ask was how to modify this script so that i can input Class b subnets from our AD sites & services [subnets]. this script works perfectly if class C subnets are added. can someone please provide how to add in a Class B range?

thanks in advance,

S.
0
Comment
Question by:siber1
2 Comments
 
LVL 65

Accepted Solution

by:
RobSampson earned 2000 total points
ID: 35005127
Hi, just realised you posted this as an extra question....

So you want to check just the first two octets?  My subnetting theory isn't that great.....

So, the array could look like this:
strOU = "OU=Corp Computers"
objSubnets.Add "192.168.", "OU=EMEA,OU=Corp Computers,"
objSubnets.Add "192.168.", "OU=NASA,OU=Corp Computers,"
objSubnets.Add "192.168.", "OU=APEC,OU=Corp Computers,"

and then you can change this:
            strSubNet = Left(strIP, InStrRev(strIP, "."))


to this:
            strSubNet = Left(Left(strIP, InStrRev(strIP, ".") - 1), InStrRev(Left(strIP, InStrRev(strIP, ".") - 1), "."))


to put xxx.xxx. as the comparison.

Regards,

Rob.
0
 

Author Closing Comment

by:siber1
ID: 35006213
works like  a charm Rob. thanks again!
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here's a look at newsworthy articles and community happenings during the last month.
After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question