
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Install Specific Version of PowerShell Module
To install the specific version of the PowerShell module, we need to use the -RequiredVersion parameter with the Install-Module command.
To find which module versions are available, we can use the Find-Module command with the -AllVersions parameter which retrieves all the versions of the module available in the PSGallery.
In this example, we will use the 7Zip4PowerShell module.
Example
Find-Module 7zip4PowerShell -AllVersions | ft -AutoSize
When you run this command, you can see there are multiple versions available for this module.
Output
Version Name Repository ------- ---- ---------- 1.13.0 7Zip4Powershell PSGallery 1.12.0 7Zip4Powershell PSGallery 1.11.0 7Zip4Powershell PSGallery 1.10.0.0 7Zip4Powershell PSGallery 1.9.0 7Zip4Powershell PSGallery 1.8.0 7Zip4Powershell PSGallery 1.7.1 7Zip4Powershell PSGallery
We need to install here version 1.9.0 for all the users, so we will use the below command.
Example
Install-Module 7Zip4PowerShell -RequiredVersion 1.8.0 -Scope AllUsers -Force -Verbose
To install PowerShell module on the remote server, use the below command,
Syntax
Invoke-Command -ComputerName RemoteMachine1 -ScriptBlock {Install-Module 7Zip4PowerShell -RequiredVersion 1.8.0 -Scope AllUsers -Force -Verbose}
Advertisements