powershell scope CurrentUser 1

powershell scope CurrentUser

if ($env:PSModulePath -notlike "*D:\Documents\WindowsPowerShell\Modules*")
{
  $env:PSModulePath = $env:PSModulePath + ";D:\Documents\WindowsPowerShell\Modules"
}

Here is what the above code is Doing:
1. It’s checking to see if the path to the modules folder is already in the PSModulePath environment variable.
2. If it’s not, it adds it.
3. It then saves the new value to the environment variable.

Similar Posts