• RSS
  • Twitter
  • FaceBook

Welcome to ISAserver.org

Forums | Register | Login | My Profile | Inbox | RSS RSS icon | My Subscription | My Forums | Address Book | Member List | Search | FAQ | Ticket List | Log Out

Upgrade ISA 2004 to 2006

Users viewing this topic: none

Logged in as: Guest
  Printable Version
All Forums >> [ISA 2006 General] >> Installation and Planning >> Upgrade ISA 2004 to 2006 Page: [1]
Login
Message << Older Topic   Newer Topic >>
Upgrade ISA 2004 to 2006 - 5.Sep.2007 4:06:07 AM   
Miioua

 

Posts: 79
Joined: 5.Jun.2007
Status: offline
Hello,

Due to problem, we will have to upgrade our proxies from ISA2004 EE to ISA2006 EE.
The problem is the number of proxies (>50) : We can not switch all in a day.

I'd like to know if there is a way to synchronize configuration (Destination Set, User Set,...) ?

Thanks

< Message edited by Miioua -- 5.Sep.2007 4:11:57 AM >
Post #: 1
RE: Upgrade ISA 2004 to 2006 - 11.Sep.2007 2:52:03 AM   
Miioua

 

Posts: 79
Joined: 5.Jun.2007
Status: offline
No ? nobody ?

I'm trying to make a script which export/import Destination Set, Unfortunatly,
ISA2004SDK is not able to connect ISA2006 CSS
ISA2006SDK is not able to connect ISA2004 CSS

(in reply to Miioua)
Post #: 2
RE: Upgrade ISA 2004 to 2006 - 20.Sep.2007 9:35:35 AM   
Miioua

 

Posts: 79
Joined: 5.Jun.2007
Status: offline
I just made two script to Export to txt files and another one to import from same text files.

If I schedule them, this works fine.

(in reply to Miioua)
Post #: 3
RE: Upgrade ISA 2004 to 2006 - 20.Sep.2007 10:33:27 AM   
elmajdal

 

Posts: 6022
Joined: 16.Sep.2004
From: Lebanese in Kuwait
Status: offline
Hi,

check this http://forums.isaserver.org/m_2002017454/mpage_1/key_/tm.htm#2002017454

_____________________________

Tarek Majdalani

Windows Expert - IT Pro MVP
Facebook : https://www.facebook.com/ElMajdal.Net

(in reply to Miioua)
Post #: 4
RE: Upgrade ISA 2004 to 2006 - 24.Sep.2007 3:14:32 AM   
Miioua

 

Posts: 79
Joined: 5.Jun.2007
Status: offline
Thanks.

Here are mines :

Export:
quote:

'=========================================================================================
Option Explicit

Dim     DEBUG
  DEBUG = False

'=====================================================================================


'###################################################################################
'MAIN - Hauptprozedur
'-----------------------------------------------------------------------------------
  Dim boolRunAsCScript 
    
  'Checking if code is running on cscript and not wscript...ie we are printing the output to the console
  If (UCase(Right(WScript.FullName, 11)) <> UCase("CScript.exe")) Then
      WScript.Echo "Must be run under CScript" & "  Example: CScript " & ScriptName & ".vbe"
  WScript.Echo vbTab & "Version " & SCRIPT_VERSION
      boolRunAsCScript = False
     
      Call EndScript
  Else
      Dim StartTime
          StartTime = Now()
      boolRunAsCScript = True
      Call StartScript
      Call GetISAellements()
      Call EndScript

  End If
'###################################################################################

'=========================================================================================
Sub EndScript() 'Alles was beim Ende des Sripted getan werden muß - wird immer aufgerufen
End Sub 'EndScript() 'Alles was beim Ende des Sripted getan werden muß - wird immer aufgerufen
'============================================================================




'============================================================================
Sub StartScript() 'Alles was beim Ende des Sripted getan werden muß - wird immer aufgerufen
End Sub 'StartScript() 'Alles was beim Ende des Sripted getan werden muß - wird immer aufgerufen
'============================================================================



'=========================================================================================
Sub GetISAellements() 'as String
  'This routine will analyse all policies in the ISA Enterprise configuration
  'and list all accounts defined in applies to. Additionally it will resolve all
  'subtree groupmemberships for any group defined to list all user accounts that are
  'affected by a policy

  Dim ISAEnterprise ' as FPCDS 'The ISA
  Dim CompuSet, Compu, Urls, ISAUrlSet , Range, entRuleElement , DomNamSets
  Dim USet, Account,dateLastMod,MyDate
  Dim FileToSave ,File
  Dim Count


  If (DEBUG)  Then wscript.echo  ("Connecting to the ISA Configuration...")
  Set ISAEnterprise = CreateObject ("FPC.Root")
  Set FileToSave = CreateObject ("Scripting.FileSystemObject")
 
 
  ISAEnterprise.ConnectToConfigurationStorageServer "localhost", "User1","dfdfff.test", "cDFGpo25E"


  dateLastMod = ISAEnterprise.Enterprise.LastModifiedTime

  wscript.echo dateLastMod
  wscript.echo Date()
 
  
  set entRuleElement = ISAEnterprise.Enterprise.RuleElements

 
 
'###############################################################################################
'# Computer
'###############################################################################################
  wscript.echo "Computers"
  Set File= FileToSave.OpenTextFile("Computers.txt",2, true)
  For Each Compu In entRuleElement.Computers
      If (DEBUG )  Then wscript.echo  "   "&Compu.Name & " " & Compu.IPaddress
      File.WriteLine Compu.Name & ";" & Compu.Description & ";" & Compu.IPaddress
  Next
  File.close
  If (DEBUG )  Then wscript.echo ""
 
 
'###############################################################################################
'# Computers Sets
'###############################################################################################
  wscript.echo "ComputerSet"
  Set File = FileToSave.OpenTextFile("ComputersSets.txt",2, true)
  For Each CompuSet In entRuleElement.ComputerSets
      File.WriteLine CompuSet.Name
      File.WriteLine  ("<")
             
      For Each Compu in CompuSet.Computers
          If (DEBUG)   Then wscript.echo  "   Compu " & Compu.Name & ";" & Compu.IPaddress
          File.WriteLine "Compu"& ";" & Compu.Name  & ";" & Compu.IPaddress

        Next
        For Each Range in CompuSet.AddressRanges
          If (DEBUG)  Then  wscript.echo  "   Range " & range.Name & " "& Range.IP_From & " "& Range.IP_To
          File.WriteLine   "Range" & ";" & range.Name & ";" & Range.IP_From & ";" & Range.IP_To
      Next
      File.WriteLine ">"
      File.WriteLine  ("")
   Next
   File.close
   If (DEBUG )  Then wscript.echo ""


  '###############################################################################################
  '# URL Sets
  '###############################################################################################
   wscript.echo "URLSets"
   Set File = FileToSave.OpenTextFile("URLSets.txt",2, true)
   For Each ISAUrlSet In entRuleElement.UrlSets
       File.WriteLine ISAUrlSet
      File.WriteLine  ("<")    
      For Count=1 to ISAUrlSet.Count
          If (DEBUG )  Then wscript.echo "   " & ISAUrlSet.Item(Count)
          File.WriteLine  ISAUrlSet.Item(Count)
      Next
      File.WriteLine  (">")
      File.WriteLine  ("")
   Next
   File.close
   If (DEBUG )  Then wscript.echo ""


  '###############################################################################################
  '# Domain Name Sets
  '###############################################################################################    
      wscript.echo "Domain Name Set"
   Set File = FileToSave.OpenTextFile("DomainNameSets.txt",2, true)
   For Each DomNamSets In entRuleElement.DomainNameSets
      If (DEBUG )  Then  wscript.echo "   DomNamSets: " & DomNamSets
       File.WriteLine DomNamSets
      File.WriteLine  ("<")    
      For Count=1 to DomNamSets.Count
          If (DEBUG ) Then wscript.echo "     " & DomNamSets.Item(Count)
          File.WriteLine  DomNamSets.Item(Count)
      Next
      File.WriteLine  (">")
      File.WriteLine  ("")
   Next
   File.close
   If (DEBUG )  Then wscript.echo ""
  
   '###############################################################################################
   '# Users Sets
   '###############################################################################################
   wscript.echo "User Sets"
   Set File = FileToSave.OpenTextFile("UserSets.txt",2, true)
   For Each USet In entRuleElement.UserSets
      If (DEBUG )   Then wscript.echo  "   USets " & USet
      File.WriteLine USet.Name
      File.WriteLine  ("<")
                 
      For Each Account in USet.Accounts
          If (DEBUG )   Then wscript.echo  "    " & Account.Account
          File.WriteLine Account.Account
        Next
      File.WriteLine ">"
      File.WriteLine  ("")
   Next
   File.close
   If (DEBUG )  Then wscript.echo "" 

End Sub 'GetISAellements()



Import:
quote:


'=========================================================================================
Option Explicit
Const ERROR_FileNotFound = &H80070002

Dim     ISAEnterprise ' as FPCDS 'The ISA
Dim     entRuleElement
Dim    FileObj
Dim     DEBUG
  DEBUG = TRUE
 
'=====================================================================================


'###################################################################################
'MAIN - Hauptprozedur
'-----------------------------------------------------------------------------------
  Dim boolRunAsCScript 
    
  'Checking if code is running on cscript and not wscript...ie we are printing the output to the console
  If (UCase(Right(WScript.FullName, 11)) <> UCase("CScript.exe")) Then
      WScript.Echo "Must be run under CScript" & "  Example: CScript " & ScriptName & ".vbe"
  WScript.Echo ";" & "Version " & SCRIPT_VERSION
      boolRunAsCScript = False
     
      Call EndScript
  Else
      Dim StartTime
          StartTime = Now()
      boolRunAsCScript = True
      Call StartScript
     
      Call ISASets()
     
      Call EndScript

  End If
'###################################################################################

'=========================================================================================
Sub EndScript() 'Alles was beim Ende des Sripted getan werden muß - wird immer aufgerufen
End Sub 'EndScript() 'Alles was beim Ende des Sripted getan werden muß - wird immer aufgerufen
'============================================================================




'============================================================================
Sub StartScript() 'Alles was beim Ende des Sripted getan werden muß - wird immer aufgerufen
End Sub 'StartScript() 'Alles was beim Ende des Sripted getan werden muß - wird immer aufgerufen
'============================================================================



'=========================================================================================
Sub ISASets() 'as String
  'This routine will analyse all policies in the ISA Enterprise configuration
  'and list all accounts defined in applies to. Additionally it will resolve all
  'subtree groupmemberships for any group defined to list all user accounts that are
  'affected by a policy


  If (DEBUG= true)  Then wscript.echo  ("Connecting to the ISA Configuration...")
  Set ISAEnterprise = CreateObject ("FPC.Root")
  Set FileObj = CreateObject ("Scripting.FileSystemObject")
 
 
  ISAEnterprise.ConnectToConfigurationStorageServer "localhost", "User1","dfdfff.test", "cDFGpo25E"

  set entRuleElement = ISAEnterprise.Enterprise.RuleElements
 
  CompuSets
  UrlSets
  UserSets
  DomainNameSets
 
End Sub 'ISASets()   

Sub CompuSets()
'###############################################################################################
'# ComputerSets
'###############################################################################################
  Dim File, tmp, Splited
  Dim ComputerSets, ComputerSet, Computers ,Ranges
  Dim Count
 
  Set File= FileObj.OpenTextFile("ComputersSets.txt")
  'On Error Resume Next
 
  Do While File.AtEndOfStream <> true
      tmp = File.ReadLine
     
      If tmp <>"" Then
           Splited= split(tmp, ";")
           wscript.echo "ComputerSet found: "& Splited(0)
           On Error Resume Next
           Set ComputerSet = entRuleElement.ComputerSets(Splited(0))
           If Err.Number=ERROR_FileNotFound Then
               err.Clear
               Wscript.echo "New Computer Sets: " & Splited(0)
               Set ComputerSet = entRuleElement.ComputerSets.add(Splited(0))
           End If
           On Error GoTo 0
           
           tmp  = File.ReadLine
           Set computers = computerSet.Computers
           Set Ranges= computerSet.AddressRanges
           
         
           On Error  Resume Next
           do While tmp <> ">"
                
               If tmp <> "<" Then
              If split(tmp,";")(0) = "Compu" Then
                  wscript.echo "  Add Computer: " & split(tmp,";")(1) &";" & split(tmp,";")(2)
                  computers.Add split(tmp,";")(1) , split(tmp,";")(2)
              ElseIf split(tmp,";")(0) = "Range" Then
                  wscript.echo "  Add Range: " & split(tmp,";")(1) &" " & split(tmp,";")(2)&" " & split(tmp,";")(3)
                   Ranges.Add split(tmp,";")(1) , split(tmp,";")(2), split(tmp,";")(3)
              End If
          End If
               tmp  = File.ReadLine
           loop
           On Error  GoTo 0
           ComputerSet.save
      End If
     
  loop        
End Sub 'CompuSets()

Sub UrlSets()
'###############################################################################################
'# UrlSets
'###############################################################################################
  Dim File, tmp, Splited
  Dim URLSets, UrlSet
  Dim Count
 
  Set File= FileObj.OpenTextFile("URLSets.txt")
  'On Error Resume Next
 
  Do While File.AtEndOfStream <> true
      tmp = File.ReadLine
     
      If tmp <>"" Then
           Splited= split(tmp, ";")
           wscript.echo "URLSet found in File: "& Splited(0)
           On Error Resume Next
           Set UrlSet = entRuleElement.UrlSets(Splited(0))
           If Err.Number=ERROR_FileNotFound Then
               err.Clear
               Wscript.echo "New URLSets: " & Splited(0)
               Set UrlSet = entRuleElement.UrlSets.add(Splited(0))
           End If
           On Error GoTo 0
           
           tmp  = File.ReadLine
           
           On Error  Resume Next
           Do While tmp <> ">"
                
               If tmp <> "<" Then
               wscript.echo "  Add URL: " & split(tmp,";")(0)
               UrlSet.Add split(tmp,";")(0)
              
           End If
               tmp  = File.ReadLine
           loop
           On Error  GoTo 0
           UrlSet.save
      End If
     
  loop        
End Sub 'URLSets()


Sub UserSets()
'###############################################################################################
'# USerSets
'###############################################################################################
  Dim File, tmp, Splited
  Dim UsersSets, UserSet
  Dim Count
 
  Set File= FileObj.OpenTextFile("UserSets.txt")
  'On Error Resume Next
 
  Do While File.AtEndOfStream <> true
      tmp = File.ReadLine
     
      If tmp <>"" Then
           Splited= split(tmp, ";")
           wscript.echo "UserSet found in File: "& Splited(0)
           On Error Resume Next
           Set UserSet = entRuleElement.UserSets(Splited(0))
           If Err.Number=ERROR_FileNotFound Then
               err.Clear
               Wscript.echo "New UserSets: " & Splited(0)
               Set UserSet = entRuleElement.UserSets.add(Splited(0))
           End If
           On Error GoTo 0
           
           tmp  = File.ReadLine
           
           On Error  Resume Next
           Do While tmp <> ">"
                
               If tmp <> "<" Then
               wscript.echo "  Add User: " & split(tmp,";")(0)
               UserSet.Accounts.Add split(tmp,";")(0)
              
           End If
               tmp  = File.ReadLine
           loop
           On Error  GoTo 0
           UserSet.save
      End If
     
  loop        
End Sub 'UserSets()


Sub DomainNameSets()
'###############################################################################################
'# UrlSets
'###############################################################################################
  Dim File, tmp, Splited
  Dim DomainNSets, DomainNSet
  Dim Count
 
  Set File= FileObj.OpenTextFile("DomainNameSets.txt")
  On Error Resume Next
 
  Do While File.AtEndOfStream <> true
      tmp = File.ReadLine
     
      If tmp <>"" Then
           Splited= split(tmp, ";")
           wscript.echo "DomainNSet found in File: "& Splited(0)
           On Error Resume Next
           Set DomainNSet = entRuleElement.DomainNameSets(Splited(0))
           If Err.Number=ERROR_FileNotFound Then
               err.Clear
               Wscript.echo "New DomainNSets: " & Splited(0)
               Set DomainNSet = entRuleElement.DomainNameSets.add(Splited(0))
           End If
           On Error GoTo 0
           
           tmp  = File.ReadLine
           
           On Error  Resume Next
           Do While tmp <> ">"
                
               If tmp <> "<" Then
               wscript.echo "  Add Domain Name: " & split(tmp,";")(0)
               DomainNSet.Add split(tmp,";")(0)
              
           End If
               tmp  = File.ReadLine
           loop
           On Error  GoTo 0
           DomainNSet.save
      End If
     
  loop        
End Sub 'URLSets()



I'd like to make Export/Mmport only if there were some modification. for this, I foud :  Enterprise.LastModifiedTime

but editing a Desination Set doesn't change this value.
Any Idea ?

< Message edited by Miioua -- 24.Sep.2007 3:16:35 AM >

(in reply to elmajdal)
Post #: 5
RE: Upgrade ISA 2004 to 2006 - 24.Sep.2007 4:09:34 AM   
elmajdal

 

Posts: 6022
Joined: 16.Sep.2004
From: Lebanese in Kuwait
Status: offline
Hi,

sorry but i am not a scripting guy

hope someone else passes through this thread and help you with it.

_____________________________

Tarek Majdalani

Windows Expert - IT Pro MVP
Facebook : https://www.facebook.com/ElMajdal.Net

(in reply to Miioua)
Post #: 6
RE: Upgrade ISA 2004 to 2006 - 27.Nov.2007 9:25:34 AM   
Miioua

 

Posts: 79
Joined: 5.Jun.2007
Status: offline
Hi Everybody.
I'd like to refresh this topic as I'm still looking for a solution on "Export the configuration" only if there is a modification.

In ISA Interface, there is under : <Array>/monitoring/Configuration on information about Last Update.

Do you know a way to get this value ? or do you seen another solution ?

Thanks

(in reply to elmajdal)
Post #: 7
RE: Upgrade ISA 2004 to 2006 - 28.Nov.2007 9:47:22 AM   
Miioua

 

Posts: 79
Joined: 5.Jun.2007
Status: offline
No idea ?


(in reply to Miioua)
Post #: 8
RE: Upgrade ISA 2004 to 2006 - 29.Nov.2007 8:09:10 AM   
Miioua

 

Posts: 79
Joined: 5.Jun.2007
Status: offline
really ?

(in reply to Miioua)
Post #: 9
RE: Upgrade ISA 2004 to 2006 - 29.Nov.2007 9:54:00 AM   
Jason Jones

 

Posts: 4663
Joined: 30.Jul.2002
From: United Kingdom
Status: offline
quote:

ORIGINAL: Miioua

Hello,

Due to problem, we will have to upgrade our proxies from ISA2004 EE to ISA2006 EE.
The problem is the number of proxies (>50) : We can not switch all in a day.

I'd like to know if there is a way to synchronize configuration (Destination Set, User Set,...) ?

Thanks


I'm confused....

Why not put in a new 2k4 CSS replicated from the exiting one. Then, upgrade it to ISA2k6 leaving the existing ISA2k4 CSS in place. This way you can then upgrade each ISA2k4 proxy in turn and it will keep all the settings from before.

In this scenario, you will have a dual 2k4 and 2k6 environment that can run side-by-side. Once all servers are upgraded, you can then ditch the old CSS and either move the ISA2k6 CSS back to it or add it as a new replica so you have two.

If you have more CSS servers, just factor this in during the rolling upgrade.

Does this approach work for you?

Cheers

JJ

_____________________________

Jason Jones | Forefront MVP | Silversands Ltd
My Blogs: http://blog.msedge.org.uk/ and http://blog.msfirewall.org.uk/

(in reply to Miioua)
Post #: 10
RE: Upgrade ISA 2004 to 2006 - 30.Nov.2007 1:34:35 AM   
Miioua

 

Posts: 79
Joined: 5.Jun.2007
Status: offline
yes, this would be the normal/standart way, but even with this, there is no replication of Destination Set, UserSets from CSS 2k4 to 2K6 except at the migration time of the first CSS

As I said, we have around 60-80 Proxies, we can not imagine a migate in a month, that why I need a solution to import modigications

(in reply to Jason Jones)
Post #: 11
RE: Upgrade ISA 2004 to 2006 - 30.Nov.2007 3:59:35 AM   
Jason Jones

 

Posts: 4663
Joined: 30.Jul.2002
From: United Kingdom
Status: offline
Sorry, I must be missing something here. When you upgrade the CSS all config will be upgraded so why do you need to worry about individual exports???

Are your proxies not part of the same Enterprise?

Why do you have to do it in a month if you have parallel 2k4 and 2k6 CSS servers?

_____________________________

Jason Jones | Forefront MVP | Silversands Ltd
My Blogs: http://blog.msedge.org.uk/ and http://blog.msfirewall.org.uk/

(in reply to Miioua)
Post #: 12
RE: Upgrade ISA 2004 to 2006 - 3.Dec.2007 2:34:18 AM   
Miioua

 

Posts: 79
Joined: 5.Jun.2007
Status: offline
durring month, I will have ISA2004 and 2006 linving in parallel.

But it's ok, I found the solution in Technet Forum :
http://www.microsoft.com/technet/community/newsgroups/dgbrowser/en-us/default.mspx?dg=microsoft.public.isa.sdk-dev&mid=887602c5-7328-42db-934b-64874bf33767

quote:


Check fpcArray.StorageChangeNumber (and fpcRoot.StorageChangeNumber in Enterprise edition). This value is incremented when changes are made.
 

(in reply to Jason Jones)
Post #: 13
RE: Upgrade ISA 2004 to 2006 - 5.Dec.2007 4:25:09 AM   
elmajdal

 

Posts: 6022
Joined: 16.Sep.2004
From: Lebanese in Kuwait
Status: offline
So how your script final look will be like ?

quote:

Check fpcArray.StorageChangeNumber (and fpcRoot.StorageChangeNumber in Enterprise edition). This value is incremented when changes are made. 


Can you paste again the script , with highlighting this line in bold.

Thanks for the update

_____________________________

Tarek Majdalani

Windows Expert - IT Pro MVP
Facebook : https://www.facebook.com/ElMajdal.Net

(in reply to Miioua)
Post #: 14
RE: Upgrade ISA 2004 to 2006 - 10.Dec.2007 2:51:31 AM   
Miioua

 

Posts: 79
Joined: 5.Jun.2007
Status: offline
Yes, surely :

Export:
quote:


'=========================================================================================
Option Explicit

Dim     DEBUG
  DEBUG = true
Dim    Destination
  'Destination="L:\ISA2004-2006"
  Destination="\\si0vm055\Isa2004-2006$"

'=====================================================================================



'###################################################################################
'MAIN - Hauptprozedur
'-----------------------------------------------------------------------------------
  Dim boolRunAsCScript 
    
  'Checking if code is running on cscript and not wscript...ie we are printing the output to the console
  If (UCase(Right(WScript.FullName, 11)) <> UCase("CScript.exe")) Then
      WScript.Echo "Must be run under CScript" & "  Example: CScript " & ScriptName & ".vbe"
  WScript.Echo vbTab & "Version " & SCRIPT_VERSION
      boolRunAsCScript = False
     
      Call EndScript
  Else
      Dim StartTime
          StartTime = Now()
      boolRunAsCScript = True
      Call StartScript
      Call GetISAellements()
      Call EndScript

  End If
'###################################################################################

'=========================================================================================
Sub EndScript() 'Alles was beim Ende des Sripted getan werden muß - wird immer aufgerufen
End Sub 'EndScript() 'Alles was beim Ende des Sripted getan werden muß - wird immer aufgerufen
'============================================================================




'============================================================================
Sub StartScript() 'Alles was beim Ende des Sripted getan werden muß - wird immer aufgerufen
End Sub 'StartScript() 'Alles was beim Ende des Sripted getan werden muß - wird immer aufgerufen
'============================================================================



'=========================================================================================
Sub GetISAellements() 'as String
  'This routine will analyse all policies in the ISA Enterprise configuration
  'and list all accounts defined in applies to. Additionally it will resolve all
  'subtree groupmemberships for any group defined to list all user accounts that are
  'affected by a policy
 
  Dim ISAEnterprise ' as FPCDS 'The ISA
  Dim Arr, CompuSet, Compu, Urls, ISAUrlSet , Range, entRuleElement , DomNamSets
  Dim USet, Account,dateLastMod,MyDate
  Dim FileToSave ,File, PreviousVersionExported
  Dim Count


  If (DEBUG)  Then wscript.echo  ("Connecting to the ISA Configuration...")
  Set ISAEnterprise = CreateObject ("FPC.Root")
 
    ISAEnterprise.ConnectToConfigurationStorageServer "ISAserver2004.myfirm.com"
 

  Set FileToSave = CreateObject ("Scripting.FileSystemObject")
  Set File= FileToSave.OpenTextFile(Destination &"\Lastexported.txt",1, true)
     PreviousVersionExported = File.ReadLine
     File.close
     
      dateLastMod = CStr(ISAEnterprise.StorageChangeNumber)
      If PreviousVersionExported = dateLastMod Then
      If (DEBUG)  Then wscript.echo  ("No news version: " & PreviousVersionExported )   
      ISAEnterprise.DisconnectFromConfigurationStorageServer
      wscript.Quit
  End If
 
  If (DEBUG)  Then  wscript.echo  "Old Version: " & PreviousVersionExported
      If (DEBUG)  Then  wscript.echo  "New Version: " & dateLastMod
             
      set entRuleElement = ISAEnterprise.Enterprise.RuleElements

 
 
'###############################################################################################
'# Computer
'###############################################################################################
  wscript.echo "Computers"
  Set File= FileToSave.OpenTextFile(Destination &"\Computers.txt",2, true)
  For Each Compu In entRuleElement.Computers
      If (DEBUG )  Then wscript.echo  "   "&Compu.Name & " " & Compu.IPaddress
      File.WriteLine Compu.Name & ";" & Compu.Description & ";" & Compu.IPaddress
  Next
  File.close
  If (DEBUG )  Then wscript.echo ""
 
 
'###############################################################################################
'# Computers Sets
'###############################################################################################
  wscript.echo "ComputerSet"
  Set File = FileToSave.OpenTextFile(Destination &"\ComputersSets.txt",2, true)
  For Each CompuSet In entRuleElement.ComputerSets
      File.WriteLine CompuSet.Name
      File.WriteLine  ("<")
             
      For Each Compu in CompuSet.Computers
          If (DEBUG)   Then wscript.echo  "   Compu " & Compu.Name & ";" & Compu.IPaddress
          File.WriteLine "Compu"& ";" & Compu.Name  & ";" & Compu.IPaddress

        Next
        For Each Range in CompuSet.AddressRanges
          If (DEBUG)  Then  wscript.echo  "   Range " & range.Name & " "& Range.IP_From & " "& Range.IP_To
          File.WriteLine   "Range" & ";" & range.Name & ";" & Range.IP_From & ";" & Range.IP_To
      Next
      File.WriteLine ">"
      File.WriteLine  ("")
   Next
   File.close
   If (DEBUG )  Then wscript.echo ""


  '###############################################################################################
  '# URL Sets
  '###############################################################################################
   wscript.echo "URLSets"
   Set File = FileToSave.OpenTextFile(Destination &"\URLSets.txt",2, true)
   For Each ISAUrlSet In entRuleElement.UrlSets
       File.WriteLine ISAUrlSet
      File.WriteLine  ("<")    
      For Count=1 to ISAUrlSet.Count
          If (DEBUG )  Then wscript.echo "   " & ISAUrlSet.Item(Count)
          File.WriteLine  ISAUrlSet.Item(Count)
      Next
      File.WriteLine  (">")
      File.WriteLine  ("")
   Next
   File.close
   If (DEBUG )  Then wscript.echo ""


  '###############################################################################################
  '# Domain Name Sets
  '###############################################################################################    
      wscript.echo "Domain Name Set"
   Set File = FileToSave.OpenTextFile(Destination &"\DomainNameSets.txt",2, true)
   For Each DomNamSets In entRuleElement.DomainNameSets
      If (DEBUG )  Then  wscript.echo "   DomNamSets: " & DomNamSets
       File.WriteLine DomNamSets
      File.WriteLine  ("<")    
      For Count=1 to DomNamSets.Count
          If (DEBUG ) Then wscript.echo "     " & DomNamSets.Item(Count)
          File.WriteLine  DomNamSets.Item(Count)
      Next
      File.WriteLine  (">")
      File.WriteLine  ("")
   Next
   File.close
   If (DEBUG )  Then wscript.echo ""
  
   '###############################################################################################
   '# Users Sets
   '###############################################################################################
   wscript.echo "User Sets"
   Set File = FileToSave.OpenTextFile(Destination &"\UserSets.txt",2, true)
   For Each USet In entRuleElement.UserSets
      If (DEBUG )   Then wscript.echo  "   USets " & USet
      File.WriteLine USet.Name
      File.WriteLine  ("<")
                 
      For Each Account in USet.Accounts
          If (DEBUG )   Then wscript.echo  "    " & Account.Account
          File.WriteLine Account.Account
        Next
      File.WriteLine ">"
      File.WriteLine  ("")
   Next
   File.close
   If (DEBUG )  Then wscript.echo ""

   Set File= FileToSave.OpenTextFile(Destination &"\exported.txt",2, true)  
   File.WriteLine ISAEnterprise.StorageChangeNumber
   File.close
   Set File= FileToSave.OpenTextFile(Destination &"\Lastexported.txt",2, true)  
   File.WriteLine ISAEnterprise.StorageChangeNumber
   File.close
End Sub 'GetISAellements()



Import:
quote:


'=========================================================================================
Option Explicit
Const ERROR_FileNotFound = &H80070002

Dim     ISAEnterprise ' as FPCDS 'The ISA
Dim     entRuleElement
Dim    FileObj
Dim     DEBUG
  DEBUG = TRUE
Dim    Destination
  'Destination="L:\ISA2004-2006"
  Destination="\\si0vm055\Isa2004-2006$"
 
'=====================================================================================


'###################################################################################
'MAIN - Hauptprozedur
'-----------------------------------------------------------------------------------
  Dim boolRunAsCScript 
    
  'Checking if code is running on cscript and not wscript...ie we are printing the output to the console
  If (UCase(Right(WScript.FullName, 11)) <> UCase("CScript.exe")) Then
      WScript.Echo "Must be run under CScript" & "  Example: CScript " & ScriptName & ".vbe"
  WScript.Echo ";" & "Version " & SCRIPT_VERSION
      boolRunAsCScript = False
     
      Call EndScript
  Else
      Dim StartTime
          StartTime = Now()
      boolRunAsCScript = True
      Call StartScript
     
      Call ISASets()
     
      Call EndScript

  End If
'###################################################################################

'=========================================================================================
Sub EndScript() 'Alles was beim Ende des Sripted getan werden muß - wird immer aufgerufen
End Sub 'EndScript() 'Alles was beim Ende des Sripted getan werden muß - wird immer aufgerufen
'============================================================================




'============================================================================
Sub StartScript() 'Alles was beim Ende des Sripted getan werden muß - wird immer aufgerufen
End Sub 'StartScript() 'Alles was beim Ende des Sripted getan werden muß - wird immer aufgerufen
'============================================================================



'=========================================================================================
Sub ISASets() 'as String
  'This routine will analyse all policies in the ISA Enterprise configuration
  'and list all accounts defined in applies to. Additionally it will resolve all
  'subtree groupmemberships for any group defined to list all user accounts that are
  'affected by a policy


  If (DEBUG= true)  Then wscript.echo  ("Connecting to the ISA Configuration...")
  Set ISAEnterprise = CreateObject ("FPC.Root")
  Set FileObj = CreateObject ("Scripting.FileSystemObject")
  wscript.echo Date & " " & Time
  If FileObj.FileExists(Destination &"\exported.txt")=False then
  If (DEBUG)  Then wscript.echo  ("No new Export")
  wscript.Quit
  end if
 
' ISAEnterprise.ConnectToConfigurationStorageServer "localhost", "User1","gix8fe.test", "cDFGpo25E"
  ISAEnterprise.ConnectToConfigurationStorageServer "si0vm055"
   
  set entRuleElement = ISAEnterprise.Enterprise.RuleElements
 
  CompuSets
  UrlSets
  UserSets
  DomainNameSets
 
  FileObj.DeleteFile(Destination &"\exported.txt")
 
End Sub 'ISASets()   

Sub CompuSets()
'###############################################################################################
'# ComputerSets
'###############################################################################################
  Dim File, tmp, Splited
  Dim ComputerSets, ComputerSet, Computers ,Ranges
  Dim Count
 
  Set File= FileObj.OpenTextFile("ComputersSets.txt")
  'On Error Resume Next
 
  Do While File.AtEndOfStream <> true
      tmp = File.ReadLine
     
      If tmp <>"" Then
           Splited= split(tmp, ";")
           wscript.echo "ComputerSet found: "& Splited(0)
           On Error Resume Next
           Set ComputerSet = entRuleElement.ComputerSets(Splited(0))
           If Err.Number=ERROR_FileNotFound Then
               err.Clear
               Wscript.echo "New Computer Sets: " & Splited(0)
               Set ComputerSet = entRuleElement.ComputerSets.add(Splited(0))
           End If
           On Error GoTo 0
           
           tmp  = File.ReadLine
           Set computers = computerSet.Computers
           Set Ranges= computerSet.AddressRanges
           
         
           On Error  Resume Next
           do While tmp <> ">"
                
               If tmp <> "<" Then
              If split(tmp,";")(0) = "Compu" Then
                  wscript.echo "  Add Computer: " & split(tmp,";")(1) &";" & split(tmp,";")(2)
                  computers.Add split(tmp,";")(1) , split(tmp,";")(2)
              ElseIf split(tmp,";")(0) = "Range" Then
                  wscript.echo "  Add Range: " & split(tmp,";")(1) &" " & split(tmp,";")(2)&" " & split(tmp,";")(3)
                   Ranges.Add split(tmp,";")(1) , split(tmp,";")(2), split(tmp,";")(3)
              End If
          End If
               tmp  = File.ReadLine
           loop
           On Error  GoTo 0
           ComputerSet.save
      End If
     
  loop        
End Sub 'CompuSets()

Sub UrlSets()
'###############################################################################################
'# UrlSets
'###############################################################################################
  Dim File, tmp, Splited
  Dim URLSets, UrlSet
  Dim Count
 
  Set File= FileObj.OpenTextFile("URLSets.txt")
  'On Error Resume Next
 
  Do While File.AtEndOfStream <> true
      tmp = File.ReadLine
     
      If tmp <>"" Then
           Splited= split(tmp, ";")
           wscript.echo "URLSet found in File: "& Splited(0)
           On Error Resume Next
           Set UrlSet = entRuleElement.UrlSets(Splited(0))
           If Err.Number=ERROR_FileNotFound Then
               err.Clear
               Wscript.echo "New URLSets: " & Splited(0)
               Set UrlSet = entRuleElement.UrlSets.add(Splited(0))
           End If
           On Error GoTo 0
           
           tmp  = File.ReadLine
           
           On Error  Resume Next
           Do While tmp <> ">"
                
               If tmp <> "<" Then
               wscript.echo "  Add URL: " & split(tmp,";")(0)
               UrlSet.Add split(tmp,";")(0)
              
           End If
               tmp  = File.ReadLine
           loop
           On Error  GoTo 0
           UrlSet.save
      End If
     
  loop        
End Sub 'URLSets()


Sub UserSets()
'###############################################################################################
'# USerSets
'###############################################################################################
  Dim File, tmp, Splited
  Dim UsersSets, UserSet
  Dim Count
 
  Set File= FileObj.OpenTextFile("UserSets.txt")
  'On Error Resume Next
 
  Do While File.AtEndOfStream <> true
      tmp = File.ReadLine
     
      If tmp <>"" Then
           Splited= split(tmp, ";")
           wscript.echo "UserSet found in File: "& Splited(0)
           On Error Resume Next
           Set UserSet = entRuleElement.UserSets(Splited(0))
           If Err.Number=ERROR_FileNotFound Then
               err.Clear
               Wscript.echo "New UserSets: " & Splited(0)
               Set UserSet = entRuleElement.UserSets.add(Splited(0))
           End If
           On Error GoTo 0
           
           tmp  = File.ReadLine
           
           On Error  Resume Next
           Do While tmp <> ">"
                
               If tmp <> "<" Then
              
               If (InStr (split(tmp,";")(0) ,"\")) Then
                   wscript.echo "  Add User: " & split(tmp,";")(0)
                   UserSet.Accounts.Add split(tmp,";")(0)
               Else
                   wscript.echo "  Invalid User: " & split(tmp,";")(0)
               End If
           End If
               tmp  = File.ReadLine
           loop
           On Error  GoTo 0
           UserSet.save
      End If
     
  loop        
End Sub 'UserSets()


Sub DomainNameSets()
'###############################################################################################
'# UrlSets
'###############################################################################################
  Dim File, tmp, Splited
  Dim DomainNSets, DomainNSet
  Dim Count
 
  Set File= FileObj.OpenTextFile("DomainNameSets.txt")
  On Error Resume Next
 
  Do While File.AtEndOfStream <> true
      tmp = File.ReadLine
     
      If tmp <>"" Then
           Splited= split(tmp, ";")
           wscript.echo "DomainNSet found in File: "& Splited(0)
           On Error Resume Next
           Set DomainNSet = entRuleElement.DomainNameSets(Splited(0))
           If Err.Number=ERROR_FileNotFound Then
               err.Clear
               Wscript.echo "New DomainNSets: " & Splited(0)
               Set DomainNSet = entRuleElement.DomainNameSets.add(Splited(0))
           End If
           On Error GoTo 0
           
           tmp  = File.ReadLine
           
           On Error  Resume Next
           Do While tmp <> ">"
                
               If tmp <> "<" Then
               wscript.echo "  Add Domain Name: " & split(tmp,";")(0)
               DomainNSet.Add split(tmp,";")(0)
              
           End If
               tmp  = File.ReadLine
           loop
           On Error  GoTo 0
           DomainNSet.save
      End If
     
  loop        
End Sub 'URLSets()


I start those scripts every 15 minutes (Import 5 minutes after export)

PS : I'm not script specialiste, there is probably better way to do what I did....

< Message edited by Miioua -- 10.Dec.2007 2:53:51 AM >

(in reply to elmajdal)
Post #: 15

Page:   [1] << Older Topic    Newer Topic >>
All Forums >> [ISA 2006 General] >> Installation and Planning >> Upgrade ISA 2004 to 2006 Page: [1]
Jump to:

New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts