fire1ce / wingetup

Powershell script to automate the process of updateing Winget packages and exporting the installed winget packages json dump to github

Home Page:https://3os.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Winget Package Manager Automation Script

This script is designed to streamline and automate the process of updating Winget packages, exporting package configurations to a JSON file, and seamlessly integrating the changes with a Git repository. Tailored for Windows environments, this PowerShell script is an essential tool for system administrators and developers.

System Requirements

  • Windows 10 or Windows 11 operating system.
  • Windows Package Manager (Winget).
  • Git (The script is designed to install Git via Winget if it is not pre-installed).

Set-up Instructions

Repository Initialization Start by creating a new repository from this template repository. Clone the newly created repository to your local machine, selecting an appropriate directory for cloning. Use the following command by replacing with the URL of your repository:

We recommend using the SSH for communication with the remote repository.

Follow the instructions in the following link to configure your Windows ssh agent and create a ssh key pair. Windows SSH Client with ed25519 Keys for Secure Connections

Don't use HTTP:// or SSH: for cloning the repository.

Replace the clone command with git@github.com:

Example:

git clone git@github.com:/fire1ce/wingetup.git

Git Installation

If Git is not installed on your machine, use Winget to install it. Open PowerShell as an administrator and execute the following command:

winget install Git.Git

Running the Script

Navigate to the directory where your repository is cloned, and initiate the script WingetUpdater.ps1 via PowerShell:

Copy code
cd <path-to-the-repo>
.\wingetup.ps1

On running the script, the following actions will be performed:

  • Verification and installation of Git if it is not installed.
  • Synchronization with the latest changes from your Git repository.
  • In case your PowerShell execution policy is restrictive, you will be prompted to change it to 'RemoteSigned'. Consent to this prompt to enable the script.
  • Establishment of a PowerShell alias wingetup which simplifies subsequent script executions. Simply enter wingetup in PowerShell.
  • Updating of all Winget packages.
  • Exporting the package configuration to a JSON file, named using the hostname of the machine.
  • Committing and pushing the changes to your Git repository.

Script Execution

After the initial set-up, simply enter wingetup in PowerShell to execute the script:

wingetup

Package Installation From JSON Configuration

This script exports package configurations to a JSON file. To install Winget packages from an exported JSON file, execute the following command in PowerShell:

winget import -i <path-to-json-file>

Considerations

The script establishes an alias wingetup, streamlining future executions. Ensure that you possess the requisite permissions for script execution and policy modification in PowerShell. Licensing This project operates under the MIT License. For further details, please refer to the LICENSE file.

About

Powershell script to automate the process of updateing Winget packages and exporting the installed winget packages json dump to github

https://3os.org

License:Other


Languages

Language:PowerShell 100.0%