jdhitsolutions / PSScriptTools

:wrench: :hammer: A set of PowerShell functions you might use to enhance your own functions and scripts or to facilitate working in the console. Most should work in both Windows PowerShell and PowerShell 7, even cross-platform. Any operating system limitations should be handled on a per command basis. The Samples folder contains demonstration script files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get-PSProfile fails to find profiles that are in moved Documents folders

corbob opened this issue · comments

Describe the bug
OneDrive includes a feature that allows you to move your Documents (among other folders) to OneDrive. Get-PSProfile with it's hard coded locations is unable to locate the profiles in this case.

To Reproduce
Steps to reproduce the behavior:

  1. In Windows Explorer navigate to the Documents folder
  2. Right Click on Document folder and choose Properties
  3. Switch to Location tab
  4. Click Move and pick a new location for Documents
  5. Click OK
  6. Run Get-PSProfile
  7. Note that user profiles are no longer detected

Expected behavior
Expect the function to locate the profile when it is in the Documents Folder in the standard location.

Screenshots
In this screenshot I ran the command, then moved my Documents folder to OneDrive. The warnings are a side effect of a change I was experimenting with of detecting both VS Code and VS Code Insiders.
image

Desktop (please complete the following information):

  • Operating System Version: 10.0.19041 (Windows 10 2004)
  • Module Version: 2.30.0 (downloaded and ran from git repository)
  • PowerShell Version: 7.0.3

Additional context
I have some code that will detect the proper location that I would like to submit as a PR. This would also be an issue in a corporate environment that has redirected the Documents folder to a network drive or other location.

I'll have to look into this further. Although you are welcome to submit a PR. And even though it shouldn't make a difference, you should really install the module from the PowerShell Gallery and not download this repository.