Script Functions not loading from One Drive Folder

Welcome Forums General PowerShell Q&A Script Functions not loading from One Drive Folder

Viewing 4 reply threads
  • Author
    Posts
    • #156737
      Participant
      Topics: 5
      Replies: 5
      Points: 15
      Rank: Member

      I have an issue where if a script function either as a module or a .ps1 will not load in Powershell 5 or above if the file is in One Drive. It will simply fail silently. I have this issue in 1803 and 1809. Has anyone else had this issue? Just curious.

    • #156740
      Senior Moderator
      Topics: 8
      Replies: 1215
      Points: 4,334
      Helping Hand
      Rank: Community Hero

      When you say the files are in onedrive, how are you importing it, can you show the code snippet you use to import it.

    • #157037
      Participant
      Topics: 2
      Replies: 1013
      Points: 2,093
      Helping Hand
      Rank: Community Hero

      You can only load and use modules, that are installed on your system, or when you physically provide the full path to where the module resides.

      Seeing you OneDive in your file explorer, is not a normal path for this sort of thing. If you are trying to do that, then you need to add the path to your PS paths.

    • #158298
      Participant
      Topics: 5
      Replies: 5
      Points: 15
      Rank: Member

      Both of the below concepts don’t work.

       import-module c:\users\foo\onedrive\bar.psm1

       import-module c:\users\foo\onedrive\bar.ps1

    • #158300
      Participant
      Topics: 2
      Replies: 1013
      Points: 2,093
      Helping Hand
      Rank: Community Hero

      Point of note. What you see in Windows Explorer is not the real path. It’s a translated thing.
      If you want a real filesystem drive to OD, then you have to set that up. You do not say if this is ODP (personal) or ODB (business).
      If it is the later, see this…

      OneDriveMapper automatically map your OneDrive for Business upon login
      This script maps your Onedrive / Sharepoint / Teams document libraries to driveletters (or shortcuts). It can be used in any environment (VDI, RemoteApp, w10 etc).
      https://gallery.technet.microsoft.com/office/OneDriveMapper-automaticall-d7d498b0

      Otherwise , this…

      How to map OneDrive as Network Drive in Windows 10

      I really don’t understand your use case for this, but, I am sure you have your reasons. I have tons of scripts / modules in my ODP/ODB, but I would never run them from there. I download, and set them on the host as normal.

Viewing 4 reply threads
  • The topic ‘Script Functions not loading from One Drive Folder’ is closed to new replies.