forked from pnp/PnP-PowerShell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Install.ps1
22 lines (16 loc) · 845 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
$source = $PSScriptRoot;
$programFilesFolder = [environment]::getfolderpath("ProgramFilesX86");
$PnPRoot = "$programFilesFolder\OfficeDevPnP";
$ModuleHome = "$PnPRoot\PowerShell\Modules\OfficeDevPnP.PowerShell.Commands"
New-Item -Path $ModuleHome -ItemType Directory -Force
Write-Host "Copying files from $source to $ModuleHome"
Copy-Item "$source\*.dll" -Destination "$ModuleHome"
Copy-Item "$source\*help.xml" -Destination "$ModuleHome"
Copy-Item "$source\*.psd1" -Destination "$ModuleHome"
Copy-Item "$source\*.ps1xml" -Destination "$ModuleHome"
$CurrentValue = [Environment]::GetEnvironmentVariable("PSModulePath", "Machine")
if($CurrentValue.Contains($PnPRoot) -ne $true)
{
[Environment]::SetEnvironmentVariable("PSModulePath", $CurrentValue + ";$PnPRoot", "Machine")
}
Write-Host "Restart PowerShell to make the commands available."