From 060ab64d7034c3dcdda84579852100bd2f7c320a Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 9 May 2025 14:37:56 -0400 Subject: [PATCH] Add script for publishing to PowerShell Gallery --- Scripts/Publish-PSProxmoxToGallery.ps1 | 39 +++++++++++++++++++ release-notes.md | 53 +++++++++++++++++--------- 2 files changed, 74 insertions(+), 18 deletions(-) create mode 100644 Scripts/Publish-PSProxmoxToGallery.ps1 diff --git a/Scripts/Publish-PSProxmoxToGallery.ps1 b/Scripts/Publish-PSProxmoxToGallery.ps1 new file mode 100644 index 0000000..da05171 --- /dev/null +++ b/Scripts/Publish-PSProxmoxToGallery.ps1 @@ -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!" diff --git a/release-notes.md b/release-notes.md index 8f468e1..821aab8 100644 --- a/release-notes.md +++ b/release-notes.md @@ -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