Page:
Overview of NuGet and Powershell modules
Clone
2
Overview of NuGet and Powershell modules
Gabe edited this page 2026-07-01 18:14:40 +00:00
What is NuGet?
- NuGet is officially a Microsoft tool. Its the official package manager for the .NET ecosystem.
- Nuget is a tool for packaging code into packages for easy sharing and distribution.
- A NuGet package is a single ZIP file with the .nupkg extension and a descriptive manifest that includes information like the package's version number.
- Basic use case is to create packages and then publish them to a public or private host.
https://learn.microsoft.com/en-us/nuget/what-is-nuget
What is a Powershell Module?
- A module is a self-contained, reusable unit that can include cmdlets, providers, functions, variables, and other resources.
- Powershell module requires two files. A .psm1 file (module implementation) and .psd1 file (module manifest)
- Module Manifest: A .psd1 file that contains metadata about your module, such as its version, author, and dependencies. This file is essential for distributing your module.
- Module Implementation/Script: A .psm1 file that containers cmdlets, functions, variables, etc.
https://learn.microsoft.com/en-us/powershell/scripting/developer/module/understanding-a-windows-powershell-module?view=powershell-7.5
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_modules?view=powershell-7.5
Why use it?
- To allow for an easier way to distribute Powershell code to servers from Gitlab.
- Using this will allow all the benefits of creating Powershell scripts and functions in Gitlab with an easier method to get said code to your servers.
- Not only can it be used to get newly created scripts and functions to your servers, but I can be used to keep the code up to date from Gitlab. (NuGet supports versioning, allowing you to manage and distribute different versions of your module).
- Another benefit of this system is reusing functions across scripts will be easier and maintainable.
- Distribution will be used through a NuGet repo so all servers will have access and can stay hardened without opening up unnecessary access.
How is it going to be used? (High level overview of the process)
- Powershell functions will get coded into a Powershell module
- Manifest file is created for the module with information like author, description, version number.
- Powershell module (with manifest file) will be packaged in a NuGet package.
- NuGet package is published to the NuGet repository.
- Engineers can add the Nuget repo to their servers and pull any module.