2

I've come across this (archived) Blog post on PowerShell profiles. In the learning docs I read a note that the scripts should not be stored on OneDrive. Users probably will use the standard settings of OneDrive backing up Documents, Desktop and Pictures to OneDrive. I'm quite confused now. Are these locations in blog and learning still accurate as of 2024?

What location should I use for what type of scripts or modules?

1
  • The best location is anywhere that OneDrive does not sync. The default is Documents, so either set it to somewhere else, or don't backup your documents, but rather move the files in Documents manually to your OneDrive, and place a link to it in your documents.
    – LPChip
    Commented Feb 17 at 22:01

1 Answer 1

1

The blog post you have found is from 2012 and refers to an older version of Windows. While most of it is still correct, the profile folders are not up to date.

The article you found is more recent from 2023, so is to be taken seriously. The "Current user, Current Host" profile location is said to be in $HOME\Documents\PowerShell, which refers to C:\Users\USER-NAME\Documents\PowerShell.

If you install OneDrive, it will by default backup the Documents folder, by relocating it into the OneDrive sync folder and leaving only a pointer to it in C:\Users\USER-NAME.

This means that, if you have accepted the default setup of OneDrive, your PowerShell profiles are by default synced to OneDrive, but your reference is to a local folder. The profiles will be backed up to OneDrive, but the reference should stay to the local disk, not to the OneDrive folder in the cloud, to avoid problems when there is no internet connection.

2
  • 1
    This is not true, and I speak of a horrible experience. Yes, powershell's profile is the documents folder, but if you allow OneDrive to backup the Documents, not only will it move everything to the OneDrive, the powershell profile will be moved there too, and this is a big issue as powershell now becomes really slow with things like autocomplete and starting up. So the last paragraph about the reference is a local folder and its only a backup is not correct.
    – LPChip
    Commented Feb 17 at 21:58
  • The biggest problem is that OneDrive keeps a lock on the file like a virus scanner on overdrive.
    – LPChip
    Commented Feb 17 at 22:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .