Redirection of the \Documents\WindowsPowerShell folder to OneDrive cause issues with Az modules

Brass Contributor

I would like to share my experience with redirected to OneDrive PowerShell folder.
Original path of the folder: 
C:\Users\<username>\Documents\WindowsPowerShell
Redirected to OneDrive path:
C:\Users\<username>\OneDrive\Documents\WindowsPowerShell

Since folder was redirected, I get issues with uninstall of previous versions of the
Az PowerShell modules.

Cmdlet Uninstall-Module with option -Force return successful result of the module
delete operation, while modules folders remains in
C:\Users\<username>\OneDrive\Documents\WindowsPowerShell\Modules folder.

I set option "Always keep on device" for WindowsPowerShell folder, retry delete
operation, same result.

As workaround I use following solution - delete all Az modules folders from
Modules folder.
Since then I was able to uninstall old versions of the Az PowerShell modules in
C:\Program Files\WindowsPowerShell\Modules folder.

 

PowerShell work paths remains without changes. Would be great to have option in
OneDrive sync settings to exclude Documents\WindowsPowerShell\ folder from
redirection to OneDrive.

Useful information about uninstall procedure of Az modules:
https://docs.microsoft.com/en-us/powershell/azure/uninstall-az-ps?view=azps-6.0.0

 

0 Replies