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

-MountUserDrive parameter description mentions wrong path #8583

Closed
3 tasks done
metablaster opened this issue Feb 12, 2022 · 4 comments · Fixed by #8584 or #8674
Closed
3 tasks done

-MountUserDrive parameter description mentions wrong path #8583

metablaster opened this issue Feb 12, 2022 · 4 comments · Fixed by #8584 or #8674
Assignees
Labels
area-core Area - Microsoft.PowerShell.Core module issue-doc-bug Issue - error in documentation

Comments

@metablaster
Copy link

metablaster commented Feb 12, 2022

Prerequisites

  • Write a descriptive title.
  • Search the existing issues.
  • I am reporting the documentation problem for version of PowerShell I am using.

Version

7.2

Link to affected document

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/new-pssessionconfigurationfile?view=powershell-7.2

Description of the documentation error

-MountUserDrive describes that default path to be created is:
$env:LOCALAPPDATA\Microsoft\Windows\PowerShell\DriveRoots\
however that's likely false, the correct path seems to be
$env:SYSTEMROOT\System32\Microsoft\Windows\PowerShell\DriveRoots\<HOSTNAME>_<USERNAME>

I'm not sure if that applies to Windows PowerShell only or to PS Core as well?

I figured that out from another github issue below:
#5969

Suggested fix

Update -MountUserDrive description to point out correct default path for each edition of PowerShell.

@metablaster metablaster added issue-doc-bug Issue - error in documentation needs-triage Waiting - Needs triage labels Feb 12, 2022
@sdwheeler sdwheeler self-assigned this Feb 14, 2022
@sdwheeler sdwheeler added area-core Area - Microsoft.PowerShell.Core module and removed needs-triage Waiting - Needs triage labels Feb 14, 2022
@sdwheeler
Copy link
Contributor

sdwheeler commented Feb 14, 2022

The docs are correct.

For each user connecting to the endpoint, a folder is created with the name $env:USERDOMAIN_$env:USERNAME.

For computers in workgroups, the value of $env:USERDOMAIN is the hostname.

I also fixed the path difference between 5.1 and 7+.

I updated the article.

@metablaster
Copy link
Author

metablaster commented Feb 14, 2022

I'm sorry to reopen but there have been misunderstanding.

the issue is not $env:USERDOMAIN_$env:USERNAME but rather $env:SYSTEMROOT (correct) vs $env:LOCALAPPDATA (incorrect)

I tested path creation and it is created in SYSTEMROOT no in LOCALAPPDATA.

EDIT:
Ah it seems like your change is not immediatly pushed, all OK!
I was looking at old site it seems.

@sdwheeler
Copy link
Contributor

Investigating

@sdwheeler sdwheeler reopened this Feb 14, 2022
@michaeltlombardi
Copy link
Contributor

After investigation, I have discovered:

  1. The described root path for the mounted user drive, $env:LOCALAPPDATA\Microsoft\PowerShell\DriveRoots, is accurate for Windows PowerShell 5.1 and all versions of PowerShell 7+.
  2. The described per-user path after the root is incorrectly described for Windows PowerShell and incorrect for PowerShell:
    • For Windows PowerShell, it should be ${env:USERDOMAIN}_${env:USERNAME} as the listed $env:USERDOMAIN_$env:USERNAME will return only the username; the first component of the string will look for the environment variable $env:USERDOMAIN_, not find, and interpolate $null. For clarity, this should be updated.
    • For PowerShell, it is actually $env:USERDOMAIN\$env:USERNAME as a folder is created for the domain itself and then one for each user.

michaeltlombardi added a commit to michaeltlombardi/PowerShell-Docs that referenced this issue Mar 21, 2022
This commit corrects the per-user portion of the path created when using the MountUserDrive
option for a PSSession configuration file.

For Windows PowerShell, it ensures the string represents what is actually written by
placing the environment variables in backticks; the prior description would not actually
map to the correct value as PowerShell would incorrectly see the variable as USERDOMAIN_

For PowerShell, the option actually creates a folder for the domain and places a folder
per-user inside of that one.
sdwheeler pushed a commit that referenced this issue Mar 21, 2022
This commit corrects the per-user portion of the path created when using the MountUserDrive
option for a PSSession configuration file.

For Windows PowerShell, it ensures the string represents what is actually written by
placing the environment variables in backticks; the prior description would not actually
map to the correct value as PowerShell would incorrectly see the variable as USERDOMAIN_

For PowerShell, the option actually creates a folder for the domain and places a folder
per-user inside of that one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core Area - Microsoft.PowerShell.Core module issue-doc-bug Issue - error in documentation
Projects
None yet
3 participants