Script Functions not loading from One Drive Folder

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

This topic contains 4 replies, has 3 voices, and was last updated by

 
Participant
2 days, 8 hours ago.

  • 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

    Moderator
    Topics: 8
    Replies: 817
    Points: 2,424
    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: 938
    Points: 1,634
    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: 938
    Points: 1,634
    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.

You must be logged in to reply to this topic.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort