-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathUse-SeqServer.ps1
More file actions
30 lines (25 loc) · 825 Bytes
/
Use-SeqServer.ps1
File metadata and controls
30 lines (25 loc) · 825 Bytes
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
<#
.SYNOPSIS
Set the default Server and ApiKey for Send-SeqEvent.ps1
.FUNCTIONALITY
Seq
.LINK
https://getseq.net/
.EXAMPLE
Use-SeqServer.ps1 http://my-seq $apikey
#>
#requires -Version 4
[CmdletBinding()][OutputType([void])] Param(
# The URL of the Seq server.
[Parameter(Mandatory=$true)][uri] $Server,
# The Seq API key to use.
[string] $ApiKey
)
Write-Verbose "Using Seq at $Server"
$value = @{
'Send-SeqEvent.ps1:Server' = $Server
'Send-SeqEvent.ps1:ApiKey' = $ApiKey
}
$defaults = Get-Variable -Scope 1 -Name PSDefaultParameterValues -EA SilentlyContinue
if($defaults) {$value.Keys |Where-Object {$defaults.Value.Contains($_)} |ForEach-Object {$defaults.Value.Remove($_)}; $defaults.Value += $value}
else {Set-Variable -Scope 1 -Name PSDefaultParameterValues -Value $value}