[THIN] Re: Exporting/Import Applications

I have a couple of scripts that will do that; several people on the list
have used them.  Here they are.  Run  the Save script against your farm, it
will generate an .inf file containing the settings.  The restore script will
prompt you for the name of the .inf file to import app settings from.  The
.inf file can be customized to import one or all apps; settings/servers can
be customized as well.  Although these were developed on XP FR3, I've had
reports that they will run well on PS 4.0, but not 3.0.  They have no
problem with programs containing spaces or arguments.
 
These are MFCOM scripts; rename them with a .wsf extension.
 
 

  _____  

From: Joe Shonk [mailto:joe.shonk@xxxxxxxxx] 
Sent: Wednesday, June 29, 2005 5:00 PM
To: thin@xxxxxxxxxxxxx
Subject: [THIN] Exporting/Import Applications



Hello,

 

Does anyone know of any applications that will export Published App setting
and import them?  I've looked at several different versions of appexp,
export, newapp from the SDK, but they are really buggy, change settings, and
do not like Programs that have spaces in them w/ arguments.

 

Joe

**********    Confidentiality Notice    **********
This electronic transmission and any attached documents or other
writings are confidential and are for the sole use of the intended
recipient(s) identified above. This message may contain information
that is privileged, confidential or otherwise protected from disclosure
under applicable law. If the receiver of this information is not the
intended recipient, or the employee, or agent responsible for delivering
the information to the intended recipient, you are hereby notified that
any use, reading, dissemination, distribution, copying or storage of this
information is strictly prohibited. If you have received this information in
error, please notify the sender by return email and delete the electronic
transmission, including all attachments from your system.
'*******************************************************************************
'Written by Michael Callahan
'Date: 01/25/2005
'
'AppSave.wsf
'
'Description: List all applications in a farm and write the settings out to a 
file for restore.
'All files will be created in the same directory the script is run in; a folder 
named "icons" should also             
'be created in this directory for icon storage and retrieval.
'
'
'*******************************************************************************
<package>
    <job id=" FarmApplications">

        <comment>

        File:           FarmAppSave.wsf
        Description:    Backup application settings for all apps  in the farm.
        Requirements:   WSH 5.5 or higher.
                

        </comment>
        <runtime>
            <description>
               Backup application settings for all apps  in the farm.
            </description>
              
        </runtime>
        <reference object="MetaFrameCOM.MetaFrameFarm"/>
        <script language="VBScript">
        'On Error Resume Next
            Dim theFarm,AppName ,anApp,aServer
            
            '
            'Set up basic scripting objects
            '
            Set oShell = WScript.CreateObject("WScript.Shell")
            Set oFso = CreateObject("Scripting.FileSystemObject")
            Set oWshNetwork = WScript.CreateObject("WScript.Network")
            sScriptFullName = WScript.ScriptFullName
            sScriptPath = Left(sScriptFullName, InStrRev(sScriptFullName, "\"))

            
            '
            ' Create MetaFrameFarm object
            '

            Set theFarm = CreateObject("MetaFrameCOM.MetaFrameFarm")
            if Err.Number <> 0 Then
                WScript.Echo "Can't create MetaFrameFarm object"
                WScript.Echo "(" & Err.Number & ") " & Err.Description
                WScript.Echo ""
                WScript.Quit Err.Number
            End if

            '
            ' Initialize the farm object.
            '

            theFarm.Initialize(MetaFrameWinFarmObject)
            if Err.Number <> 0 Then
                WScript.Echo "Can't  Initialize MetaFrameFarm object"
                WScript.Echo "(" & Err.Number & ") " & Err.Description
                WScript.Echo ""
                WScript.Quit Err.Number
            End if
            
            '
            '
            '
            'Create icon folder for icon storage
            If not oFso.FolderExists(sScriptPath & "\icons") Then
            oFso.CreateFolder(sScriptPath & "\icons")
            End If
            'Create backup folder for files from last script run
            If not oFso.FolderExists(sScriptPath & "\backup") Then
            oFso.CreateFolder(sScriptPath & "\backup")
            End If
            'Create backup folder for icons, then copy last run's icons over
            If oFso.FolderExists(sScriptPath & "backup\icons") Then
            oFso.DeleteFile sScriptPath & "backup\icons\*.*"
            oFso.CopyFolder sScriptPath & "\icons", sScriptPath & 
"\backup\icons"
            Else
            oFso.CreateFolder(sScriptPath & "\backup\icons")
            oFso.CopyFolder sScriptPath & "\icons", sScriptPath & 
"\backup\icons"
            End If
            'Copy .inf file from last script run to backup folder, then clean 
up icon directory
            If oFso.FileExists(sScriptPath & "\" & theFarm.FarmName 
&"_Applications.inf") Then
            oFso.CopyFile sScriptPath & "\" & theFarm.FarmName 
&"_Applications.inf", sScriptPath & "\backup\"
            oFso.DeleteFile sScriptPath & "\icons\*.*"
            End If
            '
            '
            'Set output file
            Set output = oFso.OpenTextFile(sScriptPath & "\" & theFarm.FarmName 
&"_Applications.inf", 2, True)
            '            '
            ' Are you Citrix Administrator?
            '

            if theFarm.WinFarmObject.IsCitrixAdministrator = 0 then
                WScript.Echo "You must be a Citrix admin to run this script" 
                WScript.Echo ""
                WScript.Quit 0
            End If

            '
            ' Print out the farm name.
            '

            WScript.Echo "MetaFrame Farm Name: " & theFarm.FarmName
            WScript.Echo ""
            '
            '
            '
            'Loop through all applications in the farm 

            For Each anApp In theFarm.Applications
            Set aWinApp = anApp.WinAppObject

                if Err.Number <> 0 Then
                    WScript.Echo "Can't enumerate applications"
                    WScript.Echo "(" & Err.Number & ") " & Err.Description
                    WScript.Echo ""
                    WScript.Quit Err.Number
                End if
              output.writeline "[Application]"
              'if aWinApp.PNAttributes equals MFWinAppDesktop then it is a 
published desktop
              If aWinApp.PNAttributes AND MFWinAppDesktop Then
              WScript.Echo "Application Name: " & anApp.AppName
              output.writeline "AppName=" & anApp.AppName
              WScript.Echo "Description: " & anApp.Description
              output.writeline "Description=" & anApp.Description
              WScript.Echo "Distinguished Name: " & 
Replace(anApp.DistinguishedName,"/","\")
              output.writeline "DistinguishedName=" & 
Replace(anApp.DistinguishedName,"/","\")
              WScript.Echo "Command Line: " & "Published Desktop"
              output.writeline "DefaultInitProg=" & "PublishedDesktop"
              WScript.Echo "MetaFrame Attribute: " & aWinApp.MFAttributes
              output.writeline "MFAttributes=" & aWinApp.MFAttributes
              WScript.Echo "PN Attribute: " & aWinApp.PNAttributes
              output.writeline "PNAttributes=" & aWinApp.PNAttributes
                        If aWinApp.PNFolder <> "" Then
                        WScript.Echo "Program Neighborhood Folder: " & 
aWinApp.PNFolder
                        output.writeline "PNFolder=" & aWinApp.PNFolder
                        End If
              
              WScript.Echo "Encryption: " & aWinApp.DefaultEncryption
              output.writeline "DefaultEncryption=" & aWinApp.DefaultEncryption
              WScript.Echo "Sound Type: " & aWinApp.DefaultSoundType
              output.writeline "DefaultSoundType=" & aWinApp.DefaultSoundType
              WScript.Echo "Window Color: " & aWinApp.DefaultWindowColor
              output.writeline "DefaultWindowColor=" & 
aWinApp.DefaultWindowColor
              WScript.Echo "Window Size: " & aWinApp.DefaultWindowType
              output.writeline "DefaultWindowType=" & aWinApp.DefaultWindowType
              WScript.Echo "Parent Folder: " & aWinApp.ParentFolderDN
              output.writeline "ParentFolderDN=" & aWinApp.ParentFolderDN
              WScript.Echo "Desktop Integrate: " & aWinApp.DesktopIntegrate
              output.writeline "DesktopIntegrate=" & aWinApp.DesktopIntegrate
              WScript.Echo "Wait on Printer: " & aWinApp.WaitOnPrinterCreation
              output.writeline "WaitOnPrinterCreation=" & 
aWinApp.WaitOnPrinterCreation
              WScript.Echo "Multi Instance: " & 
aWinApp.AllowMultiInstancePerUser
              output.writeline "AllowMultiInstancePerUser=" & 
aWinApp.AllowMultiInstancePerUser
              WScript.Echo "Instance Limit: " & aWinApp.InstanceLimit
              output.writeline "InstanceLimit=" & aWinApp.InstanceLimit
              WScript.Echo "Add Shortcut: " & aWinApp.AddShortcutToClientDesktop
              output.writeline "AddShortcutToClientDesktop=" & 
aWinApp.AddShortcutToClientDesktop
              WScript.Echo "Add to Start Menu: " & aWinApp.AddToClientStartMenu
              output.writeline "AddToClientStartMenu=" & 
aWinApp.AddToClientStartMenu
              WScript.Echo "Default Sound Type: " & aWinApp.DefaultSoundType
              output.writeline "DefaultSoundType=" & aWinApp.DefaultSoundType
              WScript.Echo "Enable SSL: " & aWinApp.EnableSSLConnections
              output.writeline "EnableSSLConnections=" & 
aWinApp.EnableSSLConnections
                        If aWinApp.AddToClientStartMenu <> 0 Then
                        WScript.Echo "Place Under Programs: " & 
aWinApp.PlaceUnderProgramsFolder
                        output.writeline "PlaceUnderProgramsFolder=" & 
aWinApp.PlaceUnderProgramsFolder
                        WScript.Echo "Start Menu Folder: " & 
aWinApp.StartMenuFolder
                        output.writeline "StartMenuFolder=" & 
aWinApp.StartMenuFolder
                        End If
              WScript.Echo "Enable App: " & aWinApp.EnableApp
              output.writeline "EnableApp=" & aWinApp.EnableApp
              aWinApp.WriteIconToFile sScriptPath & "\icons\" & anApp.AppName & 
".ico"
              '
              Else
              '
              WScript.Echo "Application Name: " & anApp.AppName
              output.writeline "AppName=" & anApp.AppName
              WScript.Echo "Description: " & anApp.Description
              output.writeline "Description=" & anApp.Description
              WScript.Echo "Distinguished Name: " & 
Replace(anApp.DistinguishedName,"/","\")
              output.writeline "DistinguishedName=" & 
Replace(anApp.DistinguishedName,"/","\")
              WScript.Echo "Command Line: " & aWinApp.DefaultInitProg
              output.writeline "DefaultInitProg=" & aWinApp.DefaultInitProg
              WScript.Echo "Working Directory: " & aWinApp.DefaultWorkDir
              output.writeline "DefaultWorkDir=" & aWinApp.DefaultWorkDir
              WScript.Echo "MetaFrame Attribute: " & aWinApp.MFAttributes
              output.writeline "MFAttributes=" & aWinApp.MFAttributes
              WScript.Echo "PN Attribute: " & aWinApp.PNAttributes
              output.writeline "PNAttributes=" & aWinApp.PNAttributes
                        If aWinApp.PNFolder <> "" Then
                        WScript.Echo "Program Neighborhood Folder: " & 
aWinApp.PNFolder
                        output.writeline "PNFolder=" & aWinApp.PNFolder
                        End If
              WScript.Echo "Encryption: " & aWinApp.DefaultEncryption
              output.writeline "DefaultEncryption=" & aWinApp.DefaultEncryption
              WScript.Echo "Sound Type: " & aWinApp.DefaultSoundType
              output.writeline "DefaultSoundType=" & aWinApp.DefaultSoundType
              WScript.Echo "Window Color: " & aWinApp.DefaultWindowColor
              output.writeline "DefaultWindowColor=" & 
aWinApp.DefaultWindowColor
              WScript.Echo "Window Size: " & aWinApp.DefaultWindowType
              output.writeline "DefaultWindowType=" & aWinApp.DefaultWindowType
              WScript.Echo "Parent Folder: " & aWinApp.ParentFolderDN
              output.writeline "ParentFolderDN=" & aWinApp.ParentFolderDN
              WScript.Echo "Desktop Integrate: " & aWinApp.DesktopIntegrate
              output.writeline "DesktopIntegrate=" & aWinApp.DesktopIntegrate
              WScript.Echo "Wait on Printer: " & aWinApp.WaitOnPrinterCreation
              output.writeline "WaitOnPrinterCreation=" & 
aWinApp.WaitOnPrinterCreation
              WScript.Echo "Multi Instance: " & 
aWinApp.AllowMultiInstancePerUser
              output.writeline "AllowMultiInstancePerUser=" & 
aWinApp.AllowMultiInstancePerUser
              WScript.Echo "Instance Limit: " & aWinApp.InstanceLimit
              output.writeline "InstanceLimit=" & aWinApp.InstanceLimit
              WScript.Echo "Add Shortcut: " & aWinApp.AddShortcutToClientDesktop
              output.writeline "AddShortcutToClientDesktop=" & 
aWinApp.AddShortcutToClientDesktop
              WScript.Echo "Add to Start Menu: " & aWinApp.AddToClientStartMenu
              output.writeline "AddToClientStartMenu=" & 
aWinApp.AddToClientStartMenu
              WScript.Echo "Default Sound Type: " & aWinApp.DefaultSoundType
              output.writeline "DefaultSoundType=" & aWinApp.DefaultSoundType
              WScript.Echo "Enable SSL: " & aWinApp.EnableSSLConnections
              output.writeline "EnableSSLConnections=" & 
aWinApp.EnableSSLConnections
                        If aWinApp.AddToClientStartMenu <> 0 Then
                        WScript.Echo "Place Under Programs: " & 
aWinApp.PlaceUnderProgramsFolder
                        output.writeline "PlaceUnderProgramsFolder=" & 
aWinApp.PlaceUnderProgramsFolder
                        WScript.Echo "Start Menu Folder: " & 
aWinApp.StartMenuFolder
                        output.writeline "StartMenuFolder=" & 
aWinApp.StartMenuFolder
                        End If
              WScript.Echo "Enable App: " & aWinApp.EnableApp
              output.writeline "EnableApp=" & aWinApp.EnableApp
              aWinApp.WriteIconToFile sScriptPath & "\icons\" & anApp.AppName & 
".ico"
              End If
              output.writeline
              output.writeline "[Servers]"
                                 
               'Print ServerName for the app . 
                 For Each aServer In anApp.Servers
                 
                 WScript.Echo "Server Name: " & aServer.ServerName
                 output.writeline aServer.ServerName
                 Next
              WScript.Echo ""
              output.writeline
              output.writeline "[Users]"
            For Each anUser In anApp.Users
                                    
                                        '
                                        ' MetaFrameUser object.
                                        '
                                        
                                        If nUserCount = 0 then
                                            WScript.Echo "Users            : " 
& anUser.AAName & "\" & anUser.UserName
                                            output.writeline anUser.AAName & 
"\" & anUser.UserName & "\" & anUser.AccountType
                                        Else                        
                                            WScript.Echo "                   " 
& anUser.AAName & "\" & anUser.UserName
                                            output.writeline anUser.AAName & 
"\" & anUser.UserName & "\" & anUser.AccountType
                                        End if             
                                        
                                        
                                        
                                    Next    
                                    output.writeline
                                    output.writeline "[Groups]"
                                    
                                    For Each anGroup In anApp.Groups
                                    
                                        '
                                        ' MetaFrameGroup object.
                                        '
                    
                                        If nUserCount = 0 Then
                                            WScript.Echo "Users            : " 
& anGroup.AAName & "\" & anGroup.GroupName
                                            output.writeline anGroup.AAName & 
"\" & anGroup.GroupName & "\" & anGroup.AccountType
                                        Else
                                            WScript.Echo "                   " 
& anGroup.AAName & "\" & anGroup.GroupName
                                            output.writeline anGroup.AAName & 
"\" & anGroup.GroupName & "\" & anGroup.AccountType
                                        End If    
                                        
                                        
                                        
                                    Next
                                    WScript.Echo
                                    WScript.Echo
                                    output.writeline "[End Application]"
                                    output.writeline
                                    
            
            Next
            
            
           
            
            
        </script>
    </job>
</package>
<package>
    <job id="FarmAppRestore">

        <comment>

            FarmAppRestore.wsf

            This script requires Windows Scripting Host 5.5 or higher.
            You will be prompted for the name of the .inf file to restore from; 
this file
            should be located in the same directory you are running the script 
from.  When prompted,
            type in the name of the file only - for example, "MyApps.inf".
            
            Icons - application icons should be located in an "icons" folder in 
the same directory the 
            script is running from.  Ideally, these will have been generated by 
the FarmAppSave.wsf script.
            If they are provided by some other means, then give them the same 
name as the application being
            restored - for example, "MyApplicationProd.ico".
            
            This script should be run on a MetaFrame server.  Tested on XP FR3.
            
        </comment>
<reference object="MetaFrameCOM.MetaFrameFarm"/>
<script language="VBScript">
On Error Resume Next

'Set up basic scripting objects
Set oShell = WScript.CreateObject("WScript.Shell")
Set oFso = CreateObject("Scripting.FileSystemObject")
Set oWshNetwork = WScript.CreateObject("WScript.Network")
sScriptFullName = WScript.ScriptFullName
sScriptPath = Left(sScriptFullName, InStrRev(sScriptFullName, "\"))
Const ForReading = 1

'Get name of .inf file to restore from - should be in the same directory as the 
script
sFileName = InputBox("Enter the name of the file to read:","Information Needed")

'Create Regular Expressions to delineate each section of the INF file
Set oREStart = new RegExp
Set oREServers = new RegExp
Set oREUsers = new RegExp
Set oREGroups = new RegExp
Set OREEnd = new RegExp
Set oREBlank = new RegExp

oREStart.Pattern = "^\s*\[\s*" & "Application" & "\s*\]\s*$"
oREStart.IgnoreCase = True
oREServers.Pattern = "^\s*\[\s*" & "Servers" & "\s*\]\s*$"
oREServers.IgnoreCase = True
oREUsers.Pattern = "^\s*\[\s*" & "Users" & "\s*\]\s*$"
oREUsers.IgnoreCase = True
oREGroups.Pattern = "^\s*\[\s*" & "Groups" & "\s*\]\s*$"
oREGroups.IgnoreCase = True
oREEnd.Pattern = "^\s*\[\s*" & "End Application" & "\s*\]\s*$"
oREEnd.IgnoreCase = True


'Create MFCOM farm object.
            Set myFarm = CreateObject("MetaFrameCOM.MetaFrameFarm")
            if Err.Number <> 0 Then
                WScript.Echo "Can't create MetaFrameFarm object"
                WScript.Echo "(" & Err.Number & ") " & Err.Description
                WScript.Echo ""
                WScript.Quit Err.Number
            End if

            ' Initialize the farm object.
            myFarm.Initialize(MetaFrameWinFarmObject)
            if Err.Number <> 0 Then
                WScript.Echo "Can't  Initialize MetaFrameFarm object"
                WScript.Echo "(" & Err.Number & ") " & Err.Description
                WScript.Echo ""
                WScript.Quit Err.Number
            End if

            ' Are you Citrix Administrator?
            if myFarm.WinFarmObject.IsCitrixAdministrator = 0 then
                WScript.Echo _
                    "You must be a Citrix administrator to run this script" 
                WScript.Echo ""
                WScript.Quit 0
            End If


Set oStream = oFSO.OpenTextFile(sScriptPath & "\" & sFilename, ForReading)
nState = 0
Do Until oStream.AtEndOfStream
        sLine = oStream.ReadLine
        Select Case nState
                Case 0
                        If oREStart.Test(sLine) Then
                        Wscript.echo "Reading the Application Section..."
                                         'Create a new application object.
                                        Set myApp = 
myFarm.AddApplication(MetaFrameWinAppObject)
                                        If Err.Number <> 0 Then
                                            WScript.Echo "Can't create 
application object"
                                            WScript.Echo "(" & Err.Number & ") 
" & Err.Description
                                            WScript.Echo ""
                                        End If
                                        Set theWinApp = myApp.WinAppObject
                        WScript.Echo
                        nState = 1
                        End If
                
                Case 1
                        If sLine = "" Then
                        WScript.Echo
                        WScript.Echo "Ending Application Section..."
                        WScript.Echo
                        ElseIf oREServers.Test(sLine) Then
                        Wscript.echo "Reading the Servers Section..."
                        WScript.Echo
                        nState = 2
                        Else
                        'Read line in INF file and set up variables and values, 
then apply to the application object
                        sAppVal = Split(sLine,"=")

                                Select Case sAppVal(0)
                                
                                Case "AppName"
                                sAppName = sAppVal(1)
                                myApp.AppName = sAppVal(1)
                                WScript.Echo "AppName = " & myApp.AppName
                                
                                Case "Description"
                                myApp.Description = sAppval(1)
                                WScript.Echo "Description = " & 
myApp.Description
                                
                                'Case "DistinguishedName"
                                'myApp.DistinguishedName = sAppval(1)
                                'WScript.Echo "DistinguishedName = " & 
myApp.DistinguishedName
                                
                                Case "DefaultInitProg"
                                If sAppval(1) = "PublishedDesktop" Then
                                theWinApp.PNAttributes = MFWinAppDesktop
                                WScript.Echo "theWinApp.PNAttributes = 
MFWinAppDesktop"
                                theWinApp.ReadIconFromFile sScriptPath & 
"\icons\" & myApp.AppName & ".ico", 0
                                Else
                                theWinApp.DefaultInitProg = sAppval(1)
                                WScript.Echo "DefaultInitProg = " & 
theWinApp.DefaultInitProg
                                theWinApp.ReadIconFromFile sScriptPath & 
"\icons\" & myApp.AppName & ".ico", 0
                                End If
                                
                                Case "DefaultWorkDir"
                                theWinApp.DefaultWorkDir = sAppval(1)
                                WScript.Echo "DefaultWorkDir = " & 
theWinApp.DefaultWorkDir
                                
                                Case "MFAttributes"
                                theWinApp.MFAttributes = sAppval(1)
                                WScript.Echo "MFAttributes = " & 
theWinApp.MFAttributes
                                
                                Case "PNAttributes"
                                theWinApp.PNAttributes = sAppval(1)
                                WScript.Echo "PNAttributes = " & 
theWinApp.PNAttributes
                                
                                Case "PNFolder"
                                theWinApp.PNFolder = sAppval(1)
                                WScript.Echo "PNFolder = " & theWinApp.PNFolder
                                
                                Case "DefaultEncryption"
                                theWinApp.DefaultEncryption = sAppval(1)
                                WScript.Echo "DefaultEncryption = " & 
theWinApp.DefaultEncryption
                                
                                Case "DefaultSoundType"
                                theWinApp.DefaultSoundType = sAppval(1)
                                WScript.Echo "DefaultSoundType = " & 
theWinApp.DefaultSoundType
                                
                                Case "DefaultWindowColor"
                                theWinApp.DefaultWindowColor = sAppval(1)
                                WScript.Echo "DefaultWindowColor = " & 
theWinApp.DefaultWindowColor
                                
                                Case "DefaultWindowType"
                                theWinApp.DefaultWindowType = sAppval(1)
                                WScript.Echo "DefaultWindowType = " & 
theWinApp.DefaultWindowType
                                
                                Case "ParentFolderDN"
                                If theWinApp.ParentFolder.Exists(sAppval(1)) 
Then
                                theWinApp.ParentFolderDN = sAppval(1)
                                WScript.Echo "ParentFolderDN = " & 
theWinApp.ParentFolderDN
                                Else
                                WScript.Echo sAppval(1) & " does not exist; 
setting default app folder to Applications."
                                theWinApp.ParentFolderDN = "Applications"
                                End If
                                
                                Case "DesktopIntegrate"
                                theWinApp.DesktopIntegrate = sAppval(1)
                                WScript.Echo "DesktopIntegrate = " & 
theWinApp.DesktopIntegrate
                                
                                Case "WaitOnPrinterCreation"
                                theWinApp.WaitOnPrinterCreation = sAppval(1)
                                WScript.Echo "WaitOnPrinterCreation = " & 
theWinApp.WaitOnPrinterCreation
                                
                                Case "AllowMultiInstancePerUser"
                                theWinApp.AllowMultiInstancePerUser = sAppval(1)
                                WScript.Echo "AllowMultiInstancePerUser = " & 
theWinApp.AllowMultiInstancePerUser
                                
                                Case "InstanceLimit"
                                theWinApp.InstanceLimit = sAppval(1)
                                WScript.Echo "InstanceLimit = " & 
theWinApp.InstanceLimit
                                
                                Case "AddShortcutToClientDesktop"
                                theWinApp.AddShortcutToClientDesktop = 
sAppval(1)
                                WScript.Echo "AddShortcutToClientDesktop = " & 
theWinApp.AddShortcutToClientDesktop
                                
                                Case "AddToClientStartMenu"
                                theWinApp.AddToClientStartMenu = sAppval(1)
                                WScript.Echo "AddToClientStartMenu = " & 
theWinApp.AddToClientStartMenu
                                
                                Case "DefaultSoundType"
                                theWinApp.DefaultSoundType = sAppval(1)
                                WScript.Echo "DefaultSoundType = " & 
theWinApp.DefaultSoundType
                                
                                Case "EnableSSLConnections"
                                theWinApp.EnableSSLConnections = sAppval(1)
                                WScript.Echo "EnableSSLConnections = " & 
theWinApp.EnableSSLConnections
                                
                                Case "PlaceUnderProgramsFolder"
                                theWinApp.PlaceUnderProgramsFolder = sAppval(1)
                                WScript.Echo "PlaceUnderProgramsFolder = " & 
theWinApp.PlaceUnderProgramsFolder
                                
                                Case "StartMenuFolder"
                                theWinApp.StartMenuFolder = sAppval(1)
                                WScript.Echo "StartMenuFolder = " & 
theWinApp.StartMenuFolder
                                
                                Case "EnableApp"
                                theWinApp.EnableApp = sAppval(1)
                                WScript.Echo "EnableApp = " & 
theWinApp.EnableApp
                                
                                End Select
                                
                        End If
                        
                Case 2
                        If sLine = "" Then
                        WScript.Echo
                        WScript.Echo "Ending Servers Section..."
                        WScript.Echo
                        ElseIf oREUsers.Test(sLine) Then
                        Wscript.echo "Reading the Users Section..."
                        WScript.Echo
                        nState = 3
                        Else
                        Set AppSrv = 
CreateObject("MetaFrameCOM.MetaFrameAppSrvBinding")
                        AppSrv.Initialize MetaFrameWinSrvObject, sLine, 
myApp.DistinguishedName
                        theWinApp.AddServer AppSrv
                        WScript.Echo "Adding server " & sLine
                        End If
                Case 3
                        If sLine = "" Then
                        WScript.Echo
                        WScript.Echo "Ending Users Section..."
                        WScript.Echo
                        ElseIf oREGroups.Test(sLine) Then
                        Wscript.echo "Reading the Groups Section..."
                        WScript.Echo
                        nState = 4
                        Else
                        sUserVal = Split(sLine,"\")
                        theWinApp.AddUser MFAccountAuthorityNTDomain, 
sUserVal(0), sUserVal(2), sUserVal(1)
                        WScript.Echo "Adding user " & sUserVal(0) & "\" & 
sUserVal(1)
                        End If
                Case 4
                        If oREEnd.Test(sLine) Then
                        WScript.Echo
                        WScript.Echo "Ending Groups Section..."
                        WScript.Echo
                        WScript.Echo "Saving Application..."
                        ' Create the published application.
                                        myApp.SaveData
                                        If Err.Number <> 0 Then
                                        WScript.Echo "Can't create " & AppName
                                        WScript.Echo "(" & Err.Number & ") " & 
Err.Description
                                        WScript.Echo ""
                                        Err.Clear
                                        Else
                                        WScript.Echo AppName & " created 
successfully!"
                                        End If
                                        Set myApp = Nothing
                                        Set theWinApp = Nothing
                                        
                        WScript.Echo
                        WScript.Echo "Application complete"
                        WScript.Echo
                        nState = 5
                        Else
                        sGroupVal = Split(sLine,"\")
                        theWinApp.AddUser MFAccountAuthorityNTDomain, 
sGroupVal(0), sGroupVal(2), sGroupVal(1)
                        WScript.Echo "Adding group " & sGroupVal(0) & "\" & 
sGroupVal(1)
                        End If
                Case 5
                        nState = 0
                        
        End Select
        
Loop
Set oStream = Nothing
Set oREStart = Nothing
Set oREEND = Nothing


</script>

    </job>

</package>

Other related posts: