Error:
Import-Module : Could not load file or assembly 'System.Management.Automation, Version=7.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhD6tFVQ5zjPfQPjc7U0hi1OLR0iIcIfdiYdf7Xty4_edM2yjxRyqCi0o0Ht4aswVzcIwAp6DGuXKcYvUksMI3YBlJQKa-1ouXwGxd4dbCrOlzB7JsCNyGJd6oL984t7U9azV88KfozHHswfjnQRTk_TjIGRiVRgrokqn3fTU-z8mTIjzedNE2050_GV5w/s16000/Pnp%20Poweshell%20System%20Manageent%20Automation%20assembly%20error%201.png)
Then I thought it might be helpful if I switch to Windows PowerShell ISE to debug what is happening. And it showed me more details like the commands I was searching for were not included in the module.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjztxS7Pw5dWUYChHiqpv7vmmTBS3kCFv0zU7RNb_-9hhN2y1D8-h8TCzBg-wrhoZAMjdXAQJO6lxP6F7nY-DDth8ZQaVp7pbz1WWQPwZELYvshwbiYKicJtb1W1V20oM3c33UxKVKas34pkBqeXYFLn3whyEWqolkd9HpQyNFgqViodTWdjb2lnBxE1J8/s16000/Pnp%20Poweshell%20System%20Manageent%20Automation%20assembly%20error%202.png)
Solution:
After some digging, I found out that with this issue happened with the newer version PnP PowerShell 2.1.1. We need to forcefully install 1.12.0 version.
- Uninstall all versions and then install correct 1.12.0 version. Use below command to remove all the version:
Uninstall-Module PNP.PowerShell -AllVersions
- Set Tls12 protocol with below command
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
- Install NuGet using below command
Install-PackageProvider -Name nuget -MinimumVersion 2.8.5.201 -force
- Install PnP.PowerShell with version 1.12.0 using below command
Install-Module -Name "PnP.PowerShell" -RequiredVersion 1.12.0 -Force –AllowClobber
Reference: