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

    WinGet installation as a snapin

    Scheduled Pinned Locked Moved
    Tutorials
    1
    2
    628
    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.
    • R
      RipAU
      last edited by

      Hi, everyone.

      Hopefully this is useful for a few people.

      I’ve written a wrapper around with Python to be able to run the WinGet command from the Snap-In tasks with some commands forced (accepting agreement, source, ect. when installing.
      I’ve created this due to WinGet changing its location based on its version, no doubt there was an easier way to do this, but figured I’d try learning something different with Python.

      It is fairly easy to use, and you would need to convert the script into an executable with a program such as Auto-Py-to-Exe so it doesn’t have any Python requirements on the host device.

      After the script is converted into a binary, you can either re-name it, use it in a snap-in pack and call it like you would regular Winget commands.
      The only additional argument is the logging to a file. If calling the script without logging it is just outputted to the standard output.
      Otherwise installing and logging to the fog.log for example.

      PyWinGet.exe --log c:\fog.log install notepad++ -s winget
      

      When logging, it needs to be set before the WinGet commands.

      Anyway, it can be found in my Fog Snap in folder on GitHub.

      https://github.com/mediocreatmybest/FOG-O-Matic/blob/main/FOG-Snapins/PyWinGet.py

      FYI, Winget isn’t the best program to pipe into a text file due to its usage of progress bars that you can’t switch off, but it is still readable.

      1 Reply Last reply Reply Quote 0
      • R
        RipAU
        last edited by

        Copy and pasted for the Chocolatey wrapper ChocolatePy
        Pretty much same same. Just Chocolatey won’t neccessarily give an error on the exit code on failure if a program is already installed.

        https://github.com/mediocreatmybest/FOG-O-Matic/blob/main/FOG-Snapins/ChocolatePy.py

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

        145

        Online

        12.0k

        Users

        17.3k

        Topics

        155.2k

        Posts
        Copyright © 2012-2024 FOG Project