@@ -9,9 +9,11 @@ https://github.com/Romanitho/Winget-Intune-Packager
99# ## APP INFO ###
1010
1111# Winget Intune Packager version
12- $Script :WingetIntunePackager = " 1.1.1 "
12+ $Script :WingetIntunePackager = " 1.1.2 "
1313# Winget-Install Github Link
1414$Script :WIGithubLink = " https://github.com/Romanitho/Winget-Install/archive/refs/tags/v1.10.1.zip"
15+ # Winget Intune Packager Icon Base64
16+ $Script:IconBase64 = [Convert]::FromBase64String("AAABAAEAEBAAAAAAAABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAUKEUwPHjCLECAzkRAgM5EQIDORECAzkRAgM5EQIDORECAzkRAgM5EPHjCOBQoRXwAAABQAAAAAAAAAABUoPpAyYZv9NWaj/zVmpP81ZqT/NWak/zVmpP81ZqT/NWak/zVmpP81ZqT/NWaj/zJgmv0TJDmtAAAAFAkQGC01ZZ/9MGWh/yFfl/8oY5z/IV+X/y5loP81aKT/W4S1/8XKz/+5vcL/ub3C/7m9wv99lLH/KU56/QYKD1wgOVZcOGyn/zFpov8eX5X/Lmeg/x5flf8vaKH/OGyn/2GKuf+2trb/n5+f/5+fn/+Tk5P/Z3uS/ypTf/8QHi2LJURjXzpxqv85cKn/Kmie/zlxqv8raJ//OHCo/zpxqv9Tg7X/obbM/5uxxv+QobP/d4eX/1Z0kv8sVoL/EiEwjCdHZl88daz/PHWs/zx1rP88daz/PHWs/zx1rP88daz/PHWs/zx1rP82apv/LlqE/y5ZhP8uWYT/LlmE/xMjMosrTGpfPnqv/z56r/8+eq//Pnqv/z56r/8+eq//Pnqv/z56r/84bp7/L12G/y9dhv8vXYb/L12G/y9dhv8VJTSKL1FtX0B/sv9Af7L/QH+y/0B/sv9Af7L/QH+y/0B/sv86cqD/MWGI/zFhiP8xYYj/MWGI/zFhiP8xYYj/Fyc1iTNWcF9DhLX/Q4S1/0OEtf9DhLX/Q4S1/0OEtf88dqL/M2SK/zNkiv8zZIr/M2SK/zNkiv8zZIr/M2SK/xkqN4g4WnJfRYi3/0WIt/9FiLf/RYi3/0WIt/9Girj/U5i3/1edu/83a4//NWiM/zVojP81aIz/NWiM/zdulP8fNUSHPF91X0eNuv9Hjbr/R426/0eNuv9Hjbr/SI67/1igvv9cpsP/OW+R/zZsjv82bI7/NmyO/zlylv9Girb/IzpIhUBjd19Jkb3/SZG9/0mRvf9Jkb3/SZG9/0uTvf9Yob7/XafD/zpyk/84b5D/OG+Q/zt1mP9Ij7n/SZG9/yU8SoRHaHpbS5a//0uWv/9Llr//S5a//0uWv/9Nl8D/WaO//12oxP88dpX/OXOS/z15mv9Kk7v/S5a//0uWv/8oPUl9QFRfIVuixvtOm8L/TpvC/06bwv9Om8L/T5zC/1mkwP9eqcX/PXmX/z58nP9Ml77/TpvC/06bwv9ZoMT8ExkdPwAAAAB4obZsY6jK+0+dw/9OnMP/TpzD/1Cdw/9apMD/XqnF/0GBn/9Nmb//TpzD/0+dw/9hpcf8OlFchQAAAAIAAAAAAAAAAEpdZyFhfIlbYXyKX2F8il9ifYpfZX+JX2eBil9he4hfYnyKX2J8il9bc39cHiYqKQAAAAAAAAAAgAEAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAwAMAAA==")
1517# Temp folder
1618$Script :Location = " $Env: ProgramData \WingetIntunePackagerTemp"
1719# Load assemblies
@@ -229,7 +231,6 @@ function Start-InstallGUI {
229231 $CloseButton.add_click ({
230232 $WingetIntunePackagerForm.DialogResult = [System.Windows.Forms.DialogResult ]::Cancel
231233 $WingetIntunePackagerForm.Close ()
232- Sleep 3
233234 })
234235
235236 # Shows the form
@@ -239,21 +240,20 @@ function Start-InstallGUI {
239240
240241Function Start-PopUp ($Message ) {
241242
242- if (! $Window ) {
243+ if (! $PopUpWindow ) {
243244
244245 # Create window
245246 $inputXML = @"
246247<Window x:Class="Winget_Intune_Packager.PopUp"
247- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
248- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
249- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
250- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
251- xmlns:local="clr-namespace:WiGui_v3 "
252- mc:Ignorable="d"
253- Title="Winget Intune Packager $WingetIntunePackager " Width="260" Height="130" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" Topmost="True ">
248+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
249+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
250+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
251+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
252+ xmlns:local="clr-namespace:Winget_Intune_Packager "
253+ mc:Ignorable="d"
254+ Title="Winget Intune Packager $WingetIntunePackager " ResizeMode="NoResize" WindowStartupLocation="CenterScreen" Topmost="True" Width="280" MinHeight="130" SizeToContent="Height ">
254255 <Grid>
255- <TextBlock x:Name="PopUpLabel" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10"/>
256-
256+ <TextBlock x:Name="PopUpLabel" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="Wrap" Margin="20"/>
257257 </Grid>
258258</Window>
259259"@
@@ -520,9 +520,6 @@ function Get-WIPLatestVersion {
520520
521521 # ## FORM CREATION ###
522522
523- # Show Wait form
524- Start-PopUp " Starting..."
525-
526523 # Get latest stable info
527524 $WIPurl = ' https://api.github.com/repos/Romanitho/WingetIntunePackager/releases/latest'
528525 $WIPLatestVersion = ((Invoke-WebRequest $WIPurl - UseBasicParsing | ConvertFrom-Json )[0 ].tag_name).Replace(" v" , " " )
@@ -536,16 +533,16 @@ function Get-WIPLatestVersion {
536533 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
537534 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
538535 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
539- xmlns:local="clr-namespace:WiGui_v3 "
536+ xmlns:local="clr-namespace:Winget_Intune_Packager "
540537 mc:Ignorable="d"
541- Title="Winget Intune Packager $WingetIntunePackager - Update available" ResizeMode="NoResize" SizeToContent="WidthAndHeight" WindowStartupLocation="CenterScreen">
538+ Title="Winget Intune Packager $WingetIntunePackager - Update available" ResizeMode="NoResize" SizeToContent="WidthAndHeight" WindowStartupLocation="CenterScreen" Topmost="True" >
542539 <Grid>
540+ <TextBlock x:Name="TextBlock" HorizontalAlignment="Center" TextWrapping="Wrap" VerticalAlignment="Center" Margin="26,26,26,60" MaxWidth="480" Text="A New Winget Intune Packager version is available. Version $WIPLatestVersion "/>
543541 <StackPanel Height="32" Orientation="Horizontal" UseLayoutRounding="False" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="6">
544542 <Button x:Name="GithubButton" Content="See on GitHub" Margin="4" Width="100"/>
545543 <Button x:Name="DownloadButton" Content="Download" Margin="4" Width="100"/>
546544 <Button x:Name="SkipButton" Content="Skip" Margin="4" Width="100" IsDefault="True"/>
547545 </StackPanel>
548- <TextBlock x:Name="TextBlock" HorizontalAlignment="Center" TextWrapping="Wrap" VerticalAlignment="Center" Margin="20,20,20,54" MaxWidth="480" Text="A New WiGui version is available. Version $WIPLatestVersion "/>
549546 </Grid>
550547</Window>
551548"@
@@ -568,6 +565,7 @@ function Get-WIPLatestVersion {
568565 # # ACTIONS ##
569566
570567 $GithubButton.add_click ({
568+ $UpdateWindow.Topmost = $false
571569 [System.Diagnostics.Process ]::Start(" https://github.com/Romanitho/WingetIntunePackager/releases" )
572570 })
573571
@@ -577,11 +575,15 @@ function Get-WIPLatestVersion {
577575 $WIPSaveFile.FileName = " WingetIntunePackager_$WIPLatestVersion .exe"
578576 $response = $WIPSaveFile.ShowDialog () # $response can return OK or Cancel
579577 if ( $response -eq ' OK' ) {
578+ Start-PopUp " Downloading Winget Intune Packager $WIPLatestVersion ..."
580579 $WIPDlLink = " https://github.com/Romanitho/WingetIntunePackager/releases/download/v$WIPLatestVersion /WingetIntunePackager.exe"
581- Invoke-WebRequest - Uri $WIPDlLink - OutFile $WIPSaveFile.FileName
580+ Invoke-WebRequest - Uri $WIPDlLink - OutFile $WIPSaveFile.FileName - UseBasicParsing
582581 $UpdateWindow.DialogResult = [System.Windows.Forms.DialogResult ]::OK
583582 $UpdateWindow.Close ()
583+ Start-PopUp " Starting Winget Intune Packager $WIPLatestVersion ..."
584584 Start-Process - FilePath $WIPSaveFile.FileName
585+ Start-Sleep 5
586+ Close-PopUp
585587 Exit 0
586588 }
587589 })
@@ -594,49 +596,54 @@ function Get-WIPLatestVersion {
594596
595597 # # RETURNS ##
596598 # Show Wait form
597- Close-PopUp
598599 $UpdateWindow.ShowDialog () | Out-Null
599-
600- }
601- else {
602- # Show Wait form
603- Close-PopUp
604600 }
605-
606601}
607602
608603
609604
610605# ## PREREQUISITES ###
611606
612- Start-PopUp " Loading ..."
607+ Start-PopUp " Starting ..."
613608
614609# IntuneWin32App module needed
615610$IntuneWin32App = Get-InstalledModule " IntuneWin32App" - ErrorAction SilentlyContinue
616611if (! $IntuneWin32App ) {
617612 $NuGet = Get-PackageProvider - name " nuget" - ListAvailable - ErrorAction SilentlyContinue
618613 if (! $NuGet ) {
619- Start-PopUp " Installing NuGet..."
620- Start-Process ' powershell.exe' - Verb RunAs - ArgumentList ' -ExecutionPolicy ByPass -Command "Install-PackageProvider -Name nuget -Force"' - Wait
614+ Start-PopUp " Installing NuGet... (Admin rights needed)"
615+ $SP = Start-Process ' powershell.exe' - Verb RunAs - ArgumentList ' -ExecutionPolicy ByPass -Command "Install-PackageProvider -Name nuget -Force"' - Wait - PassThru
616+ if ($SP.ExitCode -ne " 0" ) {
617+ $PopUpLabel.Foreground = " red"
618+ Start-PopUp " NuGet is not installed. Closing..."
619+ Start-Sleep 3
620+ Close-PopUp
621+ Exit 1
622+ }
623+ }
624+ Start-PopUp " Installing IntuneWin32App... (Admin rights needed)"
625+ $SP = Start-Process ' powershell.exe' - Verb RunAs - ArgumentList ' -ExecutionPolicy ByPass -Command "Install-Module -Name "IntuneWin32App" -force"' - Wait - PassThru
626+ if ($SP.ExitCode -ne " 0" ) {
627+ $PopUpLabel.Foreground = " red"
628+ Start-PopUp " IntuneWin32App PS Module is not installed. Closing..."
629+ Start-Sleep 3
630+ Close-PopUp
631+ Exit 1
621632 }
622- Start-PopUp " Installing IntuneWin32App..."
623- Start-Process ' powershell.exe' - Verb RunAs - ArgumentList ' -ExecutionPolicy ByPass -Command "Install-Module -Name "IntuneWin32App" -force"' - Wait
633+
624634}
625635# Create Temp folder
626636if (! (Test-Path $Location )) {
627637 New-Item - ItemType Directory - Force - Path $Location | Out-Null
628638}
629639# Encoding & error management
630- $null = cmd / c ' '
631- $Global :OutputEncoding = [Console ]::InputEncoding = [Console ]::OutputEncoding = [System.Text.UTF8Encoding ]::new()
632- # $ProgressPreference = "SilentlyContinue"
633- $IconBase64 = [Convert]::FromBase64String("AAABAAEAEBAAAAAAAABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAUKEUwPHjCLECAzkRAgM5EQIDORECAzkRAgM5EQIDORECAzkRAgM5EPHjCOBQoRXwAAABQAAAAAAAAAABUoPpAyYZv9NWaj/zVmpP81ZqT/NWak/zVmpP81ZqT/NWak/zVmpP81ZqT/NWaj/zJgmv0TJDmtAAAAFAkQGC01ZZ/9MGWh/yFfl/8oY5z/IV+X/y5loP81aKT/W4S1/8XKz/+5vcL/ub3C/7m9wv99lLH/KU56/QYKD1wgOVZcOGyn/zFpov8eX5X/Lmeg/x5flf8vaKH/OGyn/2GKuf+2trb/n5+f/5+fn/+Tk5P/Z3uS/ypTf/8QHi2LJURjXzpxqv85cKn/Kmie/zlxqv8raJ//OHCo/zpxqv9Tg7X/obbM/5uxxv+QobP/d4eX/1Z0kv8sVoL/EiEwjCdHZl88daz/PHWs/zx1rP88daz/PHWs/zx1rP88daz/PHWs/zx1rP82apv/LlqE/y5ZhP8uWYT/LlmE/xMjMosrTGpfPnqv/z56r/8+eq//Pnqv/z56r/8+eq//Pnqv/z56r/84bp7/L12G/y9dhv8vXYb/L12G/y9dhv8VJTSKL1FtX0B/sv9Af7L/QH+y/0B/sv9Af7L/QH+y/0B/sv86cqD/MWGI/zFhiP8xYYj/MWGI/zFhiP8xYYj/Fyc1iTNWcF9DhLX/Q4S1/0OEtf9DhLX/Q4S1/0OEtf88dqL/M2SK/zNkiv8zZIr/M2SK/zNkiv8zZIr/M2SK/xkqN4g4WnJfRYi3/0WIt/9FiLf/RYi3/0WIt/9Girj/U5i3/1edu/83a4//NWiM/zVojP81aIz/NWiM/zdulP8fNUSHPF91X0eNuv9Hjbr/R426/0eNuv9Hjbr/SI67/1igvv9cpsP/OW+R/zZsjv82bI7/NmyO/zlylv9Girb/IzpIhUBjd19Jkb3/SZG9/0mRvf9Jkb3/SZG9/0uTvf9Yob7/XafD/zpyk/84b5D/OG+Q/zt1mP9Ij7n/SZG9/yU8SoRHaHpbS5a//0uWv/9Llr//S5a//0uWv/9Nl8D/WaO//12oxP88dpX/OXOS/z15mv9Kk7v/S5a//0uWv/8oPUl9QFRfIVuixvtOm8L/TpvC/06bwv9Om8L/T5zC/1mkwP9eqcX/PXmX/z58nP9Ml77/TpvC/06bwv9ZoMT8ExkdPwAAAAB4obZsY6jK+0+dw/9OnMP/TpzD/1Cdw/9apMD/XqnF/0GBn/9Nmb//TpzD/0+dw/9hpcf8OlFchQAAAAIAAAAAAAAAAEpdZyFhfIlbYXyKX2F8il9ifYpfZX+JX2eBil9he4hfYnyKX2J8il9bc39cHiYqKQAAAAAAAAAAgAEAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAwAMAAA==")
640+ [Console ]::InputEncoding = [Console ]::OutputEncoding = [System.Text.UTF8Encoding ]::new()
641+ $ProgressPreference = " SilentlyContinue"
634642
635643Close-PopUp
636644
637645
638646
639-
640647# ## MAIN ###
641648
642649# Get WingetIntunePackager latest version
@@ -649,4 +656,5 @@ Get-WingetCmd
649656Start-InstallGUI
650657
651658# Remove temp items
659+ Start-Sleep 3
652660Remove-Item $Location - Recurse - Force - Confirm:$false
0 commit comments