After doing some changes to my machine, PowerShell fails because the $PROFILE
variable points to a different location than before, causing problems like installed modules not found, etc:
C:\PowerShell\Microsoft.PowerShell_profile.ps1
$env:UserProfile\Documents\Powershell\Microsoft.PowerShell_profile.ps1
How does PowerShell set the value of $PROFILE
, and can it be changed?
I came across this while searching for an answer - the profile will be found under a new directory:
$env:UserProfile\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
To change where PowerShell looks for the default profile, you need to change a Registry key:
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
Personal
to the directory of your choice Automated way with PowerShell:
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "Personal" -Value "DRIVEHERE"`
Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "Personal"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With