|
| 1 | +Param( |
| 2 | + [String] $DesktopAppInstallerPath, |
| 3 | + [String[]] $DesktopAppInstallerDependencyPath, |
| 4 | + [String] $PackageIdentifier, |
| 5 | + [String] $SourceName, |
| 6 | + [String] $OutputPath, |
| 7 | + [Switch] $UseDev |
| 8 | +) |
| 9 | + |
| 10 | +function Get-ARPTable { |
| 11 | + $registry_paths = @('HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*','HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*', 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*', 'HKCU:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*') |
| 12 | + return Get-ItemProperty $registry_paths -ErrorAction SilentlyContinue | |
| 13 | + Select-Object DisplayName, DisplayVersion, Publisher, @{N='ProductCode'; E={$_.PSChildName}} | |
| 14 | + Where-Object {$null -ne $_.DisplayName } |
| 15 | +} |
| 16 | + |
| 17 | +$ProgressPreference = 'SilentlyContinue' |
| 18 | + |
| 19 | +$desktopPath = "C:\Users\WDAGUtilityAccount\Desktop" |
| 20 | + |
| 21 | +$regFilesDirPath = Join-Path $desktopPath "RegFiles" |
| 22 | + |
| 23 | +if (Test-Path $regFilesDirPath) |
| 24 | +{ |
| 25 | + foreach ($regFile in (Get-ChildItem $regFilesDirPath)) |
| 26 | + { |
| 27 | + |
| 28 | + Write-Host @" |
| 29 | +--> Importing reg file $($regFile.FullName) |
| 30 | +"@ |
| 31 | + reg import $($regFile.FullName) |
| 32 | + } |
| 33 | +} |
| 34 | + |
| 35 | +Write-Host @" |
| 36 | +--> Installing WinGet |
| 37 | +
|
| 38 | +"@ |
| 39 | + |
| 40 | +if ($UseDev) |
| 41 | +{ |
| 42 | + foreach($dependency in $DesktopAppInstallerDependencyPath) |
| 43 | + { |
| 44 | + Write-Host @" |
| 45 | + ----> Installing $dependency |
| 46 | +"@ |
| 47 | + Add-AppxPackage -Path $dependency |
| 48 | + } |
| 49 | + |
| 50 | + Write-Host @" |
| 51 | + ----> Enabling dev mode |
| 52 | +"@ |
| 53 | + reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1" |
| 54 | + |
| 55 | + $devPackageManifestPath = Join-Path $desktopPath "DevPackage\AppxManifest.xml" |
| 56 | + Write-Host @" |
| 57 | + ----> Installing $devPackageManifestPath |
| 58 | +"@ |
| 59 | + Add-AppxPackage -Path $devPackageManifestPath -Register |
| 60 | +} |
| 61 | +else |
| 62 | +{ |
| 63 | + Add-AppxPackage -Path $DesktopAppInstallerPath -DependencyPath $DesktopAppInstallerDependencyPath |
| 64 | +} |
| 65 | + |
| 66 | +$originalARP = Get-ARPTable |
| 67 | + |
| 68 | +Write-Host @" |
| 69 | +
|
| 70 | +--> Installing $PackageIdentifier |
| 71 | +
|
| 72 | +"@ |
| 73 | + |
| 74 | +$installAndCorrelateOutPath = Join-Path $OutputPath "install_and_correlate.json" |
| 75 | + |
| 76 | +$installAndCorrelationExpression = Join-Path $desktopPath "InstallAndCheckCorrelation\InstallAndCheckCorrelation.exe" |
| 77 | +$installAndCorrelationExpression = -join($installAndCorrelationExpression, ' -id "', $PackageIdentifier, '" -src "', $SourceName, '" -out "', $installAndCorrelateOutPath, '"') |
| 78 | + |
| 79 | +if ($UseDev) |
| 80 | +{ |
| 81 | + $installAndCorrelationExpression = -join($installAndCorrelationExpression, ' -dev') |
| 82 | +} |
| 83 | + |
| 84 | +Invoke-Expression $installAndCorrelationExpression |
| 85 | + |
| 86 | +Write-Host @" |
| 87 | +
|
| 88 | +--> Copying logs |
| 89 | +"@ |
| 90 | + |
| 91 | +if ($UseDev) |
| 92 | +{ |
| 93 | + Copy-Item -Recurse (Join-Path $env:LOCALAPPDATA "Packages\WinGetDevCLI_8wekyb3d8bbwe\LocalState\DiagOutputDir") $OutputPath |
| 94 | +} |
| 95 | +else |
| 96 | +{ |
| 97 | + Copy-Item -Recurse (Join-Path $env:LOCALAPPDATA "Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir") $OutputPath |
| 98 | +} |
| 99 | + |
| 100 | + |
| 101 | +Write-Host @" |
| 102 | +
|
| 103 | +--> Comparing ARP Entries |
| 104 | +"@ |
| 105 | + |
| 106 | +$arpCompared = (Compare-Object (Get-ARPTable) $originalARP -Property DisplayName,DisplayVersion,Publisher,ProductCode) |
| 107 | +$arpCompared | Select-Object -Property * -ExcludeProperty SideIndicator | Format-Table |
| 108 | + |
| 109 | +$arpCompared | Select-Object -Property * -ExcludeProperty SideIndicator | Format-Table | Out-File (Join-Path $OutputPath "ARPCompare.txt") |
| 110 | + |
| 111 | +"Done" | Out-File (Join-Path $OutputPath "done.txt") |
0 commit comments