Question 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)
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.
---------- FOLLOW-UP ----------
QUESTION: The file contains a subnet on each line, with no header, like this:
10.123.124.0/24
10.145.213.0/24
and so on...
This script I use for creating subnets and it works very fine but I want to modify the script to only assign the subnets from the file ( the subnets are already created in Active Directory) to another site.
The site is contained here
strSiteObjectRDN = "cn=brso01"
I think yhis is the part that needs to be modified:
Set objSubnetsContainer = GetObject(strSubnetsContainer)
Set objSubnet = objSubnetsContainer.Create("subnet", "cn="&arrServiceList(i))
objSubnet.Put "siteObject", strSiteObjectDN
objSubnet.Put "description", strDescription
As I can see, after creating the object the script edits the attributes ( siteObject and description), but I want just to edit the site attribute of the subnets in the .txt file.
Thank you very much!
ANSWER: You dont need to split the line with ",". Actually there is no "," in that line.
You just need
Set objSubnet = objSubnetsContainer.Create("subnet", "cn="&strNextLine) 'here strNextLine variable has 10.123.124.0/24
This variable value will keep on change till end of file.
I just modified your code, try this and let me know.
QUESTION: Hello,
The problem is not with the script. The script works fine for creating objects (subnets in Active Directory).
I want to modify the script so it takes every object in the list and modify its attribute (site in this case). In the list for this script that I want are objects that are already created. I think the problem is here:
Set objSubnet = objSubnetsContainer.Create("subnet", "cn="&strNextLine)
because I do not want to create object just to take object and modify this:
objSubnet.Put "siteObject", strSiteObjectDN
Can this script be modified in this way?
Thank you for your answers!
Answer strNextLine will be having your text file single line value (whatever it is, in this case you have 10.145.213.0/24).
where ever you need 10.145.213.0/24 then you can use strNextLine variable.
If your text file have 100 values like 10.145.213.0/24 then your will loop will iterate 100 times and each time strNewLine value will be changed.
Regarding this line:
objSubnet.Put "siteObject", strSiteObjectDN
I am not sure how subnet COM will work and what kind of data it will take. I am sorry if I did't answer your question.