Created
March 1, 2017 19:08
-
-
Save joel74/f5acb78ca7dbe0d87bc95cab98de1388 to your computer and use it in GitHub Desktop.
PowerShell script to install F5-LTM module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script will download the latest version of the F5-LTM PowerShell module from github and install it for the current user. | |
# Thanks to DarkOperator for doing all the heavy lifting for this snippet | |
# https://gist.github.com/darkoperator/3f9da4b780b5a0206bca | |
# Make sure the module is not loaded | |
Remove-Module F5-LTM -ErrorAction SilentlyContinue | |
# Download latest version | |
$webclient = New-Object System.Net.WebClient | |
$url = "https://github.com/joel74/POSH-LTM-Rest/archive/master.zip" | |
Write-Output "Downloading latest version of F5-LTM from $url" -ForegroundColor Cyan | |
$file = "$($env:TEMP)\F5-LTM.zip" | |
$webclient.DownloadFile($url,$file) | |
Write-Output "File saved to $file" -ForegroundColor Green | |
# Unblock and decompress | |
Unblock-File -Path $file | |
$targetondisk = "$($env:USERPROFILE)\Documents\WindowsPowerShell\Modules" | |
New-Item -ItemType Directory -Force -Path $targetondisk | out-null | |
$shell_app=new-object -com shell.application | |
$zip_file = $shell_app.namespace($file) | |
Write-Output "Uncompressing the Zip file to $($targetondisk)" -ForegroundColor Cyan | |
$destination = $shell_app.namespace($targetondisk) | |
$destination.Copyhere($zip_file.items(), 0x10) | |
# Rename and import | |
Write-Output "Renaming folder" -ForegroundColor Cyan | |
Rename-Item -Path ($targetondisk+"\POSH-LTM-Rest-master") -NewName "F5-LTM" -Force | |
Write-Output "Module has been installed" -ForegroundColor Green | |
Import-Module -Name F5-LTM | |
Get-Command -Module F5-LTM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello @ShaneJ7769 thks por this code, it is work