Menu

#133 Get-UserPsModulePath() down't handle home folder shares

v1.2.07
closed
nobody
None
1
2015-09-23
2015-09-14
No

The function doesn't handle user names in homefolder shares to find the user module path.
I.e. This won't resolve

\FILERSERVER\DENLI$\Document\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\

A small change to the function will handle this but might capture a wrong path

function Get-UserPsModulePath()
{
$env:PSModulePath.split(";") | ? { $_ -match "\$($env:USERNAME)" }
}

Discussion

  • Michael Sorens

    Michael Sorens - 2015-09-23

    Fixed in 1.2.07
    Used a regex that retains robustness, just optionally looking for a trailing dollar sign.
    "\$($env:USERNAME)`$?\"

     
  • Michael Sorens

    Michael Sorens - 2015-09-23
    • status: open --> closed
     

Log in to post a comment.