-
Notifications
You must be signed in to change notification settings - Fork 1
/
Install.ps1
35 lines (29 loc) · 1.17 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
26
27
28
29
30
31
32
33
34
35
param([string]$InstallDirectory)
$ModName = "PSSessionManager"
$repo = "PowerShell-Session-Manager"
$userid = "jrich523"
if ('' -eq $InstallDirectory)
{
$personalModules = Join-Path -Path ([Environment]::GetFolderPath('MyDocuments')) -ChildPath WindowsPowerShell\Modules
if (($env:PSModulePath -split ';') -notcontains $personalModules)
{
Write-Warning "$personalModules is not in `$env:PSModulePath"
}
if (!(Test-Path $personalModules))
{
Write-Error "$personalModules does not exist"
}
$InstallDirectory = Join-Path -Path $personalModules -ChildPath $ModName
}
if (!(Test-Path $InstallDirectory))
{
$null = mkdir $InstallDirectory
}
$wc = New-Object System.Net.WebClient
$wc.DownloadFile("https://raw.github.com/$userid/$repo/master/$modname.psd1","$installDirectory\$ModName.psd1")
Push-Location
cd $InstallDirectory
(Import-LocalizedData -FileName "$ModName.psd1").filelist | %{$wc.DownloadFile("https://raw.github.com/$userid/$repo/master/$_","$installDirectory\$_")}
gci | Unblock-File
Pop-Location
#iex (new-object System.Net.WebClient).DownloadString('https://raw.github.com/jrich523/PowerShell-Session-Manager/master/Install.ps1')