Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide output if Winget settings not existing #95

Merged
merged 1 commit into from
Oct 29, 2023
Merged

Hide output if Winget settings not existing #95

merged 1 commit into from
Oct 29, 2023

Conversation

Romanitho
Copy link
Owner

No description provided.

@Romanitho Romanitho merged commit 8b0178f into main Oct 29, 2023
@Romanitho Romanitho deleted the dev branch October 29, 2023 23:54
@KnifMelti
Copy link
Contributor

Trying this on a Windows Server 2019 Datacenter...
Microsoft.Powershell gets installed, but:
image
image

Would be super nice if this was available!

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.



                888       888 d8b  .d8888b.           d8b
                888   o   888 Y8P d88P  Y88b          Y8P
                888  d8b  888     888    888
                888 d888b 888 888 888        888  888 888
                888d88888b888 888 888  88888 888  888 888
                88888P Y88888 888 888    888 888  888 888
                8888P   Y8888 888 Y88b  d88P Y88b 888 888
                888P     Y888 888  "Y8888P88  "Y88888 888

               https://github.com/Romanitho/Winget-Install
             https://github.com/Romanitho/Winget-Install-GUI

        _________________________________________________________


12:31:33 - ###   2023-10-30 - NEW INSTALL REQUEST   ###

12:31:33 - Running with admin rights.

12:31:33 - Checking prerequisites...
12:31:34 - Microsoft.VCLibs.140.00.UWPDesktop is not installed
12:31:34 - -> Downloading https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx...
12:31:34 - -> Installing Microsoft.VCLibs.140.00.UWPDesktop...
12:31:36 - -> Failed to intall Microsoft.VCLibs.140.00.UWPDesktop...
12:31:36 - WinGet is not installed
12:31:36 - -> Downloading Winget v1.6.2771
12:31:40 - -> Installing Winget v1.6.2771
12:31:51 - -> Winget installed.
12:31:51 - Checking prerequisites ended.

New-Item : Could not find a part of the path 'C:\Windows\System32\config\systemprofile\AppData\Local\Microsoft\WinGet\S
ettings\settings.json'.
At C:\ProgramData\winget-install.ps1:99 char:9
+         New-Item -Path $SettingsPath | Out-Null
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (C:\Windows\Syst...s\settings.json:String) [New-Item], DirectoryNotFoundExce
   ption
    + FullyQualifiedErrorId : NewItemIOError,Microsoft.PowerShell.Commands.NewItemCommand

Out-File : Could not find a part of the path 'C:\Windows\System32\config\systemprofile\AppData\Local\Microsoft\WinGet\S
ettings\settings.json'.
At C:\ProgramData\winget-install.ps1:111 char:36
+ ... gFile | ConvertTo-Json | Out-File $SettingsPath -Encoding utf8 -Force
+                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (:) [Out-File], DirectoryNotFoundException
    + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand

12:31:51 - Start Microsoft.PowerShell processing...
12:31:53 - -> Microsoft.PowerShell exists on Winget Repository.
12:31:54 - -> Installing Microsoft.PowerShell...
12:31:54 - -> Running: "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.21.2771.0_x64__8wekyb3d8bbwe\winget.exe" install --id Microsoft.PowerShell -e --accept-package-agreements --accept-source-agreements -s winget -h


  ███▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  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

ReportIdentityFound PowerShell [Microsoft.PowerShell] ShowVersion 7.3.9.0
InstallationDisclaimer1
InstallationDisclaimer2
Downloading https://github.com/PowerShell/PowerShell/releases/download/v7.3.9/PowerShell-7.3.9-win-x64.msi



  █▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  4.00 MB /  100 MB
  ████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  14.0 MB /  100 MB
  ███████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  25.0 MB /  100 MB
  ██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  36.0 MB /  100 MB
  █████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  47.0 MB /  100 MB
  █████████████████▒▒▒▒▒▒▒▒▒▒▒▒▒  59.0 MB /  100 MB
  ███████████████████▒▒▒▒▒▒▒▒▒▒▒  67.0 MB /  100 MB
  ███████████████████████▒▒▒▒▒▒▒  78.8 MB /  100 MB
  ██████████████████████████▒▒▒▒  89.8 MB /  100 MB
  ██████████████████████████████   100 MB /  100 MB
  ██████████████████████████████   100 MB /  100 MB
InstallerHashVerified
InstallFlowStartingPackageInstall

InstallFlowInstallSuccess
12:32:28 - -> Microsoft.PowerShell successfully installed.
12:32:28 - Microsoft.PowerShell processing finished!

12:32:29 - ###   END REQUEST   ###

@Romanitho
Copy link
Owner Author

I agree for the Out-null but we need to know why is it not created no?

@@ -96,7 +96,7 @@ function Add-ScopeMachine {
$ConfigFile = Get-Content -Path $SettingsPath | Where-Object { $_ -notmatch '//' } | ConvertFrom-Json
}
else {
New-Item -Path $SettingsPath
New-Item -Path $SettingsPath | Out-Null
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would even go for:
New-Item -Path $SettingsPath -Force | Out-Null

@KnifMelti
Copy link
Contributor

I agree for the Out-null but we need to know why is it not created no?

It gets created!

@Romanitho
Copy link
Owner Author

New-Item : Could not find a part of the path 'C:\Windows\System32\config\systemprofile\AppData\Local\Microsoft\WinGet\S
ettings\settings.json'.
At C:\ProgramData\winget-install.ps1:99 char:9
+         New-Item -Path $SettingsPath | Out-Null
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (C:\Windows\Syst...s\settings.json:String) [New-Item], DirectoryNotFoundExce
   ption
    + FullyQualifiedErrorId : NewItemIOError,Microsoft.PowerShell.Commands.NewItemCommand

I would go for the -force anyway, just to be sure.

@KnifMelti
Copy link
Contributor

image

@KnifMelti
Copy link
Contributor

Maybe disable Microsoft.VCLibs.140.00.UWPDesktop for server?

@Romanitho
Copy link
Owner Author

image

Maybe you've run twice? And created by winget on first run.

@KnifMelti
Copy link
Contributor

Yes, probably!

@KnifMelti
Copy link
Contributor

Have a winget app from SCCM now up and running on one of our ADM-servers thanks to your new winget scripts:
image

15:38:25 - Running with admin rights.
 
15:38:25 - Checking prerequisites...
15:38:26 - Microsoft.VCLibs.140.00.UWPDesktop is not installed
15:38:26 - -> Downloading https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx...
15:38:26 - -> Installing Microsoft.VCLibs.140.00.UWPDesktop...
15:38:27 - -> Failed to intall Microsoft.VCLibs.140.00.UWPDesktop...
15:38:27 - Installed Winget version: v1.6.2771
15:38:27 - Checking prerequisites ended.
15:38:27 - Start DominikReichl.KeePass processing...
15:38:28 - -> DominikReichl.KeePass exists on Winget Repository.
15:38:30 - -> Installing DominikReichl.KeePass...
15:38:30 - -> Running: "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.21.2771.0_x64__8wekyb3d8bbwe\winget.exe" install --id DominikReichl.KeePass -e --accept-package-agreements --accept-source-agreements -s winget -h --installer-type MSI --override "REBOOT=R /qn"
  ███▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  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
ReportIdentityFound KeePass [DominikReichl.KeePass] ShowVersion 2.55.0
InstallationDisclaimer1
InstallationDisclaimer2
Downloading https://sourceforge.net/projects/keepass/files/KeePass%202.x/2.55/KeePass-2.55.msi/download
  ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  0.00 B / 3.57 MB
  ████████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒  2.00 MB / 3.57 MB
  ████████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒  2.00 MB / 3.57 MB
  ██████████████████████████████  3.57 MB / 3.57 MB
  ██████████████████████████████  3.57 MB / 3.57 MB
InstallerHashVerified
InstallFlowStartingPackageInstall
InstallFlowInstallSuccess
15:39:20 - -> DominikReichl.KeePass successfully installed.
15:39:20 - DominikReichl.KeePass processing finished!
15:39:21 - ###   END REQUEST   ###
15:41:23 - ###   2023-10-30 - NEW UNINSTALL REQUEST   ###
 
15:41:23 - Running with admin rights.
 
15:41:23 - Checking prerequisites...
15:41:23 - Microsoft.VCLibs.140.00.UWPDesktop is not installed
15:41:23 - -> Downloading https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx...
15:41:24 - -> Installing Microsoft.VCLibs.140.00.UWPDesktop...
15:41:24 - -> Failed to intall Microsoft.VCLibs.140.00.UWPDesktop...
15:41:24 - Installed Winget version: v1.6.2771
15:41:24 - Checking prerequisites ended.
15:41:24 - Start DominikReichl.KeePass processing...
15:41:26 - -> Uninstalling DominikReichl.KeePass...
15:41:26 - -> Running: "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.21.2771.0_x64__8wekyb3d8bbwe\winget.exe" uninstall --id DominikReichl.KeePass -e --accept-source-agreements -h
  ███▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  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
ReportIdentityFound KeePass [DominikReichl.KeePass]
UninstallFlowStartingPackageUninstall
UninstallFlowUninstallSuccess
15:41:31 - -> DominikReichl.KeePass successfully uninstalled.
15:41:31 - DominikReichl.KeePass processing finished!
15:41:32 - ###   END REQUEST   ###

@Romanitho
Copy link
Owner Author

haha, you're welcome.

Don't know why Microsoft.VCLibs.140.00.UWPDesktop cannot be installed on servers as it is mandatory on workstations... I mean, maybe i'm confused with all my testings... is this really necessary even on workstations?
On recent tests, I was not able to install apps as system if Microsoft.VCLibs.140.00.UWPDesktop was not present.... 🤯

@KnifMelti
Copy link
Contributor

Same here, and on WSB the ..2.7 otherwise the user didn't have winger...
...but it works without on 2019 server for using this script!

@Romanitho
Copy link
Owner Author

Maybe you're right, on server no need to try to install Microsoft.VCLibs.140.00.UWPDesktop

@KnifMelti
Copy link
Contributor

KnifMelti commented Oct 30, 2023

Haven't got access to a 2022 yet, maybe it's different.
But, in our case the only important thing is to be able to deploy apps to the management servers via WinGet.
Not to be able to run WinGet as users.

@KnifMelti
Copy link
Contributor

KnifMelti commented Nov 1, 2023

...and after your cleanup etc. of WAU we can install/use it on our 2019 management servers too (after deploying the GPO without -InstallUserContext to them)!
The only error would be the installation of Microsoft.VCLibs.140.00.UWPDesktop - I'll test this as soon as I can...

@Romanitho
Copy link
Owner Author

Why do you need the GPO to block user context?
Install it full system only directly, no ?

@KnifMelti
Copy link
Contributor

To avoid having multiple installations in SCCM

@Romanitho
Copy link
Owner Author

Not sure to understand

@KnifMelti
Copy link
Contributor

We install WAU via an application in SCCM.
To avoid having one for standard clients and one for management servers only to block user context.

@Romanitho
Copy link
Owner Author

Ohhh, ok... got it.
One WAU, multiple conf by GPO 👌🏼

@KnifMelti
Copy link
Contributor

One ring to rule them all 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants