Solved

need assistance with a vbscript

Posted on 2011-02-28
2
179 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 500 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

Join & Write a Comment

Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now