
script for changing server publishing rules on ISA Server
Hi ...
We're using a script for our ISA Server which tells the ISA to update
IPAdresses in Server Publishing Rules, when our external IP has changed
(dial up connection). It works fine so far ... what we want to do now is the
following :
in this part of the script, it changes the IP in Server Publishing Rules to
the one of the adapter given here :
+++ cut from the script +++
Set objExtAdapter = objServer.Adapters.Item(3)
+++ cut from the script +++
So item 3 is our PPP Connect to the Internet. Is it possible to find out the
IP not by this index number but by the name of our dial up connection ?
The Problem is that when there is another PPP connection the script does not
work anymore ... would be nice if someone git an idea how to do so.
+++++++ complete script +++++++
Here's the complete script :
( Copyright (c) 2001 Steve Brookes. All rights reserved. )
Sub ResetServerPublishingRules(blnTestMode)
On Error Resume Next
'Create objects
Set objISA = CreateObject("FPC.Root")
objISA.Refresh
Set objArray = objISA.Arrays.Item("INFIS-PROXY") 'Insert array name
If Err.Number <> 0 Then
If blnTestMode Then MsgBox "The specified array was not found"
Exit Sub
End If
Set objServer = objArray.Servers.Item("INFIS-PROXY") 'Insert server name
If Err.Number <> 0 Then
If blnTestMode Then MsgBox "The specified server was not found"
Exit Sub
End If
Set objExtAdapter = objServer.Adapters.Item(3) 'Insert adapter index
If Err.Number <> 0 Then
If blnTestMode Then
MsgBox "The specified external adapter was not found on Item -
RC="&Err.Number
Exit Sub
End If
End If
If blnTestMode Then MsgBox "The specified external adapter was found -
RC="&Err.Number
On Error Goto 0
'Get first IP address of external adapter
aryAdapterIP = Split(objExtAdapter.IpAddresses, ",")
strExtIP = aryAdapterIP(0)
If blnTestMode Then
If MsgBox("Is " & strExtIP & " the correct external ip address?",
vbQuestion + vbYesNo, "Test Mode") = vbNo Then
Exit Sub
End If
End If
'Set external IP address for each Server Publishing Rule
blnNeedRestart = False
For Each objRule In objArray.Publishing.ServerPublishingRules
if blnTestMode Then
rc = MsgBox("objRule: " & objRule & "objRule.ExternalIp: "&
objRule.ExternalIp, vbQuestion + vbYesNo, "Test Mode")
end if
If objRule.ExternalIp <> strExtIP Then
blnNeedRestart = True
End If
objRule.ExternalIp = strExtIP
objRule.Save
Next
'Restart Web Proxy service
If blnNeedRestart Then
objServer.StopWebProxyService(True) 'Wait until complete
objServer.StartWebProxyService(True)
End If
End Sub
Call ResetServerPublishingRules(False) 'Change to False for normal mode