AllExperts > VB Script 
Search      
VB Script
Volunteer
Answers to thousands of questions
 Home · More VB Script Questions · Answer Library  · Encyclopedia ·
More VB Script Answers
Question Library

Ask a question about VB Script
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Subbu
Expertise
I can answer VB Script questions which are related to Visual Basic / VBA / QTP Scripts.

Experience
8 Years

Education/Credentials
Master of Computer Applications

Awards and Honors
Established Member from QA Forums and Brainbench certification

 
   

You are here:  Experts > Computing/Technology > Basic > VB Script > Subnets script

VB Script - Subnets script


Expert: Subbu - 5/5/2009

Question
Hi , I contacted you yesterday with a problem with subnets and sorry it was my mistake the script was not working. So I have another script which creates subnets from a text documest, assigns them to the same site and puts the same description. Here is the script :

On Error Resume Next
Const ADS_SCOPE_SUBTREE = 2
Const FOR_APPENDING = 8
Const FOR_READING = 1

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\Admin\script for creating subnets\brso01_colombia_1stwave.txt", FOR_READING)

Set objRootDSE = GetObject("LDAP://RootDSE")
strConfigurationNC = objRootDSE.Get("configurationNamingContext")
strDescription = "Bogota, Colombia "


Do Until objFile.AtEndOfStream
   strNextLine = objFile.Readline
   arrServiceList = Split(strNextLine , ",")
   For i = 0 to Ubound(arrServiceList)
  strSiteObjectRDN = "cn=brso01"
  strSiteObjectDN = strSiteObjectRDN & ",cn=Sites," & strConfigurationNC
  strSubnetsContainer = "LDAP://cn=Subnets,cn=Sites," & strConfigurationNC

  Set objSubnetsContainer = GetObject(strSubnetsContainer)

  Set objSubnet = objSubnetsContainer.Create("subnet", "cn="&arrServiceList(i))
  objSubnet.Put "siteObject", strSiteObjectDN
  objSubnet.Put "description", strDescription
  objSubnet.SetInfo
         
   Next

Loop

This script is working for shure.
Can you please help me with this script because I want to change it just to assign subnets from the listg to another site, not to create them.
Thank you very very much!

Answer
Hi Raducu,

I need some information from you.

What your brso01_colombia_1stwave.txt file contains.  I mean each line has single subnet masks? (Yes/No).

If Yes then you dont need to split your single line value and not needed For Loop.

If you have still problem then please email a single line in your txt file.

Regards
Subbu.  

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.