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

Path variable is corrupted if PsDscRunAsCredential is used #171

Open
warsus opened this issue Jun 30, 2022 · 0 comments
Open

Path variable is corrupted if PsDscRunAsCredential is used #171

warsus opened this issue Jun 30, 2022 · 0 comments

Comments

@warsus
Copy link

warsus commented Jun 30, 2022

Path variable is corrupted if PsDscRunAsCredential is used

Hi,
i am installing packages under a specific Account using "PsDscRunAsCredential".
Unfortunately during the package installation process the the $env:Path variable is reset to only the "Machine" Path Variables by: $env:Path = [Environment]::GetEnvironmentVariable('Path','Machine')
This means all the User specific path variable entries are missing subsequently including all following resources.

To Reproduce
Use "cChocoPackageInstaller" with "PsDscRunAsCredential":


  cChocoPackageInstaller foo
  {
      PsDscRunAsCredential = $installationUserCredential
      Name =  foo
      ...
  }
  Script dumpPath
  {
      PsDscRunAsCredential = $installationUserCredential
      DependsOn = "[cChocoPackageInstaller]foo"
      SetScript = {
      }
      TestScript = {
          Write-Verbose "Dumping Path: $env:Path => $($env:Path)"
          return $true
      }
      GetScript = { @{} }
  } 

Expected behavior
The Path Variable should be set correctly if it has to be refreshed
From here:
"The Path is constructed from the system path, which can be viewed in the System Environment Variables field in the System dialog box. The User path is appended to the system path."

Software (please complete the following information):

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

No branches or pull requests

1 participant