Skip to content

Commit a542300

Browse files
author
Robin Stolpe
authored
Merge pull request #5 from rstolpe/dev
Fixed param issue
2 parents d900e78 + cf76b92 commit a542300

8 files changed

Lines changed: 17 additions & 14 deletions

File tree

.src/private/function/Confirm-RSWinGet.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@
3636
[string]$GitHubUrl,
3737
[Parameter(Mandatory = $true, HelpMessage = "The headers and API version for the GitHub API")]
3838
[hashtable]$GithubHeaders,
39-
[Parameter(Mandatory = $true, HelpMessage = "Information about the installed version of WinGet")]
39+
[Parameter(Mandatory = $false, HelpMessage = "Information about the installed version of WinGet")]
4040
[string]$WinGet
4141
)
4242

43-
if ($null -eq $WinGet) {
43+
if ($WinGet -eq "No") {
4444
Write-Output = "WinGet is not installed, downloading and installing WinGet..."
4545
}
4646
else {

.src/private/function/Get-RSInstallInfo.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
# Collects everything in pscustomobject to get easier access to the information
5555
[System.Object]$SysInfo = [PSCustomObject]@{
5656
VCLibs = $(Get-AppxPackage -Name "Microsoft.VCLibs.140.00" -AllUsers | Where-Object { $_.Architecture -eq $Arch })
57-
WinGet = $(try { (Get-AppxPackage -Name Microsoft.DesktopAppInstaller).version } catch { $Null })
57+
WinGet = $(try { (Get-AppxPackage -Name Microsoft.DesktopAppInstaller).version } catch { "No" })
5858
VisualCRedistUrl = $VisualCRedistUrl
5959
$VCLibsUrl = $VCLibsUrl
6060
Arch = $Arch

.src/public/function/Update-RSWinSoftware.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
[System.Object]$SysInfo = Get-RSInstallInfo
6767

6868
# If user has choosen to skip the WinGet version don't check, if WinGet is not installed this will install WinGet anyway.
69-
if ($SkipVersionCheck -eq $false -or $null -eq $SysInfo.WinGet) {
70-
Confirm-RSWinGet -GitHubUrl $GitHubUrl -GithubHeaders $GithubHeaders
69+
if ($SkipVersionCheck -eq $false -or $SysInfo.WinGet -eq "No") {
70+
Confirm-RSWinGet -GitHubUrl $GitHubUrl -GithubHeaders $GithubHeaders -WinGet $SysInfo.WinGet
7171
}
7272

7373
# If VCLibs are not installed it will get installed

Help/Confirm-RSWinGet.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ SYNOPSIS
88

99

1010
SYNTAX
11-
Confirm-RSWinGet [-GitHubUrl] <String> [-GithubHeaders] <Hashtable> [-WinGet] <String> [<CommonParameters>]
11+
Confirm-RSWinGet [-GitHubUrl] <String> [-GithubHeaders] <Hashtable> [[-WinGet] <String>] [<CommonParameters>]
1212

1313

1414
DESCRIPTION
@@ -37,7 +37,7 @@ PARAMETERS
3737

3838
-WinGet <String>
3939

40-
Required? true
40+
Required? false
4141
Position? 3
4242
Default value
4343
Accept pipeline input? false

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ This module will let you update your installed software with WinGet, many of the
88
This module is perfect for people like me that are to lazy to update every singel software all the time, it's much easier to just run a PowerShell Script.
99
I have added the result from PSScriptAnalyzer in [test folder](https://github.com/rstolpe/WinSoftwareUpdate/tree/main/test) I have some ShouldProcess warnings in this module but that's nothing to worry about really.
1010

11+
# Note
12+
This module are only supported with PowerShell 5.1 because of limitation for the Appx module.
13+
1114
## This module can do the following
1215
- Check what platform your currently running and adapt the downloads for that, if your running x86, amd64, arm64.
1316
- Make sure that you have WinGet installed and up to date, if it's not the module will install / update it for you to the latest version.

RSModuleBuilder.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
[string]$apiKey = ""
1010
#
1111
# Changes on every build
12-
[string]$Version = "0.0.3"
12+
[string]$Version = "0.0.4"
1313
[string]$PowerShellVersion = "5.1"
1414
[string]$Tags = '"windows", "maintenance", "autoupdate", "autoupdate-script", "psmodule", "update", "winget", "windows10", "windows11"'
1515
[string]$ProcessorArchitecture = ""

WinSoftwareUpdate/WinSoftwareUpdate.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
RootModule = '.\WinSoftwareUpdate.psm1'
3737

3838
# Version number of this module.
39-
ModuleVersion = '0.0.3'
39+
ModuleVersion = '0.0.4'
4040

4141
# Supported PSEditions
4242
# CompatiblePSEditions = @()

WinSoftwareUpdate/WinSoftwareUpdate.psm1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ Function Update-RSWinSoftware {
8989
[System.Object]$SysInfo = Get-RSInstallInfo
9090

9191
# If user has choosen to skip the WinGet version don't check, if WinGet is not installed this will install WinGet anyway.
92-
if ($SkipVersionCheck -eq $false -or $null -eq $SysInfo.WinGet) {
93-
Confirm-RSWinGet -GitHubUrl $GitHubUrl -GithubHeaders $GithubHeaders
92+
if ($SkipVersionCheck -eq $false -or $SysInfo.WinGet -eq "No") {
93+
Confirm-RSWinGet -GitHubUrl $GitHubUrl -GithubHeaders $GithubHeaders -WinGet $SysInfo.WinGet
9494
}
9595

9696
# If VCLibs are not installed it will get installed
@@ -139,11 +139,11 @@ Function Confirm-RSWinGet {
139139
[string]$GitHubUrl,
140140
[Parameter(Mandatory = $true, HelpMessage = "The headers and API version for the GitHub API")]
141141
[hashtable]$GithubHeaders,
142-
[Parameter(Mandatory = $true, HelpMessage = "Information about the installed version of WinGet")]
142+
[Parameter(Mandatory = $false, HelpMessage = "Information about the installed version of WinGet")]
143143
[string]$WinGet
144144
)
145145

146-
if ($null -eq $WinGet) {
146+
if ($WinGet -eq "No") {
147147
Write-Output = "WinGet is not installed, downloading and installing WinGet..."
148148
}
149149
else {
@@ -244,7 +244,7 @@ Function Get-RSInstallInfo {
244244
# Collects everything in pscustomobject to get easier access to the information
245245
[System.Object]$SysInfo = [PSCustomObject]@{
246246
VCLibs = $(Get-AppxPackage -Name "Microsoft.VCLibs.140.00" -AllUsers | Where-Object { $_.Architecture -eq $Arch })
247-
WinGet = $(try { (Get-AppxPackage -Name Microsoft.DesktopAppInstaller).version } catch { $Null })
247+
WinGet = $(try { (Get-AppxPackage -Name Microsoft.DesktopAppInstaller).version } catch { "No" })
248248
VisualCRedistUrl = $VisualCRedistUrl
249249
$VCLibsUrl = $VCLibsUrl
250250
Arch = $Arch

0 commit comments

Comments
 (0)