• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Snapin without file / Just execute command?

    Scheduled Pinned Locked Moved
    Feature Request
    4
    7
    857
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Mirfster
      last edited by

      First all, I would like to thank everyone for such a great product. I am new to FOG, but have tons of experience packaging/scripting applications for deployment using other Application Management Solutions (Altiris, SCCM, etc).

      Anyways, I have been doing some testing and really do like the Snapins. However, I have noticed that there is not a simple way to just have it execute a command locally without attaching a “Snapin File”?

      For reference, I wrap all applications in an “Install.vbs”. What this does in a nutshell is handle all of the heavy lifting and is location aware. So at the end of the day whatever deployment mechanism is used the command is the same: CScript.exe “Install.vbs” (of course the “Working Directory” or “Start-In” is also set at creation)

      Anyways, is it possible to have a Snapin simply run the command like: CScript.exe “\%NetworkShare%%ApplicationFolder%\Install.vbs”; without having to attach any file?

      I already have successfully tested that I can editing the “Install.vbs” so that it does set the variables to the network path, but in the end it would be preferable to just be able to call it directly and leverage the already scripted vbs.

      Also, this would come in handy for quick configurations where one simply wanted to issue a command without having to make a Batch/VBS/PS1/Etc.

      Apologies in advance for my long winded question and if this is already available that I simply overlooked.

      Wayne WorkmanW 1 Reply Last reply Reply Quote 0
      • Wayne WorkmanW
        Wayne Workman @Mirfster
        last edited by Wayne Workman

        @mirfster It’s currently not possible. Someone else before you asked for this also. The easiest thing to do is just put your command in a script and deploy that script. Going to ping @joe-schmitt to look at this though.

        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
        Daily Clean Installation Results:
        https://fogtesting.fogproject.us/
        FOG Reporting:
        https://fog-external-reporting-results.fogproject.us/

        M 1 Reply Last reply Reply Quote 0
        • M
          Mirfster @Wayne Workman
          last edited by

          @wayne-workman Thanks for the quick response. For now, I will simply make a copy of my “Install.vbs” and name it “FogInstall.vbs” with the modifications.

          1 Reply Last reply Reply Quote 0
          • A
            altitudehack
            last edited by

            I realize this is an oldie but as a feature request it made sense to me to just bump it rather than creating a new one.
            I have a program installed that has a built-in uninstaller. I’d like to execute uninstall.exe /S to remove it, however the snapin needs to add a file in order to do so. Guess I could just upload a script with this command in it but it seems much simpler to just allow running a command.
            Thanks!

            JJ FullmerJ 1 Reply Last reply Reply Quote 0
            • JJ FullmerJ
              JJ Fullmer Testers @altitudehack
              last edited by

              @altitudehack The supported workaround would be to use 1 universal script that can just take the arguments of a command.
              i.e. a simple powershell script like this

              [CmdletBinding()]
              param (
                  [string]$exe,
                  [string]$argz
              )
              
              start-process -filepath "$exe" -arguments "$argz"
              

              There might be more needed there, but that’s the general idea.
              Then you just use that same script each time you need it. Then lets say you call it runCmd.ps1

              you would make a snapin with the powershell template and that runCmd.ps1 (once uploaded once you can create snapins with the existing file)
              In the snapin arguments field you would put something like -exe "C:\program files\some program\uninstall.exe" -argz "/S"

              Have you tried the FogApi powershell module? It's pretty cool IMHO
              https://github.com/darksidemilk/FogApi
              https://fogapi.readthedocs.io/en/latest/
              https://www.powershellgallery.com/packages/FogApi
              https://forums.fogproject.org/topic/12026/powershell-api-module

              1 Reply Last reply Reply Quote 0
              • A
                altitudehack
                last edited by

                That’s awesome! I was hoping there was a simple workaround.
                It does look like it completed successfully in seven seconds, but the process didn’t have the expected result. When I run Uninstall.exe /S manually the folder gets emptied. In this case, the files are still present.

                Any tips on increasing verbosity or leaving a log of what happened?

                Thanks!

                A 1 Reply Last reply Reply Quote 0
                • A
                  altitudehack @altitudehack
                  last edited by

                  Haven’t really found a great fix here, I’d love to get some logging to work. But this seems to be working better than before. It moves the argument from the calling command and embeds it into the Snapin Arguments:

                  • Snapin Type: Normal Snapin
                  • Snapin Run With: powershell.exe
                  • Snapin File (exists): runCmd.ps1
                  • Snapin Arguments: "%ProgramFiles%\FusionInventory-Agent\Uninstall.exe /S"

                  the command in runCmd.ps1 then no longer passes an argument so needs to be changed to:
                  start-process -filepath "$exe"

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post

                  248

                  Online

                  12.0k

                  Users

                  17.3k

                  Topics

                  155.2k

                  Posts
                  Copyright © 2012-2024 FOG Project