Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In switching from traditional mapped drives with an assigned drive letter (for example, N:\ or R:\), there are some changes that may need to be made to the way scripts or application preferences are managed. 

Desktop Applications that require a drive letter

Once OneDrive is activated, all files can be saved via the local path located at: C:\users\%username%\OneDrive - University of Waterloo\ 

Scripting with OneDrive

PowerShell is the replacement for both Command and Batch files. PowerShell provides commands that allow one to interact with OneDrive (or other M365 Cloud Storage Locations).

  • .COM and .BAT files need to must be rewritten to use the OneDrive storage location.

  • Each users user's local OneDrive cache is located at  C:\users\%username%\OneDrive - University of Waterloo\ 

  • Some applications cannot work with Environment Variables such as %username%. In those cases, the logged-in user will need to set the path using their username in the path.  

  • You may also use the OneDrive “Known Folder Move” feature to enable the backup of the Documents folder or the Picture folder to OneDrive.

  • When Known Folder Move is in use any files in the Documents folder can no longer be referenced via C:\users\%username%\Documents. You will need to use the new path indicated above.  

More information about using PowerShell can be found at the Microsoft Learn site 

Other Environment Variables for OneDrive 

OneDrive can also be referenced by using Microsoft-assigned variables: 

  • %OneDriveCommercial% → is used for OneDrive for Organizations' accounts. This means one can also use this in scripts: C:\users\%username%\%OneDriveCommercial%  

  • %OneDriveConsumer% → is used for OneDrive Personal accounts i.e., C:\users\%username%\%OneDriveConsumer% 

  • %OneDrive% → will usually access the first OneDrive connection – and if there is only one connection it works as well for scripting.  

Working with SharePoint Document Libraries via Scripts 

SharePoint Document Libraries can also be accessed via the OneDrive APP.  

...

For information on using the Document Library SYNC service visit the Microsoft guide  

Filter by label (Content by label)
showLabelsfalse
max5
spacesISTKB
showSpacefalse
typepage
cqllabel in ( "onedrive" , "mapped" , "drives" , "powershell" ) and type = "page" and space = "ISTKB"
labelsonedrive files external
Info

Need help?

Contact the IST Service Desk online or 519-888-4567 ext. 44357.

Tip

Article feedback

If you’d like to share any feedback about this article, please let us know.