From b93cb25ad55a360a62b0137b1bf3947d2bc5835a Mon Sep 17 00:00:00 2001 From: Rui Lopes Date: Thu, 3 Sep 2026 07:33:03 +0000 Subject: [PATCH] uninstall the ExampleGreeter PowerShell module after using it --- provision/windows/use-powershell-repository.ps1 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/provision/windows/use-powershell-repository.ps1 b/provision/windows/use-powershell-repository.ps1 index 174a944..6b7d56f 100644 --- a/provision/windows/use-powershell-repository.ps1 +++ b/provision/windows/use-powershell-repository.ps1 @@ -8,8 +8,10 @@ $ConfirmPreference = 'None' Write-Host 'Default PowerShell sources:' Get-PSRepository -Write-Host 'Configuring PowerShell to only use the nexus server...' +Write-Host "Unregistering the default PowerShell sources..." Get-PSRepository | Unregister-PSRepository + +Write-Host 'Configuring PowerShell to use the nexus server...' Register-PSRepository ` -Name nexus ` -SourceLocation https://$nexusDomain/repository/powershell-group/ ` @@ -54,8 +56,13 @@ Publish-Module ` -NuGetApiKey (Get-Content c:\vagrant\shared\jenkins-nuget-api-key) Pop-Location -Write-Host 'Installing and using the ExampleGreeter module...' +Write-Host 'Installing the ExampleGreeter module...' Install-Module ExampleGreeter +Get-Module ExampleGreeter -ListAvailable | Format-List + +Write-Host 'Using the ExampleGreeter module...' Import-Module ExampleGreeter -Get-Module ExampleGreeter | Format-List Write-Greeting 'World' + +Write-Host 'Uninstalling the ExampleGreeter module...' +Uninstall-Module ExampleGreeter