Husnu

//Husnu
Husnu

Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • Husnu
    Participant
    Post count: 5

    Hi Gary,

    It seems like the code that I posted is not displayed properly. For some reason, the symbols and quotes were replaced by some garbage. Here is a screenshot of that section.

    http://screencast.com/t/Ij8NdGg7

    I can also send you the code, if you still have problems figuring out by yourself.

  • Husnu
    Participant
    Post count: 5
  • Husnu
    Participant
    Post count: 5

    Hello,

    We also needed to name our installation scripts as well as the stub EXE based on our package naming standards and SOPs. So, we ended up adding three more lines (specified in the partial code below) to DeployApplication.cs and recompiled into EXE with those changes. This change allows us to rename Deploy-Application.EXE to any package name we want and it will look for PS1 file with the same name in the same folder. For example,
    When “Adobe Acrobat XI.EXE” is executed it will look for “Adobe Acrobat XI.PS1” in the same folder by default.

    As a side note, it would also be nice to have the ability to pass our custom command line arguments to Deploy-Application.EXE which wil in turn pass that to the PS1 file (i.e. similar to %CMDLINE% in WiseScript). Regards.

    https://psappdeploytoolkit.codeplex.com/SourceControl/latest#Sources/Deploy-Application/Deploy-Application/DeployApplication.cs

    <code>
    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.IO;
    using System.Xml;
    using System.Windows.Forms;
    using System.Reflection;
    
    namespace PSAppDeployToolkit
    {
        static class DeployApplication
        {
            public static void Main()
            {
                try
                {
                    // Set up variables
                    int processExitCode = 60010;
                    string currentAppPath = new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath;
                    string currentAppFolder = Path.GetDirectoryName(currentAppPath);
                    string appDeployScriptPath = Path.Combine(currentAppFolder, &quot;Deploy-Application.ps1&quot;);
                    string appDeployToolkitFolder = Path.Combine(currentAppFolder, &quot;AppDeployToolkit&quot;);
                    string appDeployToolkitXMLPath = Path.Combine(appDeployToolkitFolder, &quot;AppDeployToolkitConfig.xml&quot;);
                    string powershellExePath = Path.Combine(Environment.GetEnvironmentVariable(&quot;WinDir&quot;), &quot;System32\\WindowsPowerShell\\v1.0\\PowerShell.exe&quot;);
                    string powershellArgs = &quot;-ExecutionPolicy Bypass -NoProfile -NoLogo -WindowStyle Hidden&quot;;
                    List&lt;string&gt; commandLineArgs = new List&lt;string&gt;(Environment.GetCommandLineArgs());
                    bool isForceX86Mode = false;
                    bool isRequireAdmin = false;
    
                    // Additional Customizations: 
                    string appDeployStub = Path.GetFileNameWithoutExtension(currentAppPath);
                    string appDeployScriptName = appDeployStub + &quot;.ps1&quot;;
                    appDeployScriptPath = Path.Combine(currentAppFolder, appDeployScriptName);
                    // End of Customizations
    </code>
    • This reply was modified 2 years, 2 months ago by  Husnu.
    • This reply was modified 2 years, 2 months ago by  Husnu.
    • This reply was modified 2 years, 2 months ago by  Husnu.
    • This reply was modified 2 years, 2 months ago by  Husnu.
    • This reply was modified 2 years, 2 months ago by  Husnu.
    • Husnu
      Participant
      Post count: 5

      Never mind my side note above. You can already do that. 🙂

Viewing 4 posts - 1 through 4 (of 4 total)