Skip to content

Commit eee827f

Browse files
author
Robin Stolpe
committed
fixed bug with ps7 and appx
1 parent 406be93 commit eee827f

5 files changed

Lines changed: 13 additions & 5 deletions

File tree

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,14 @@
6161
#
6262
[string]$VCLibsOutFile = "$env:TEMP\Microsoft.VCLibs.140.00.$($Arch).appx"
6363

64+
# Importing appx with -usewindowspowershell if your using PowerShell 7 or higher
65+
if ($PSVersionTable.PSVersion.Major -ge 7) {
66+
import-module appx -usewindowspowershell
67+
Write-Output "== This messages is expected if you are using PowerShell 7 or higher =="
68+
}
6469

6570
# Getting system information
6671
[System.Object]$SysInfo = Get-RSInstallInfo
67-
6872
# If user has choosen to skip the WinGet version don't check, if WinGet is not installed this will install WinGet anyway.
6973
if ($SkipVersionCheck -eq $false -or $SysInfo.WinGet -eq "0.0.0.0") {
7074
Confirm-RSWinGet -GitHubUrl $GitHubUrl -GithubHeaders $GithubHeaders -WinGet $SysInfo.WinGet

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.1.1"
12+
[string]$Version = "0.1.2"
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.1.1'
39+
ModuleVersion = '0.1.2'
4040

4141
# Supported PSEditions
4242
# CompatiblePSEditions = @()

WinSoftwareUpdate/WinSoftwareUpdate.psm1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,14 @@ Function Update-RSWinSoftware {
8484
#
8585
[string]$VCLibsOutFile = "$env:TEMP\Microsoft.VCLibs.140.00.$($Arch).appx"
8686

87+
# Importing appx with -usewindowspowershell if your using PowerShell 7 or higher
88+
if ($PSVersionTable.PSVersion.Major -ge 7) {
89+
import-module appx -usewindowspowershell
90+
Write-Output "== This messages is expected if you are using PowerShell 7 or higher =="
91+
}
8792

8893
# Getting system information
8994
[System.Object]$SysInfo = Get-RSInstallInfo
90-
9195
# If user has choosen to skip the WinGet version don't check, if WinGet is not installed this will install WinGet anyway.
9296
if ($SkipVersionCheck -eq $false -or $SysInfo.WinGet -eq "0.0.0.0") {
9397
Confirm-RSWinGet -GitHubUrl $GitHubUrl -GithubHeaders $GithubHeaders -WinGet $SysInfo.WinGet

test/PSScriptAnalyzer_WinSoftwareUpdate.psm1_2023-01-18.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ RuleSuppressionID :
1111
SuggestedCorrections :
1212
IsSuppressed : False
1313

14-
Line : 307
14+
Line : 311
1515
Column : 10
1616
Message : Function 'Start-RSWinGet' has verb that could change system state. Therefore, the function has to support 'ShouldProcess'.
1717
Extent : Start-RSWinGet

0 commit comments

Comments
 (0)