Apr 25 2024 05:41 AM - edited Apr 25 2024 10:09 AM
A couple of days ago I remove Documents from OneDrive which seems to have broken the "Oh my POSH" settings in my various terminals.
PowerShell 7.4.2
PS C:\Dev> $home
C:\Users\daniel
PS C:\Dev> $Profile
\PowerShell\Microsoft.PowerShell_profile.ps1
PS C:\Dev>
It looks like $Profle has lost the preceding C:\Users\daniel\Documents\PowerShell, so is there a way to re-add it, without needing to reinstall PowerShell Core and Windows PowerShell?
Apr 26 2024 09:01 AM
@Daniel Westerdale Does this work? This recreates the profile in it's default location.
New-Item $profile -Force
Apr 28 2024 10:41 AM
Thanks for the reply.
I opened my windows terminal and entered both
# attempt 1
New-Item $profile
# attempt 2
New-Item $profile -Value C:\Users\daniel\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 -force -ItemType File
Unfortunately, neither work.
Apr 28 2024 11:04 AM
Apr 28 2024 12:08 PM - edited Apr 28 2024 12:36 PM
Hi the original issue was caused due my attempting at fixing an invalid profile name on my other laptop with OneDrive Documents in place . Essentially, I want the profile just to reference my local path.
I made another attempt at fixing the profile:
$PROFILE = "$env:USERPROFILE\Documents\PowerShell\Microsoft.PowerShell_profile.ps1"
This re-enables my Oh My Posh settings but doesn't seem to persist the $Profile path
Apr 29 2024 12:46 AM
Apr 29 2024 01:30 AM - edited Apr 29 2024 01:30 AM
Good morning. No backup as yet which I will remedy shortly. I do appear to have lost the My Documents quick access although Downloads, Music, Pictures all seem ok.
You have got me thinking : open up the recycle bin as all my previous PowerShell modules are located at c:\daniel\OneDrive\Documents\WindowsPowerShell\Modules.
Could these be the next steps:
Apr 29 2024 01:34 AM
Apr 29 2024 11:00 AM
Apr 29 2024 11:16 AM
Apr 29 2024 11:40 AM - edited Apr 29 2024 11:55 AM
so these settings should all be enabled
However, when I look at the files to settins: everying in Documents , Pictures etc is added to OneDrive inlcuding Power shell
Now I appear to be miss PSReadline so I guess this not available in new location
PowerShell 7.4.2
Cannot load PSReadline module. Console is running without PSReadline.
Loading personal and system profiles took 2319ms.
$Profile
\PowerShell\Microsoft.PowerShell_profile.ps1
Update: I have installed PSReadline module but in Win 7 session but this is located in C:\Users\daniel\Documents\PowerShell\Modules and so not the OneDrive location . Weirdly, $envPSModulePath looks fine with the OneDirve\Dcouments\PowerShellMdoules incuded in the first entry.
Apr 29 2024 11:52 AM
Apr 29 2024 12:24 PM
Apr 29 2024 01:01 PM
Apr 29 2024 01:26 PM
Solution
Ah in my case I have C:\Users\daniel\OneDrive and also through syncing with the other laptop the C:\Users\danie\OneDrive ( I originally caused issue with my bad spelling lol.)
So do I correct all the ones with the incorrect spelling given I have corrected the issue with the profile name.
Apr 29 2024 01:34 PM
Apr 30 2024 11:29 AM
Looks like your last instruction was pure gold!
I corrected the spelling mistake in some of the entries in
Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
Rebooted and finally.....
At last.
Thanks very much for your advice.
Apr 30 2024 11:57 AM
Apr 29 2024 01:26 PM
Solution
Ah in my case I have C:\Users\daniel\OneDrive and also through syncing with the other laptop the C:\Users\danie\OneDrive ( I originally caused issue with my bad spelling lol.)
So do I correct all the ones with the incorrect spelling given I have corrected the issue with the profile name.