Skip to content

TMP/TEMP env variable breaks ini.psm1 with non-ASCII usernames #391

@al-indigo

Description

@al-indigo

Images:
en-us_windows_server_2019_x64_dvd_f9475476 -- works fine
ru-ru_windows_server_2019_x64_dvd_e02b76ba -- breaks in ini.psm1 with the following error (see the screen)

  1. I have discovered the reason: PowerShell internally compiles this code. During this compilation, the .NET Framework may use TempFileCollection to create temporary files for the compilation process. That temp file is generated as a shortname and it seems that different parts of Windows do not understand these paths equally.
  2. I have found a workaround, but I do not know your code enough to propose a pull request for this and be sure that it will not break anything for other systems.

But my straightforward fix looks like inserting in Logon.ps1 code the following snippet after line 8 or in ini.psm1 in the beginning:

New-Item -Path $resourcesDir\Temp -ItemType Directory -Force | Out-Null
$ENV:TMP = "$resourcesDir\Temp"
$ENV:TEMP = "$resourcesDir\Temp"

Hope it helps and you will decide for yourselves how to fix it in the most correct way

psm-error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions