script for changing server publishing rules on ISA Server 
Author Message
 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



Fri, 15 Jul 2005 23:46:37 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. WSH scripting of MMC for Site Server Publishing

2. WebClient with ISA Server using Windows Authentication Error 407

3. ISa Server Programming

4. Cisco 5000 VPN Client and Microsoft ISA Server

5. To change an item's message class with an Exchange Server script (solution)

6. To change an item's message class with an Exchange Server script

7. SQL Server change scripts

8. changing Server Name with SQL Server(Urgent)

9. URGENT : CRPE32 (CR8), Subreport And Changing Server (with SQL Server 7.0)

10. Outlook VBScript, Server Time, Publishing Org. Forms

11. Web Publishing API : WpPost Sending files on a server

12. Publishing Reports to the Web Server

 

 
Powered by phpBB® Forum Software