11-01-2023 05:20 PM
Hi all,
Very new to JC, so if this is the wrong board, I apologize.
Reading through this old post, I'm working to setup a JC command to help us install some standard software to Windows machines(currently just using Reader as a tester package). I initially was running into an issue where the system was telling me that Adobe Reader was already installed, despite it not being installed.
Command Result Details:
cd to directory: C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.21.2771.0_x64__8wek
yb3d8bbwe
Adobe Reader is already installed.
I believe, after some some local testing, that it's an issue related to running Powershell in normal mode vs admin mode. After determining that, I've added some code to elevate the session to admin.
Running the script in this manner let's the process continue, and actually start to attempt to install the package, but now I'm running into an issue with the MSS service agreements:
cd to directory: C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.21.2771.0_x64__8wek
yb3d8bbwe
-
\
|
███▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 1024 KB / 8.24 MB
███████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 2.00 MB / 8.24 MB
██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 3.00 MB / 8.24 MB
██████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 4.00 MB / 8.24 MB
██████████████████▒▒▒▒▒▒▒▒▒▒▒▒ 5.00 MB / 8.24 MB
█████████████████████▒▒▒▒▒▒▒▒▒ 6.00 MB / 8.24 MB
█████████████████████████▒▒▒▒▒ 7.00 MB / 8.24 MB
█████████████████████████████▒ 8.00 MB / 8.24 MB
██████████████████████████████ 8.24 MB / 8.24 MB
The `msstore` source requires that you view the following agreements before using.
Terms of Transaction: https://aka.ms/microsoft-store-terms-of-transaction
The source requires the current machine's 2-letter geographic region to be sent to the backend se
rvice to function properly (ex. "US").
Do you agree to all the source agreements terms?
[Y] Yes [N] No: An unexpected error occurred while executing the command:
0x8a150042 : Error reading input in prompt
Adobe Reader is already installed.
I've Googled around, and haven't really found anything that I haven't tried, except for this open issue.
If I run the script locally, the install completes fine. The only difference that comes to mind is that when running locally, UAC does pop up saying the normal "do you want this to make changes" when it elevates permissions.
Any thoughts as to what I'm doing wrong? Yes, I'm aware of the Chocolatey repo, but I'm trying to use the MSStore repo vs the community repo.
Code I'm using
# Check if the current user is an administrator
if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
# Relaunch as an administrator
Start-Process powershell.exe -ArgumentList " -NoProfile -ExecutionPolicy Bypass -File $($MyInvocation.MyCommand.Definition)" -Verb RunAs
exit
}
$wingetdir = (Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe" | Sort-Object -Property Path | Select-Object -Last 1)
Write-Host "cd to directory: $wingetdir"
cd $wingetdir
$AdobeReader = (.\winget.exe list --id 'Adobe.Acrobat.Reader.64-bit')
$AdobeReader
If ($AdobeReader -like '*No installed package found*')
{
.\winget.exe install --id 'Adobe.Acrobat.Reader.64-bit' --silent --accept-package-agreements --accept-source-agreements
}
else
{
Write-Host 'Adobe Reader is already installed.'
}
Thanks!
11-02-2023 10:36 AM
@martinu it was just caught in the filter in error. Fixed now.
Like someone's post? Give them a kudo!
Did someone's answer help you? Please mark it as a solution.
New to the site? Take a look at these additional resources:
Ready to join us? You can register here.