Skip to content
This repository was archived by the owner on Jun 14, 2024. It is now read-only.

Scope property for Machine vs User #45

Open
kfsone opened this issue Oct 31, 2022 · 0 comments
Open

Scope property for Machine vs User #45

kfsone opened this issue Oct 31, 2022 · 0 comments

Comments

@kfsone
Copy link

kfsone commented Oct 31, 2022

Summary of the new feature / enhancement

PackageManagementResource can install Winget and drive that, but it is nearly impossible to use meaningfully for two reasons:

1- winget install accepts a "--scope" parameter to let you specify whether the package is per-user or machine-wide, but PackageManager does not surface this,

2- attempting to instead pass the PSCredential of the user it should be installed as via PsDscRunAsCredential consistently produces an 0x80070520 error (no logon session) unless it is the credential of the current user anyway (which is thus pointless).

Proposed technical implementation details (optional)

Configuration InstallTerminal
{
  Param([Parameter(Mandatory)][PSCredential] $UserCred)

  PackageManager Winget
  {
    Name = 'WinGet'
    Source = 'PSGallery'
  }

  PackageManager WindowsTerminal
  {
    DependsOn = '[PackageManager]Winget'
    Ensure = 'Present'
    Name = 'Microsoft.WindowsTerminal'
    RequiredVersion = 'latest'
    ProviderName = 'WinGet'

    # New
    Scope = 'LocalMachine'  # vs PsDscRunAsCredential $UserCred -> 0x80070520
  } 
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant