In VBScript, the "_" character is a special character denoting a line
continuation. It is used as the last character on a line. Rewrite the lines
to look like this and give it a try.

 

Set objSiteSettings = GetObject("LDAP://cn=" & _

strSubnetName & _ 
            "cn=subnets,cn=sites," & _ 
            objRootDSE.Get("ConfigurationNamingContext")) 



-Malcolm

From: Christopher Bodnar [mailto:christopher_bod...@glic.com] 
Sent: Thursday, April 15, 2010 14:07
To: NT System Admin Issues
Subject: modifying subnet assignment by script

 

I got this from the AD Cookbook and it's giving me an error. Can someone
test this and let me know if it works for them in a test environment? The
site and subnet must exist for this to work. I'm getting the following
error: 

(5, 49) Microsoft VBScript compilation error: Invalid character 

Which corresponds to the "_" in front of "_strSubnetName". I've tried it
without the "_" and get a null error. 


'*************************Begin
Script*************************************************** 
strNewSiteName = "TESTSite1" ' e.g. "Raleigh" 
strSubnetName = "10.170.2.0/24" ' e.g. "192.168.1.0/24" 

Set objRootDSE = GetObject("LDAP://RootDSE") 
Set objSiteSettings = GetObject("LDAP://cn=" & _strSubnetName & _ 
        "cn=subnets,cn=sites," & _ 
        objRootDSE.Get("ConfigurationNamingContext")) 

objSiteSettings.Put "siteObject", _ 
        "cn=" & strNewSiteName & ",cn=sites," & _ 
        objRootDSE.Get("ConfigurationNamingContext") 
objSiteSettings.SetInfo 
WScript.Echo("Site Membership updated successfully!") 
'*************************End
Script*************************************************** 


Not sure what the issue is here. 

Thanks, 


Chris Bodnar, MCSE
Systems Engineer
Distributed Systems Service Delivery - Intel Services
Guardian Life Insurance Company of America
Email: christopher_bod...@glic.com
Phone: 610-807-6459
Fax: 610-807-6003 ----------------------------------------- This message,
and any attachments to it, may contain information that is privileged,
confidential, and exempt from disclosure under applicable law. If the reader
of this message is not the intended recipient, you are notified that any
use, dissemination, distribution, copying, or communication of this message
is strictly prohibited. If you have received this message in error, please
notify the sender immediately by return e-mail and delete the message and
any attachments. Thank you. 

 

 

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

Reply via email to