-
Notifications
You must be signed in to change notification settings - Fork 10
/
Install.ps1
25 lines (21 loc) · 1.26 KB
/
Install.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Run this in an administrative PowerShell prompt to install the FormatPowershellCode PowerShell module:
#
# iex (New-Object Net.WebClient).DownloadString("https://github.com/zloeber/FormatPowershellCode/raw/master/Install.ps1")
# Some general variables
$ModuleName = 'FormatPowershellCode'
$DownloadURL = 'https://github.com/zloeber/FormatPowershellCode/raw/master/release/FormatPowershellCode-current.zip'
# Download and install the module
$webclient = New-Object System.Net.WebClient
$file = "$($env:TEMP)\$($ModuleName).zip"
Write-Host "Downloading latest version of $ModuleName from $DownloadURL" -ForegroundColor Cyan
$webclient.DownloadFile($DownloadURL,$file)
Write-Host "File saved to $file" -ForegroundColor Green
$targetondisk = "$($env:USERPROFILE)\Documents\WindowsPowerShell\Modules\$($ModuleName)"
$null = New-Item -ItemType Directory -Force -Path $targetondisk
$shell_app=new-object -com shell.application
$zip_file = $shell_app.namespace($file)
Write-Host "Uncompressing the Zip file to $($targetondisk)" -ForegroundColor Cyan
$destination = $shell_app.namespace($targetondisk)
$destination.Copyhere($zip_file.items(), 0x10)
Write-Host "Module has been installed!" -ForegroundColor Green
Write-Host "You can now import the module with: Import-Module -Name $ModuleName"