2. Modul dari PowerShell Gallery dan Komunitas
PowerShell Gallery is the official repository for PowerShell modules created by the community and developers. You can search for and install modules from the PowerShell Gallery using the Find-Module and Install-Module cmdlets.
Example for searching for and installing modules from the PowerShell Gallery:
Find-Module -Name Az -Repository PSGallery
Install-Module -Name Az -Force
Module Az is an example of a module used to manage Azure services using PowerShell.
3. Modul Kustom yang Dibuat oleh Pengguna
Users can also create and share custom modules to meet the specific needs of an organization or project. These modules can include custom scripts and functions written by users to automate specific tasks.
How to Load Modules Using Import-Module
To load modules that are already installed or available in a specific directory, use the Import-Module cmdlet. Once the module is loaded, you can use the cmdlets and functions that are in that module in your PowerShell session.
Example of loading a built-in module or a pre-installed module:
Import-Module Microsoft.PowerShell.Management
To load a module from a local directory or a custom module:
Import-Module “C:\Path\To\Your\Module\MyCustomModule.psm1”
If you want to make sure that imported modules are available in each PowerShell session, you can add this command to the PowerShell profile file.