guruxp / CleanPersonMetadata

0 stars 2 forks source link

Get the location of ExchangeOnlineManagement #1

Closed owenmurr closed 3 years ago

owenmurr commented 3 years ago

The location of Microsoft.IdentityModel.Clients.ActiveDirectory.dll is looking at 2.0.3 version of ExchangeOnlineManagement. If the user doesnt have this version installed then the script will fail.

I have added in the following variable: $dllLocation = (Get-InstalledModule ExchangeOnlineManagement).InstalledLocation

And changed the import-module to: Import-Module "$($dllLocation)\netFramework\Microsoft.IdentityModel.Clients.ActiveDirectory.dll" -force

owenmurr commented 3 years ago

Any further updates on this?

owenmurr commented 3 years ago

So I have added a IF statement to check if the version is less than or equal to 2.0.3 or if its greater than or equal to 2.0.4.

This should resolve the issue if a user have <= 2.0.3 or if a user has >= 2.0.4.

The script runs on my machine without any issues on my machine, I have 2.0.3 and 2.0.4 installed.