michelderooij / Invoke-Unarchive

Exchange script to move contents back from personal archives to primary mailboxes
https://eightwone.com/2021/08/14/unarchiving-mailbox-items/
MIT License
6 stars 1 forks source link

facing challenges to complete dependencies of MSAL Library #2

Closed k4kunal354 closed 2 years ago

k4kunal354 commented 2 years ago

being newbie in coding, i am finding it difficult to install all the dependencies required. can you suggest simple way to install all the dependencies including MSAL library.

michelderooij commented 2 years ago

Register-PackageSource -provider NuGet -name nugetRepository -location https://www.nuget.org/api/v2 Install-Package exchange.webservices.managed.api -ProviderName NuGet Install-Package Microsoft.Identity.Client -ProviderName NuGet

k4kunal354 commented 2 years ago

Hi, I installed Microsoft.Identity.Client silently to skip the dependency because i was constantly getting error of dependency loop. Now you can see in following transcript i have Module installed,

PS C:\Users\userx\OneDrive\Common Need To Know\PowerShell\Invoke-Unarchive-main> Install-Package Microsoft.Identity.Client -ProviderName NuGet -Verbose VERBOSE: Using the provider 'NuGet' for searching packages. VERBOSE: Searching repository 'https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.Identity.Client'' for ''. VERBOSE: Total package yield:'1' for the specified package 'Microsoft.Identity.Client'. VERBOSE: Skipping installed package Microsoft.Identity.Client 4.42.1.

but when i try to run the command it gives me following error of Dll.

PS C:\Users\userx\OneDrive\Common Need To Know\PowerShell\Invoke-Unarchive-main> .\Invoke-Unarchive.ps1 -Identity TestArchive@noveltypharma.onmicrosoft.com -Credentials $Credentials -Impersonation -Server outlook.office365.com -Verbose VERBOSE: Loading module C:\Program Files\PackageManagement\NuGet\Packages\Exchange.WebServices.Managed.Api.2.2.1.2\lib\net35\Microsoft.Exchange.WebServices.dll VERBOSE: Loading module from path 'C:\Program Files\PackageManagement\NuGet\Packages\Exchange.WebServices.Managed.Api.2.2.1.2\lib\net35\Microsoft.Exchange.WebServices.dll'. VERBOSE: Module Microsoft.Exchange.WebServices v2.2.1.0 loaded VERBOSE: Required module Microsoft.Identity.Client.dll could not be located PS C:\Users\userx\OneDrive\Common Need To Know\PowerShell\Invoke-Unarchive-main>

Please help me in this case

michelderooij commented 2 years ago

Or you might need to run elevated (as dll's are installed in protected folder), or copy Microsoft.Exchange.WebServices.dll and Microsoft.Identity.Client.dll to folder where script is located, might need to unblock (properties), and run it in regular context. If you have problems with the modules, you can download versions of those files from the Remove-DuplicateItems repo and store them with the script if needed to be independent.

k4kunal354 commented 2 years ago

I downloaded dll's from your repo. unblocked them.. then added impersonation using exchange online permission article of yours... thats it.. Hurray... it worked brilliantly.. thank you very much