11<#
22 MIT License
33
4- Copyright (C) 2024 Robin Stolpe .
4+ Copyright (C) 2025 Robin Widmark .
55
66 Permission is hereby granted, free of charge, to any person obtaining a copy
77 of this software and associated documentation files (the "Software"), to deal
@@ -45,24 +45,27 @@ Function Uninstall-rsModule {
4545 # This will uninstall all older versions of all modules in the system
4646
4747 . LINK
48- https://github.com/rstolpe /MaintainModule/blob/main/README.md
48+ https://github.com/rwidmark /MaintainModule/blob/main/README.md
4949
5050 . NOTES
51- Author: Robin Stolpe
52- 53- Twitter: https://twitter.com/rstolpes
54- Linkedin: https://www.linkedin.com/in/rstolpe/
55- Website/Blog: https://stolpe.io
56- GitHub: https://github.com/rstolpe
57- PSGallery: https://www.powershellgallery.com/profiles/rstolpe
51+ Author: Robin Widmark
52+ 53+ Website/Blog: https://widmark.dev
54+ X: https://x.com/widmark_robin
55+ Mastodon: https://mastodon.social/@rwidmark
56+ YouTube: https://www.youtube.com/@rwidmark
57+ Linkedin: https://www.linkedin.com/in/rwidmark/
58+ GitHub: https://github.com/rwidmark
5859 #>
5960
6061 [CmdletBinding (SupportsShouldProcess )]
6162 Param (
6263 [Parameter (Mandatory = $false , HelpMessage = " Enter the module or modules you want to uninstall older version of, if not used all older versions will be uninstalled" )]
6364 [string ]$Module ,
6465 [Parameter (Mandatory = $false , HelpMessage = " ." )]
65- [string []]$OldVersion
66+ [string []]$OldVersion ,
67+ [Parameter (Mandatory = $false , HelpMessage = " If this is used updates etc. be for prerelease" )]
68+ [bool ]$AllowPrerelease = $false
6669 )
6770
6871 Write-Output " START - Uninstall older versions of $ ( $Module ) "
@@ -71,7 +74,7 @@ Function Uninstall-rsModule {
7174 foreach ($_version in $OldVersion ) {
7275 Write-Verbose " Uninstalling version $ ( $_version ) of $ ( $Module ) ..."
7376 try {
74- Uninstall-Module - Name $Module - RequiredVersion $_version - Force - ErrorAction SilentlyContinue
77+ Uninstall-Module - Name $Module - RequiredVersion $_version - AllowPrerelease: $AllowPrerelease - Force - ErrorAction SilentlyContinue
7578 }
7679 catch {
7780 Write-Error " $ ( $PSItem.Exception ) "
@@ -224,16 +227,17 @@ Function Update-rsModule {
224227 # This will update the modules PowerCLI and ImportExcel and delete all of the old versions that are installed of PowerCLI and ImportExcel and then import the modules.
225228
226229 . LINK
227- https://github.com/rstolpe /MaintainModule/blob/main/README.md
230+ https://github.com/rwidmark /MaintainModule/blob/main/README.md
228231
229232 . NOTES
230- Author: Robin Stolpe
231- 232- Twitter: https://twitter.com/rstolpes
233- Linkedin: https://www.linkedin.com/in/rstolpe/
234- Website/Blog: https://stolpe.io
235- GitHub: https://github.com/rstolpe
236- PSGallery: https://www.powershellgallery.com/profiles/rstolpe
233+ Author: Robin Widmark
234+ 235+ Website/Blog: https://widmark.dev
236+ X: https://x.com/widmark_robin
237+ Mastodon: https://mastodon.social/@rwidmark
238+ YouTube: https://www.youtube.com/@rwidmark
239+ Linkedin: https://www.linkedin.com/in/rwidmark/
240+ GitHub: https://github.com/rwidmark
237241 #>
238242
239243 [CmdletBinding (SupportsShouldProcess )]
@@ -248,12 +252,12 @@ Function Update-rsModule {
248252 [Parameter (Mandatory = $false , HelpMessage = " Install all of the modules that has been entered in module that are not installed on the system" )]
249253 [switch ]$InstallMissing = $false ,
250254 [Parameter (Mandatory = $false , HelpMessage = " Don't check publishers certificate" )]
251- [bool ]$SkipPublisherCheck = $false ,
255+ [switch ]$SkipPublisherCheck = $false ,
252256 [Parameter (Mandatory = $false , HelpMessage = " If this is used updates etc. be for prerelease" )]
253257 [bool ]$AllowPrerelease = $false
254258 )
255259
256- Write-Output " `n === Module Maintenance - Stolpe.io 2024 ==="
260+ Write-Output " `n === Module Maintenance - Widmark.dev 2025 ==="
257261 Write-Output " Please wait, this can take some time...`n "
258262
259263 # Making sure that all needed components are installed
@@ -279,13 +283,18 @@ Function Update-rsModule {
279283 try {
280284 Write-Output " Found a newer version of $ ( $_module.Name ) , version $CollectLatestVersion "
281285 Write-Output " Updating $ ( $_module.Name ) from $ ( $_module.LatestVersion ) to version $CollectLatestVersion ..."
282- Update-Module - Name $_module.Name - Scope $Scope - AllowPrerelease:$AllowPrerelease - SkipPublisherCheck:$SkipPublisherCheck - AcceptLicense - Force
286+ if ($SkipPublisherCheck -eq $true ) {
287+ Update-Module - Name $_module.Name - Scope $Scope - AllowPrerelease:$AllowPrerelease - SkipPublisherCheck - AcceptLicense - Force
288+ }
289+ else {
290+ Update-Module - Name $_module.Name - Scope $Scope - AllowPrerelease:$AllowPrerelease - AcceptLicense - Force
291+ }
283292 Write-Output " $ ( $_module.Name ) has now been updated to version $ ( $CollectLatestVersion ) !"
284293
285294 # If switch -UninstallOldVersion has been used then the old versions will be uninstalled from the module
286295 if ($UninstallOldVersion -eq $true -and $_module.OldVersion.Count -gt 0 ) {
287- Uninstall-rsModule - Module $_module.Name - OldVersion $_module.OldVersion
288- Uninstall-rsModule - Module $_module.Name - OldVersion $_module.LatestVersion
296+ Uninstall-rsModule - Module $_module.Name - OldVersion $_module.OldVersion - AllowPrerelease: $AllowPrerelease
297+ Uninstall-rsModule - Module $_module.Name - OldVersion $_module.LatestVersion - AllowPrerelease: $AllowPrerelease
289298 }
290299 else {
291300 Write-Verbose " $ ( $_module.Name ) don't have any older versions to uninstall!"
@@ -307,7 +316,12 @@ Function Update-rsModule {
307316 if ($InstallMissing -eq $true ) {
308317 try {
309318 Write-Output " $ ( $_module.name ) are not installed, installing $ ( $_module.name ) ..."
310- Install-Module - Name $_module.name - Scope $Scope - AllowPrerelease:$AllowPrerelease - AcceptLicense - Force
319+ if ($SkipPublisherCheck -eq $true ) {
320+ Install-Module - Name $_module.name - Scope $Scope - AllowPrerelease:$AllowPrerelease - SkipPublisherCheck - AcceptLicense - Force
321+ }
322+ else {
323+ Install-Module - Name $_module.name - Scope $Scope - AllowPrerelease:$AllowPrerelease - AcceptLicense - Force
324+ }
311325 Write-Output " $ ( $_module.name ) has now been installed!"
312326 }
313327 catch {
0 commit comments