Add script for publishing to PowerShell Gallery

This commit is contained in:
Alphaeus Mote
2025-05-09 14:37:56 -04:00
parent 7478796d16
commit 060ab64d70
2 changed files with 74 additions and 18 deletions
+39
View File
@@ -0,0 +1,39 @@
# Publish-PSProxmoxToGallery.ps1
# This script publishes the PSProxmox module to the PowerShell Gallery.
param(
[Parameter(Mandatory = $true)]
[string]$ApiKey,
[Parameter(Mandatory = $false)]
[string]$Version = (Get-Date -Format "yyyy.MM.dd.HHmm")
)
# Ensure the module is built
Write-Host "Building the module..."
& "$PSScriptRoot\build-release-only.ps1"
# Get the release directory
$releaseDir = Join-Path -Path (Split-Path -Parent $PSScriptRoot) -ChildPath "Release\$Version"
if (-not (Test-Path -Path $releaseDir)) {
Write-Error "Release directory not found: $releaseDir"
exit 1
}
# Publish the module to PowerShell Gallery
Write-Host "Publishing module to PowerShell Gallery..."
try {
Publish-Module -Path $releaseDir -NuGetApiKey $ApiKey -Verbose
Write-Host "Module published successfully!" -ForegroundColor Green
}
catch {
Write-Error "Failed to publish module: $_"
exit 1
}
# Open the PowerShell Gallery page
$moduleName = "PSProxmox"
Start-Process "https://www.powershellgallery.com/packages/$moduleName"
Write-Host "Done!"
+35 -18
View File
@@ -1,27 +1,44 @@
# PSProxmox v2025.05.09.1246 Release Notes
# PSProxmox v2025.05.10.1000 Release Notes
## New Features
### VM Creation Enhancements
- Added padded counter functionality for multi-VM creation (e.g., "Prefix-00001")
- Added AutoSMBIOS capability parameters for setting realistic hardware information
- Added Microsoft VMBIOS profile for SMBIOS settings
- Enhanced existing manufacturer profiles with more business-class workstations and servers
- Improved serial number generation for major non-VM vendors
### Automatic Connection Handling
- Added automatic connection handling so cmdlets use the default connection without explicitly passing it
- Added a global `DefaultProxmoxConnection` variable that stores the most recent connection
- Created a base `ProxmoxCmdlet` class that all cmdlets can inherit from
- Updated all cmdlets to use the base class and make the Connection parameter optional
### SMBIOS Improvements
- Only generate random UUIDs if one is not already present
- Added more realistic hardware information for Dell, HP, Lenovo, and Microsoft devices
- Added support for both server and workstation profiles for each manufacturer
### Test-ProxmoxConnection Cmdlet
- Added a new cmdlet to test if a connection is valid and active
- Added a `-Detailed` parameter to get comprehensive connection information
- The cmdlet can test either a specified connection or the default connection
## Documentation
- Added comprehensive documentation for the new features
- Added example scripts for using padded counters and SMBIOS settings
- Updated existing documentation to reflect the new capabilities
### Connection Object Improvements
- Added a custom `ToString()` method to the `ProxmoxConnection` class
- The connection now displays as "Proxmox Connection: username@realm on server:port (Authenticated)"
- This makes it easier to see connection details in the console
## Bug Fixes
- Fixed module loading issues by using PSM1 file and NestedModules
- Fixed type mismatch between ProxmoxConnectionInfo and ProxmoxConnection classes
### Documentation Updates
- Updated all documentation and examples to use the new automatic connection handling
- Added documentation for the new `Test-ProxmoxConnection` cmdlet
- Updated the README.md examples to use the default connection
## Usage Examples
**Old way (explicit connection):**
```powershell
$connection = Connect-ProxmoxServer -Server "proxmox.example.com" -Credential (Get-Credential)
$vms = Get-ProxmoxVM -Connection $connection
Disconnect-ProxmoxServer -Connection $connection
```
**New way (automatic connection):**
```powershell
Connect-ProxmoxServer -Server "proxmox.example.com" -Credential (Get-Credential)
$vms = Get-ProxmoxVM
$connection = Test-ProxmoxConnection -Detailed
Disconnect-ProxmoxServer -Connection $connection
```
## Installation
1. Download the ZIP file