A Powershell module that allows PowerShell users to issue complex API calls to Actifio Global Manager. This module contains what we call composite functions, these being complex combination of API endpoints.
Prerequisites
Install or upgrade AGMPowerLib
Guided Wizards
Usage Examples
User Stories
Contributing
Disclaimer
This module requires AGMPowerCLI to already be installed. Please visit this repo first: https://github.com/Actifio/AGMPowerCLI Once you have installed AGMPowerCLI, then come back here and install AGMPowerLib to get the composite functions.
There are two ways to install AGMPowerCLI:
Install from PowerShell Gallery is the simplest approach.
If running PowerShell 5 on Windows first run this (some older Windows versions are set to use downlevel TLS which will result in confusing error messages):
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Now run this command. It is normal to get prompted to upgrade or install the NuGet Provider. You may see other warnings as well.
Install-Module -Name AGMPowerLib
Note if you run 'Install-Module' to update an installed module, it will complain. You need to run 'Update-module' instead.
If running PowerShell 5 on Windows first run this (some older Windows versions are set to use downlevel TLS which will result in confusing error messages):
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Now run this command:
Update-Module -name AGMPowerLib
It will install the latest version and leave the older version in place. To see the version in use versus all versions downloaded use these two commands:
Get-InstalledModule AGMPowerLib
Get-InstalledModule AGMPowerLib -AllVersions
To uninstall all older versions run this command:
$Latest = Get-InstalledModule AGMPowerLib; Get-InstalledModule AGMPowerLib -AllVersions | ? {$_.Version -ne $Latest.Version} | Uninstall-Module
Many corporate servers will not allow downloads from PowerShell gallery or even access to GitHub from Production Servers, so for these use one of the Git download methods below.
If it finds multiple installs, we strongly recommend you delete them all and run the installer again to have just one install.
The GIT repo could be cloned with this command:
git clone https://github.com/Actifio/AGMPowerLIB.git AGMPowerLIB
For Download you could also use this:
wget https://github.com/Actifio/AGMPowerLib/archive/refs/heads/main.zip
pwsh
Expand-Archive ./main.zip
./main/AGMPowerLib-main/Install-AGMPowerLib.ps1
rm main.zip
rm -r main
If the install fails with this (which usually occurs if you didn't unblock the zip file):
PS C:\Users\av\Downloads\AGMPowerLib-main\AGMPowerLib-main> .\Install-AGMPowerLib.ps1
.\Install-AGMPowerLib.ps1: File C:\Users\av\Downloads\AGMPowerLib-main\AGMPowerLib-main\Install-AGMPowerLib.ps1 cannot be loaded.
The file C:\Users\av\Downloads\AGMPowerLib-main\AGMPowerLib-main\Install-AGMPowerLib.ps1 is not digitally signed.
You cannot run this script on the current system. For more information about running scripts and setting execution policy, see about_Execution_Policies at https://go.microsoft.com/fwlink/?LinkID=135170.
Then run this command:
Get-ChildItem .\Install-AGMPowerLib.ps1 | Unblock-File
Then re-run the installer. The installer will unblock the remaining files.
You can run a silent install by adding -silentinstall or -silentinstall0
By slot we mean the output of $env:PSModulePath where 0 is the first module in the list, 1 is the second module and so on. If the module is already installed, then if you specify -silentinstall or -s it will reinstall in the same folder. If the module is not installed, then by default it will be installed into path 1
PS C:\Windows\system32> $env:PSModulePath.split(';')
C:\Users\avw\Documents\WindowsPowerShell\Modules <-- this is 0
C:\Program Files (x86)\WindowsPowerShell\Modules <-- this is 1
PS C:\Windows\system32>
Or for Unix:
PS /Users/avw> $env:PSModulePath.Split(':')
/Users/avw/.local/share/powershell/Modules <-- this is 0
/usr/local/share/powershell/Modules <-- this is 1
Here is an example of a silent install:
PS C:\Windows\system32> C:\Users\avw\Downloads\AGMPowerLib-main\AGMPowerLib-main\Install-AGMPowerLib.ps1 -silentinstall
Detected PowerShell version: 5
Downloaded AGMPowerLib version: 0.0.0.35
Installed AGMPowerLib version: 0.0.0.35 in C:\Program Files (x86)\WindowsPowerShell\Modules\AGMPowerLib\
Here is an example of a silent upgrade:
PS C:\Windows\system32> C:\Users\avw\Downloads\AGMPowerLib-main\AGMPowerLib-main\Install-AGMPowerLib.ps1 -silentinstall
Detected PowerShell version: 5
Downloaded AGMPowerLib version: 0.0.0.34
Found AGMPowerLib version: 0.0.0.34 in C:\Program Files (x86)\WindowsPowerShell\Modules\AGMPowerLib
Installed AGMPowerLib version: 0.0.0.35 in C:\Program Files (x86)\WindowsPowerShell\Modules\AGMPowerLib
PS C:\Windows\system32>
You can uninstall the module silently by adding -silentuninstall or -u to the Install command.
Usage examples are in a separate document that you will find here
All User Stories were moved to here
The following examples were all moved from the Readme to the Usage Examples page but are here in case you bookmarked them:
Have a patch that will benefit this project? Awesome! Follow these steps to have it accepted.
All files in this repository are under the Apache License, Version 2.0 unless noted otherwise.
This is not an official Google product.