From 20483c3e1ab3dd42b822845ec69091f313237f91 Mon Sep 17 00:00:00 2001 From: Kevin Larkin Date: Tue, 10 Oct 2023 12:34:33 -0700 Subject: [PATCH 1/5] Experimenting with making it easier to create configuration files using winget as a package manager --- src/prototype/WingetCreateMakeDSC.ps1 | 121 ++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 src/prototype/WingetCreateMakeDSC.ps1 diff --git a/src/prototype/WingetCreateMakeDSC.ps1 b/src/prototype/WingetCreateMakeDSC.ps1 new file mode 100644 index 00000000..f7105ac7 --- /dev/null +++ b/src/prototype/WingetCreateMakeDSC.ps1 @@ -0,0 +1,121 @@ +# This script is a prototype for quickly creating DSC files. +# + +param($inputfile) +# Bugbug this only seems to run in powershell 7, or the winget modules fail. It would be good to detect that. + +Try +{ + find-wingetpackage Microsoft.VisualStudioCode +} +catch +{ +# Missing the powershell module + Write-host Downloading winget module + # Bugbug make the path dynamic + $source = 'https://github.com/microsoft/winget-cli/releases/download/v1.5.441-preview/Microsoft.WinGet.Client-PSModule.zip' + + $destination = '.\Microsoft.WinGet.Client-PSModule.zip' + + if (-not(test-path $destination )) { + Invoke-RestMethod -Uri $source -OutFile $destination + } + $wingetmodule=".\Modules\Microsoft.WinGet.Client.psd1" + Write-host Extracting winget module to + if (-not(test-path $wingetmodule )) { + Expand-Archive -Path $destination -DestinationPath ".\modules" + } + + Import-Module .\Modules\Microsoft.WinGet.Client.psd1 + pause + +} + + + +$complete="n" +$filename = read-host "Enter the path and filename to the DSC file you want to edit or create" +while ($complete -eq "n") { + $badapp="false" + if (-not(test-Path ($filename))) {out-file $filename} else {write-host Updating file $filename} + $oldfile = get-content $filename + + $TempAppName = Read-host "Which app would you like to search for?" + +#Search for package + $wingetsearch=find-wingetpackage $TempAppName + +# Bugbug this method does not always work and may have an issue with the count. + + if ($wingetsearch.count -eq 1) { + write-host Number of Apps: $wingetsearch.count -foregroundcolor green + write-host Found $wingetsearch.name $wingetsearch.ID -foregroundcolor blue + $yn= Read-Host "Is that the you want? [y/n]" + + + + if($yn -eq "n") { + $badapp="true" + } + else { + $appname=$wingetsearch.ID + } + + } else { + $i=0 + Foreach ($row in $wingetsearch){ + $i++ + $string = "[" + $i + "]" +"|"+ $row.name +"|"+ $row.id + write-host $string + } + + write-host "Looks like you have too many choices. Choose the correct ID and we will start over." -foregroundcolor red + $number=read-host "Or type in the number of the item" + + If ($number -gt 0 -and $number -lt $wingetsearch.count) { + $appname=$wingetsearch[$number-1].id + } else { + $badapp="true" + } + } + + if ($badapp -eq "false" ){ + +#Define Variables + $resource = " - resource: Microsoft.WinGet.DSC/WinGetPackage" + + $id = " id: " + $appname + $directives= " directives:" + $description = " description: " + $wingetsearch.name + $allowPrerelease = " allowPrerelease: true" + $settings= " settings:" + $settingsid =" id: " + $appname + $source =" source: winget" + $suffix= " configurationVersion: 0.2.0" + Set-Content -Path $filename -Value "properties:" + add-Content -Path $filename -Value " resources:" + if ($oldfile.length -gt 1 ){ + #need to restore content but not add properties and suffix + foreach ($line in $oldfile) { + if ($line -ne "properties:" -and (-not($line -like "*configurationVersion*")) -and (-not($line -like "*resources:*"))){ + add-Content -Path $filename -Value $line + } + } + } + + add-Content -Path $filename -Value $resource + add-Content -Path $filename -Value $id + add-Content -Path $filename -Value $directives + add-Content -Path $filename -Value $description + add-Content -Path $filename -Value $allowPrerelease + add-Content -Path $filename -Value $settings + add-Content -Path $filename -Value $settingsid + add-Content -Path $filename -Value $source + add-Content -Path $filename -Value $suffix + + type $filename + $complete = Read-host "All done? y/n" + } +} + +Write-host Congratulations! You created $filename -foregroundcolor blue \ No newline at end of file From 18a69f9f0aeb333cf87e56c32458ae6b1558cd5b Mon Sep 17 00:00:00 2001 From: Kevin Larkin Date: Tue, 24 Oct 2023 17:42:48 -0700 Subject: [PATCH 2/5] Clean up from Ryan --- src/prototype/WingetCreateMakeDSC.ps1 | 152 ++++++++------------------ 1 file changed, 47 insertions(+), 105 deletions(-) diff --git a/src/prototype/WingetCreateMakeDSC.ps1 b/src/prototype/WingetCreateMakeDSC.ps1 index f7105ac7..e582f43c 100644 --- a/src/prototype/WingetCreateMakeDSC.ps1 +++ b/src/prototype/WingetCreateMakeDSC.ps1 @@ -1,121 +1,63 @@ # This script is a prototype for quickly creating DSC files. -# -param($inputfile) -# Bugbug this only seems to run in powershell 7, or the winget modules fail. It would be good to detect that. - -Try -{ - find-wingetpackage Microsoft.VisualStudioCode -} -catch +if ($null -eq (Get-InstalledModule -Name Microsoft.Winget.Client)) { -# Missing the powershell module - Write-host Downloading winget module - # Bugbug make the path dynamic - $source = 'https://github.com/microsoft/winget-cli/releases/download/v1.5.441-preview/Microsoft.WinGet.Client-PSModule.zip' - - $destination = '.\Microsoft.WinGet.Client-PSModule.zip' - - if (-not(test-path $destination )) { - Invoke-RestMethod -Uri $source -OutFile $destination - } - $wingetmodule=".\Modules\Microsoft.WinGet.Client.psd1" - Write-host Extracting winget module to - if (-not(test-path $wingetmodule )) { - Expand-Archive -Path $destination -DestinationPath ".\modules" - } - - Import-Module .\Modules\Microsoft.WinGet.Client.psd1 - pause - + Install-Module Microsoft.Winget.Client } - - -$complete="n" -$filename = read-host "Enter the path and filename to the DSC file you want to edit or create" -while ($complete -eq "n") { - $badapp="false" - if (-not(test-Path ($filename))) {out-file $filename} else {write-host Updating file $filename} - $oldfile = get-content $filename - - $TempAppName = Read-host "Which app would you like to search for?" - -#Search for package - $wingetsearch=find-wingetpackage $TempAppName - -# Bugbug this method does not always work and may have an issue with the count. - - if ($wingetsearch.count -eq 1) { - write-host Number of Apps: $wingetsearch.count -foregroundcolor green - write-host Found $wingetsearch.name $wingetsearch.ID -foregroundcolor blue - $yn= Read-Host "Is that the you want? [y/n]" +if ($null -eq (Get-InstalledModule -Name powershell-yaml)) +{ + Install-Module powershell-yaml +} - +[System.Collections.ArrayList]$finalPackages = @() +$configurationVersion = "0.2.0" - if($yn -eq "n") { - $badapp="true" - } - else { - $appname=$wingetsearch.ID - } +$continue = $true +while ($continue) +{ + $appId = Read-Host "What is the id of your app?" + $findResult = Find-WinGetPackage $appId - } else { - $i=0 - Foreach ($row in $wingetsearch){ - $i++ - $string = "[" + $i + "]" +"|"+ $row.name +"|"+ $row.id - write-host $string - } - - write-host "Looks like you have too many choices. Choose the correct ID and we will start over." -foregroundcolor red - $number=read-host "Or type in the number of the item" - - If ($number -gt 0 -and $number -lt $wingetsearch.count) { - $appname=$wingetsearch[$number-1].id - } else { - $badapp="true" + if ($findResult.count -ne 0) + { + $index=0 + foreach ($package in $findResult) + { + $packageDetails = "[$($index)] $($package.Name) | $($package.Id) | $($package.Version)" + Write-Host $packageDetails + $index++ } - } - if ($badapp -eq "false" ){ - -#Define Variables - $resource = " - resource: Microsoft.WinGet.DSC/WinGetPackage" - - $id = " id: " + $appname - $directives= " directives:" - $description = " description: " + $wingetsearch.name - $allowPrerelease = " allowPrerelease: true" - $settings= " settings:" - $settingsid =" id: " + $appname - $source =" source: winget" - $suffix= " configurationVersion: 0.2.0" - Set-Content -Path $filename -Value "properties:" - add-Content -Path $filename -Value " resources:" - if ($oldfile.length -gt 1 ){ - #need to restore content but not add properties and suffix - foreach ($line in $oldfile) { - if ($line -ne "properties:" -and (-not($line -like "*configurationVersion*")) -and (-not($line -like "*resources:*"))){ - add-Content -Path $filename -Value $line - } + $selection = -1 + $packageSelected = $false + while (-not($packageSelected)) + { + $selection = [int](Read-Host "Input the number of the package you want to select") + if (($selection -gt $findResult.count) -or ($selection -lt 0)) + { + Write-Host "Selection is out of range, try again." + } + else + { + $packageSelected = $true } } - add-Content -Path $filename -Value $resource - add-Content -Path $filename -Value $id - add-Content -Path $filename -Value $directives - add-Content -Path $filename -Value $description - add-Content -Path $filename -Value $allowPrerelease - add-Content -Path $filename -Value $settings - add-Content -Path $filename -Value $settingsid - add-Content -Path $filename -Value $source - add-Content -Path $filename -Value $suffix + $selectedPackage = $findResult[$selection] - type $filename - $complete = Read-host "All done? y/n" - } + $unit = @{"resource" = "Microsoft.WinGet.DSC/WinGetPackage"; "directives" = @{"description" = $selectedPackage.Name; "allowPrerelease" = $true; }; "settings" = @{"id" = $selectedPackage.Id; "source"="winget" }} + $finalPackages.Add($unit) + + $continue = (Read-Host "Would you like to add another package? [y/n]") -eq 'y' + } + else + { + Write-Host "No package found matching input criteria." -ForegroundColor DarkYellow + } } -Write-host Congratulations! You created $filename -foregroundcolor blue \ No newline at end of file +$fileName = Read-Host "Name of the configuration file (without extension)" +$filePath = Join-Path -Path (Get-Location) -ChildPath "$($fileName).yaml" +ConvertTo-Yaml @{"properties"= @{"resources"=$finalPackages; "configurationVersion"= $configurationVersion}} -OutFile $filePath -Force +Write-Host "Configuration file created at: $($filePath)" -ForegroundColor Green \ No newline at end of file From d4395c9ad89118789cb07964a6601499cb2ae483 Mon Sep 17 00:00:00 2001 From: Kevin Larkin Date: Fri, 1 Dec 2023 13:16:34 -0800 Subject: [PATCH 3/5] Updated to MOST of the great feedback from @Trenly and @mdanish-kh --- src/prototype/WingetCreateMakeDSC.ps1 | 76 ++++++++++++++++++++++----- 1 file changed, 62 insertions(+), 14 deletions(-) diff --git a/src/prototype/WingetCreateMakeDSC.ps1 b/src/prototype/WingetCreateMakeDSC.ps1 index e582f43c..29745b25 100644 --- a/src/prototype/WingetCreateMakeDSC.ps1 +++ b/src/prototype/WingetCreateMakeDSC.ps1 @@ -1,30 +1,51 @@ # This script is a prototype for quickly creating DSC files. +#Powershell 7 Required +$hostdata=host +if ($hostdata.version.major -lt 7) { + Write-host "This script requires powershell 7. You can update powershell by typing winget install Microsoft.Powershell." -ForegroundColor red + [Environment]::Exit(1) +} + +#Set output encoding to UTF-8 +$OutputEncoding = [ System.Text.Encoding]::UTF8 + if ($null -eq (Get-InstalledModule -Name Microsoft.Winget.Client)) { - Install-Module Microsoft.Winget.Client + try { Install-Module Microsoft.Winget.Client + } catch { + #Pass the exception + throw [System.Net.WebException]::new("Error retrieving powershell module: Microsoft.Winget.Client. Check that you have installed the Windows Package Manager modules correctly.", $_.Exception) + #bugbug is this good enough? + } } if ($null -eq (Get-InstalledModule -Name powershell-yaml)) { - Install-Module powershell-yaml + try { + Install-Module powershell-yaml + } catch { + #Pass the exception + throw [System.Net.WebException]::new("Error retrieving powershell module: powershell-yaml. Check that you have installed the Windows Package Manager modules correctly.", $_.Exception) + #bugbug is this good enough? + } } [System.Collections.ArrayList]$finalPackages = @() $configurationVersion = "0.2.0" $continue = $true -while ($continue) +do { - $appId = Read-Host "What is the id of your app?" + $appId = Read-Host "What is the Winget ID, or name of the package you want to add to the configuration file?" $findResult = Find-WinGetPackage $appId if ($findResult.count -ne 0) { - $index=0 + $Index=1 foreach ($package in $findResult) { - $packageDetails = "[$($index)] $($package.Name) | $($package.Id) | $($package.Version)" + $packageDetails = "[$($Index)] $($package.Name) | $($package.Id) | $($package.Version)" Write-Host $packageDetails $index++ } @@ -33,8 +54,11 @@ while ($continue) $packageSelected = $false while (-not($packageSelected)) { + write-host + # TODO: We should capture against bad value. "string" + # TODO: We should allow user to skip. Maybe hit S or X. $selection = [int](Read-Host "Input the number of the package you want to select") - if (($selection -gt $findResult.count) -or ($selection -lt 0)) + if (($selection -gt $findResult.count) -or ($selection -lt 1)) { Write-Host "Selection is out of range, try again." } @@ -44,20 +68,44 @@ while ($continue) } } - $selectedPackage = $findResult[$selection] - - $unit = @{"resource" = "Microsoft.WinGet.DSC/WinGetPackage"; "directives" = @{"description" = $selectedPackage.Name; "allowPrerelease" = $true; }; "settings" = @{"id" = $selectedPackage.Id; "source"="winget" }} - $finalPackages.Add($unit) + $selectedPackage = $findResult[$selection - 1] - $continue = (Read-Host "Would you like to add another package? [y/n]") -eq 'y' + #Specify Source + #Winget currently has 2 sources. If the ID contains a period, we will assume winget. + #otherwise it is the MSSTORE. We are not accounting for private REPOs at this time. + If ($selectedPackage.Id -like "*.*") { + $source="winget" + } else { + $source="msstore" + } + + $unit = @{"resource" = "Microsoft.WinGet.DSC/WinGetPackage"; "directives" = @{"description" = $selectedPackage.Name; "allowPrerelease" = $true; }; "settings" = @{"id" = $selectedPackage.Id; "source"=$source }} + $tempvar = $finalPackages.Add($unit) + write-host Added $selectedPackage.Name -ForegroundColor blue + + } else { Write-Host "No package found matching input criteria." -ForegroundColor DarkYellow } -} +} while ($(Read-Host "Would you like to add another package? [y/n]") -eq 'y') +Write-host $fileName = Read-Host "Name of the configuration file (without extension)" -$filePath = Join-Path -Path (Get-Location) -ChildPath "$($fileName).yaml" +$filePath = Join-Path -Path (Get-Location) -ChildPath "$($fileName).winget" + ConvertTo-Yaml @{"properties"= @{"resources"=$finalPackages; "configurationVersion"= $configurationVersion}} -OutFile $filePath -Force + +Write-Host +Write-Host Testing resulting file. -ForegroundColor yellow +(&winget configure --help) > $null + +if ($LASTEXITCODE -eq 0) { + winget configure validate --file $filePath +} +else { + Write-Host "'winget configure' is not available, skipping validation." -ForegroundColor Yellow +} + Write-Host "Configuration file created at: $($filePath)" -ForegroundColor Green \ No newline at end of file From a316bf78b308443ca6ef62116105939a12112115 Mon Sep 17 00:00:00 2001 From: Kaleb Luedtke Date: Mon, 4 Dec 2023 15:48:15 -0600 Subject: [PATCH 4/5] Improve the MakeDSC script (#488) --- src/prototype/WingetCreateMakeDSC.ps1 | 157 ++++++++++++++------------ 1 file changed, 85 insertions(+), 72 deletions(-) diff --git a/src/prototype/WingetCreateMakeDSC.ps1 b/src/prototype/WingetCreateMakeDSC.ps1 index 29745b25..b196ef61 100644 --- a/src/prototype/WingetCreateMakeDSC.ps1 +++ b/src/prototype/WingetCreateMakeDSC.ps1 @@ -1,110 +1,123 @@ # This script is a prototype for quickly creating DSC files. #Powershell 7 Required -$hostdata=host -if ($hostdata.version.major -lt 7) { - Write-host "This script requires powershell 7. You can update powershell by typing winget install Microsoft.Powershell." -ForegroundColor red - [Environment]::Exit(1) +if ($(Get-Host).version.major -lt 7) { + Write-Host 'This script requires powershell 7. You can update powershell by typing winget install Microsoft.Powershell.' -ForegroundColor red + Exit(1) } -#Set output encoding to UTF-8 -$OutputEncoding = [ System.Text.Encoding]::UTF8 +# Create a custom exception type for our dependency management +class UnmetDependencyException : Exception { + UnmetDependencyException([string] $message) : base($message) {} + UnmetDependencyException([string] $message, [Exception] $exception) : base($message, $exception) {} +} -if ($null -eq (Get-InstalledModule -Name Microsoft.Winget.Client)) -{ - try { Install-Module Microsoft.Winget.Client +# Ensure the Winget PowerShell modules are installed +if (-not(Get-Module -ListAvailable -Name Microsoft.Winget.Client)) { + try { + Install-Module Microsoft.Winget.Client } catch { - #Pass the exception - throw [System.Net.WebException]::new("Error retrieving powershell module: Microsoft.Winget.Client. Check that you have installed the Windows Package Manager modules correctly.", $_.Exception) - #bugbug is this good enough? + # If there was an exception while installing, pass it as an InternalException for further debugging + throw [UnmetDependencyException]::new("'Microsoft.Winget.Client' was not installed successfully", $_.Exception) + } finally { + # Check to be sure it acutally installed + if (-not(Get-Module -ListAvailable -Name Microsoft.Winget.Client)) { + throw [UnmetDependencyException]::new("`Microsoft.Winget.Client` was not found. Check that you have installed the Windows Package Manager modules correctly.") + } } } -if ($null -eq (Get-InstalledModule -Name powershell-yaml)) -{ +# Ensure the powershell-yaml module is installed +if (-not(Get-Module -ListAvailable -Name powershell-yaml)) { try { - Install-Module powershell-yaml + Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force + Install-Module -Name powershell-yaml -Force -Repository PSGallery -Scope CurrentUser } catch { - #Pass the exception - throw [System.Net.WebException]::new("Error retrieving powershell module: powershell-yaml. Check that you have installed the Windows Package Manager modules correctly.", $_.Exception) - #bugbug is this good enough? + # If there was an exception while installing, pass it as an InternalException for further debugging + throw [UnmetDependencyException]::new("'powershell-yaml' was not installed successfully", $_.Exception) + } finally { + # Check to be sure it acutally installed + if (-not(Get-Module -ListAvailable -Name powershell-yaml)) { + throw [UnmetDependencyException]::new("`powershell-yaml` was not found. Check that you have installed the module correctly.") + } } } [System.Collections.ArrayList]$finalPackages = @() -$configurationVersion = "0.2.0" +$configurationVersion = '0.2.0' +$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False +$DSCHeader = "# yaml-language-server: `$schema=https://aka.ms/configuration-dsc-schema/$($configurationVersion -Replace '\.0$','')" -$continue = $true -do -{ - $appId = Read-Host "What is the Winget ID, or name of the package you want to add to the configuration file?" - $findResult = Find-WinGetPackage $appId +do { + $findResult = Find-WinGetPackage $(Read-Host 'What is the Winget ID, or name of the package you want to add to the configuration file?') - if ($findResult.count -ne 0) - { - $Index=1 - foreach ($package in $findResult) - { - $packageDetails = "[$($Index)] $($package.Name) | $($package.Id) | $($package.Version)" - Write-Host $packageDetails - $index++ - } + if ($findResult.count -ne 0) { + # Assign an index to each package + $findResult | ForEach-Object { $script:i = 1 } { Add-Member -InputObject $_ -NotePropertyName Index -NotePropertyValue $i; $i++ } + $findResult | Select-Object -Property Index, Name, Id, Version | Format-Table | Out-Host - $selection = -1 $packageSelected = $false - while (-not($packageSelected)) - { - write-host - # TODO: We should capture against bad value. "string" - # TODO: We should allow user to skip. Maybe hit S or X. - $selection = [int](Read-Host "Input the number of the package you want to select") - if (($selection -gt $findResult.count) -or ($selection -lt 1)) - { - Write-Host "Selection is out of range, try again." - } - else - { - $packageSelected = $true + while (-not($packageSelected)) { + Write-Host + # Prompt user for selection string + $selection = (Read-Host 'Select a package by Index, Name, or Id. Press enter to continue or skip') + $selectedPackage = $null + # If user didn't enter any selection string, set no package as selected and continue + if ( [string]::IsNullOrWhiteSpace($selection) ) { + $packageSelected = $true + } elseif ( $selection -in $findResult.Id ) { + # If the user entered a string which matches the Id, select that package + $selectedPackage = $findResult.Where({ $_.Id -eq $selection }) + $packageSelected = $true + } elseif ( $selection -in $findResult.Name ) { + # If the user entered a string which matches the Name, select that package + # Because names could conflict, take the first item in the list to avoid error + $selectedPackage = $findResult.Where({ $_.Name -eq $selection }) | Select-Object -First 1 + $packageSelected = $true + } else { + # If the name and ID didn't match, try selecting by index + # This needs to be a try-catch to handle converting strings to integers + try { + $selectedPackage = $findResult.Where({ $_.Index -eq [int]$selection }) + # If the user selects an index out of range, don't set no package as selected. Instead, allow for correcting the index + # If the intent is to select no package, the user will be able to skip after being notified the index is out of range + if ($selectedPackage) { + $packageSelected = $true + } else { + Write-Host 'Index out of range, please try again' + } + } catch { + Write-Host 'Invalid entry, please try again' + } } } - $selectedPackage = $findResult[$selection - 1] - - #Specify Source - #Winget currently has 2 sources. If the ID contains a period, we will assume winget. - #otherwise it is the MSSTORE. We are not accounting for private REPOs at this time. - If ($selectedPackage.Id -like "*.*") { - $source="winget" - } else { - $source="msstore" + # If a package was selected, add it to the package list; Otherwise, continue + if ($selectedPackage) { + $unit = @{'resource' = 'Microsoft.WinGet.DSC/WinGetPackage'; 'directives' = @{'description' = $selectedPackage.Name; 'allowPrerelease' = $true; }; 'settings' = @{'id' = $selectedPackage.Id; 'source' = $selectedPackage.Source } } + [void]$finalPackages.Add($unit) + Write-Host "Added $($selectedPackage.Name)" -ForegroundColor Blue } - - $unit = @{"resource" = "Microsoft.WinGet.DSC/WinGetPackage"; "directives" = @{"description" = $selectedPackage.Name; "allowPrerelease" = $true; }; "settings" = @{"id" = $selectedPackage.Id; "source"=$source }} - $tempvar = $finalPackages.Add($unit) - write-host Added $selectedPackage.Name -ForegroundColor blue - + } else { + Write-Host 'No package found matching input criteria.' -ForegroundColor DarkYellow } - else - { - Write-Host "No package found matching input criteria." -ForegroundColor DarkYellow - } -} while ($(Read-Host "Would you like to add another package? [y/n]") -eq 'y') +} while ($(Read-Host 'Would you like to add another package? [y/n]') -eq 'y') -Write-host -$fileName = Read-Host "Name of the configuration file (without extension)" +Write-Host +$fileName = Read-Host 'Name of the configuration file (without extension)' $filePath = Join-Path -Path (Get-Location) -ChildPath "$($fileName).winget" -ConvertTo-Yaml @{"properties"= @{"resources"=$finalPackages; "configurationVersion"= $configurationVersion}} -OutFile $filePath -Force +$rawYaml = ConvertTo-Yaml @{'properties' = @{'resources' = $finalPackages; 'configurationVersion' = $configurationVersion } } +[System.IO.File]::WriteAllLines($filePath, @($DSCHeader, '', $rawYaml.trim()), $Utf8NoBomEncoding) Write-Host -Write-Host Testing resulting file. -ForegroundColor yellow +Write-Host 'Testing resulting file...' -ForegroundColor yellow (&winget configure --help) > $null if ($LASTEXITCODE -eq 0) { winget configure validate --file $filePath -} -else { +} else { Write-Host "'winget configure' is not available, skipping validation." -ForegroundColor Yellow } From d9fccfbbe1cfb05905c873d02dec74a4f099b971 Mon Sep 17 00:00:00 2001 From: ryfu-msft Date: Mon, 4 Dec 2023 13:49:46 -0800 Subject: [PATCH 5/5] move make dsc file to tools folder --- {src/prototype => Tools}/WingetCreateMakeDSC.ps1 | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {src/prototype => Tools}/WingetCreateMakeDSC.ps1 (100%) diff --git a/src/prototype/WingetCreateMakeDSC.ps1 b/Tools/WingetCreateMakeDSC.ps1 similarity index 100% rename from src/prototype/WingetCreateMakeDSC.ps1 rename to Tools/WingetCreateMakeDSC.ps1