PowerShell 3.0.0 requires .Net framework 3.5.1 otherwise you will encounter error but it will appear like a problem with the script.
- Install .Net framework 3.5.1 from the server manager.
- Always run PowerShell as run as administrator.
- By default, we cannot execute scripts in PowerShell. For the first time, we have to enable Script execution through below command:
- Resolve STA error
Warning: This script must be run in PowerShell started using -STA switch!
Script will attempt to open PowerShell in STA and run re-run script.
To resolve this issue, issue the below command and then execute the command you want to: