forked from dfinke/SharePowerShell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.ps1
33 lines (26 loc) · 844 Bytes
/
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
param([string]$InstallDirectory)
$fileList = @(
'SharePowerShell.psm1'
)
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 SharePowerShell
}
if (!(Test-Path $InstallDirectory))
{
mkdir $InstallDirectory | Out-Null
}
$wc = New-Object System.Net.WebClient
$fileList |
ForEach-Object {
$wc.DownloadFile("https://raw.github.com/dfinke/SharePowerShell/master/$_","$installDirectory\$_")
}