Welcome to ServerForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

IpSecurity settings on webfiles with ADSI

 
   Windows Server (Home) -> Windows Server Scripting RSS
Next:  Copy a folder from one server to another using WM..  
Author Message
Allan

External


Since: Aug 29, 2004
Posts: 3



(Msg. 1) Posted: Thu Nov 24, 2005 3:55 am
Post subject: IpSecurity settings on webfiles with ADSI
Archived from groups: microsoft>public>windows>server>scripting (more info?)

Hi,
The msdn sample for setting ipgrant properties on a metabase object will
only work if:
1- there are no restriction already in place
2- you do not attempt to add more than 1 entry

the example is:
--------------------
Dim SecObj
Dim MyIPSec
Dim IPList
' Get the IIS object that holds the info for the default site.
' This could be any site root/vdir, or IIS://LocalHost/W3SVC for global
' properties.
Set SecObj = GetObject("IIS://LocalHost/W3SVC/1/Root")
' Get the IIsIPSecurity object.
Set MyIPSec = SecObj.IPSecurity
' Make sure GrantByDefault=FALSE or your changes will not count.
If (TRUE = MyIPSec.GrantByDefault) Then
Response.Write
"<BR>GrantByDefault was not FALSE. Setting to FALSE.<BR>"
MyIPSec.GrantByDefault = FALSE
End If
' Get the Grant list as an array, and add your newly allowed IP address
IPList = MyIPSec.IPGrant
Redim IPList (Ubound(IPList)+1)
IPList (Ubound(IPList)) = "123.0.0.1,255.255.255.0"
' Set the new lists back in the metabase in two stages, and then set
' the metabase.
MyIPSec.IPGrant = IPList
SecObj.IPSecurity = MyIPSec
SecObj.Setinfo
Response.Write "The IPRestriction has been set<BR>"
-----------------------

This is despite the fact that it says "and add your newly allowed IP address"
I am trying to add a couple of class be networks to the allow list
It works only if:
i delete the metabase key and then recreate it (using adsutil) - this is a
IISWEbFile object and hence does not exist if there is nothing already in
place
then add a single entry.
but if i then attempt to add another entry it fails with (null): 0x8000500C

am i doing something wrong with the array

Thanks,
Allan

 >> Stay informed about: IpSecurity settings on webfiles with ADSI 
Back to top
Login to vote
t.dub

External


Since: Dec 15, 2006
Posts: 1



(Msg. 2) Posted: Fri Dec 15, 2006 9:24 pm
Post subject: Re: IpSecurity settings on webfiles with ADSI [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Allan -

Were you ever able to find a way to make this work? I am working on a
critical project to allow me to set these restrictions quickly on a
large number of servers, and I am getting the same error (0x8000500c)
when adding a second IP subnet to the object (MyIPSec.IPGrant =
IPList). If you made it work, I would greatly appreciate seeing your
script!

Thanks!

Tom


--
t.dub
------------------------------------------------------------------------
t.dub's Profile: http://forums.techarena.in/member.php?userid=20183
View this thread: http://forums.techarena.in/showthread.php?t=411246

http://forums.techarena.in

 >> Stay informed about: IpSecurity settings on webfiles with ADSI 
Back to top
Login to vote
Display posts from previous:   
   Windows Server (Home) -> Windows Server Scripting All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]