-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpicassio.ps1
61 lines (51 loc) · 1.47 KB
/
picassio.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
49
50
51
52
53
54
55
56
57
58
59
60
61
# example from https://github.com/Badgerati/Picassio2
if ((Get-Module -Name Picassio2 | Measure-Object).Count -ne 0)
{
Remove-Module -Name Picassio2
}
$path = (Split-Path -Parent -Path (Split-Path -Parent -Path $MyInvocation.MyCommand.Path))
Import-Module "$($path)/src/Picassio2.psm1" -ErrorAction Stop
Invoke-Step 'Single' {
Write-PicassioWarning 'Ooh, its a warning!'
}
Invoke-Step 'File Hash' {
$hash = Get-PicassioPathHash -Path $path
Write-PicassioSuccess "Hash: $($hash)"
}
Invoke-ParallelStep 'ParallelTest' @(
{
Write-PicassioInfo 'PARA1'
},
{
Write-PicassioInfo 'PARA2'
},
{
Start-Sleep -Milliseconds 20
Write-PicassioInfo 'PARA3'
}
)
Invoke-Step 'Windows Feature' {
$exists = Test-PicassioWindowsFeatureInstalled -Name 'Web-Server' -Optional
Write-Host "Installed: $($exists)"
}
Send-PicassioSlackMessage -Channel '<CHANNEL>' -Message 'It works!' -APIToken '<TOKEN>' -Colour 'danger'
$fields = @(
@{
'title' = 'Status';
'value' = 'Success';
'short' = $true
},
@{
'title' = 'Date';
'value' = [datetime]::Now.ToShortDateString();
'short' = $true
},
@{
'title' = 'Reason';
'value' = 'Hey look, this works!';
'short' = $false
}
)
Invoke-Step 'Slack Message' {
Send-PicassioSlackAttachments -Channel '<CHANNEL>' -APIToken '<TOKEN>' -Colour 'good' -Fallback 'eek' -Fields $fields -Title 'Example Message'
}