r/PowerShell • u/ZM9272 • Dec 16 '25
Powershell broken with known folder move
So we have known folder move enable with one drive witch is a known issue with powershell in general. Currently I'm unable to load any modules because it keeps looking in the user directory in documents powershellget fails to load because it fails to load a required module.
Even if I completely removed the powershell folder from my documents folder, it still will not use the system instance of powershellget. I have to implicitly give it the direct path to the windows powershell folder to make it load and even then other modules still don't load because they always attempt to load for my user folder and not the system folder. Does anyone know any way to fix this? Powershell 7. Works for the most part, but there's some modules that still do not work in powershell 7.
If I completely erase my user profile off the PC sign back in so it creates a new user profile. Powershell will work for like one instance and then after that it's broken again.
1
u/ZM9272 Dec 16 '25
I checked the system environment variables and only the system paths are there but in powershell the psenvmodule variable shows the system path and the user document path. I was able to temporarily fix it by fully deleting the windows powershell folder from the document folder but when i install or update modules I have to use the scope all users to make sure it puts it in the system path because as soon as it goes back in my documents path it breaks.
The annoying thing with the gnome folder move is it puts your company name in the path and our company name has lots of spaces in it and I know Windows does not play very well with that but powershell doesn't translate those
1
u/Medium-Comfortable Dec 17 '25
No issues with PowerShell 5 or 7 on Windows. You say it’s a known issue? Where you got that from?
3
u/purplemonkeymad Dec 16 '25
Check your environment variables, you might have a rouge user variable for PSModulePath that is masking the system paths. IIRC EntraID sync does this annoyingly.
2
u/Federal_Ad2455 Dec 16 '25
Hmm no issues here and we have moved folders too. Using 5.1 and 7.x versions without issues.
2
u/BlackV Dec 17 '25
sound like you have manually specified (or similar) your module path somehow
redirected folders has worked for a long time, the only catch for one drive is making the 2 powershell folders set to always available offline, have you done that ?
1
u/SirThane Dec 17 '25
I like using OneDrive and backing up my known folders but hated programs and scripts going for the original paths. I manually junctioned the original folders targeting the new OneDrive paths. Gotta make sure the original is empty, including hidden files, but it's piss easy and works a treat.
Iirc e.g.
New-Item -Path ~\Documents -ItemType Junction -Target ~\OneDrive\DocumentsMay misremember the parameter names. On mobile.