forked from PowerShell/PowerShell-IoT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMove-PSIoTBuild.ps1
48 lines (40 loc) · 1.11 KB
/
Move-PSIoTBuild.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
36
37
38
39
40
41
42
43
44
45
46
47
48
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
param (
[Parameter(ValueFromPipeline=$true, Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string[]]
$Ip,
[Parameter()]
[string[]]
$WithExample,
[Parameter()]
[switch]
$Build
)
begin {
$sessions = @()
}
process {
Write-Host "Connecting to $Ip"
$sessions += New-PSSession -HostName $Ip -UserName pi
}
end {
if ($Build) {
Invoke-Build
}
$sessions | ForEach-Object {
$session = $_
# Should compress and decompress
Copy-Item "$PSScriptRoot\out\Microsoft.PowerShell.IoT" "/usr/local/share/powershell/Modules/Microsoft.PowerShell.IoT" -Recurse -Force -ToSession $session
if ($WithExample) {
$WithExample | ForEach-Object {
$path = "$PSScriptRoot\Examples\$_"
if (Test-Path $path) {
# Should compress and decompress
Copy-Item $path "/usr/local/share/powershell/Modules" -Recurse -Force -ToSession $session
}
}
}
}
}