RE: modifying subnet assignment by script

2010-04-16 Thread Michael B. Smith
I tested and corrected every single one of those scripts before publication, 
but the editor only included about ½ the corrections. Sorry about that. That 
one should read:

strNewSiteName = SiteName ' e.g. Raleigh
strSubnetName = SubnetName ' 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!)

Regards,

Michael B. Smith
Consultant and Exchange MVP
http://TheEssentialExchange.com

From: Christopher Bodnar [mailto:christopher_bod...@glic.com]
Sent: Thursday, April 15, 2010 3:07 PM
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.commailto: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/  ~

RE: modifying subnet assignment by script

2010-04-16 Thread Malcolm Reitz
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/  ~

re: modifying subnet assignment by script

2010-04-15 Thread Christopher Bodnar
Fixed it in case anyone is interested. There are a few problems with the 
original. Biggest problem is that the / in the subnet name needed to be 
escaped. Also the _  character was a typo, and there was a , missing in 
front of cn=Subnets . 


strNewSiteName = TESTSite1 
strSubnetName = 10.170.2.0\/24

Set objRootDSE = GetObject(LDAP://RootDSE)
strConfigurationNC = objRootDSE.Get(configurationNamingContext)

Set objSiteSettings = GetObject(LDAP://cn=  strSubnetName  
,cn=Subnets,cn=Sites,  strConfigurationNC)

objSiteSettings.Put siteObject, cn=  strNewSiteName  ,cn=Sites,  
strConfigurationNC
objSiteSettings.SetInfo
WScript.Echo(Site Membership updated successfully!)
~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/  ~