Created
January 6, 2021 13:42
-
-
Save lucashalbert/c5c8a3a0ca26db0b85a70b025886c564 to your computer and use it in GitHub Desktop.
Script to automate the installation of the Graylog Sidecar.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Install-GraylogSidecar.ps1 - Script to automate the installation of the Graylog Sidecar. | |
.DESCRIPTION | |
Automates the installation of the Graylog Sidecar. | |
.OUTPUTS | |
Results are output to the PowerShell window. | |
.PARAMETER installer | |
Specify the path to the Graylog Sidecar installer | |
.PARAMETER server | |
Specify the Graylog input URL. | |
.PARAMETER token | |
Specify the Graylog input API token. | |
.PARAMETER skip_tls | |
Specify whether or not to skip TLS verification. | |
.PARAMETER nodename | |
Specify whether or not to skip TLS verification. | |
.EXAMPLE | |
.\Install-GraylogSidecar.ps1 -installer \\corp.domain.tld\NETLOGON\graylog_sidecar_installer_1.0.2-1.exe -server https://graylog.domain.tld/api -token 8675309aaaaabbbb -skip_tls true | |
Installs the Graylog Sidecar from network share \\corp.domain.tld\NETLOGON\graylog_sidecar_installer_1.0.2-1.exe send logs to https://graylog.domain.tld/api with API token 875309aaaaabbbb. Skip TLS verification | |
.EXAMPLE | |
.\Install-GraylogSidecar.ps1 -installer \\corp.domain.tld\NETLOGON\graylog_sidecar_installer_1.0.2-1.exe -server https://graylog.domain.tld/api -token 8675309aaaaabbbb -skip_tls true -nodename node01.domain.tld | |
Installs the Graylog Sidecar from network share \\corp.domain.tld\NETLOGON\graylog_sidecar_installer_1.0.2-1.exe send logs to https://graylog.domain.tld/api with API token 875309aaaaabbbb. Assign nodename node01.domain.tls and skip TLS verification | |
.LINK | |
.NOTES | |
Written by: Lucas Halbert | |
Find me on: | |
* My Website: https://www.lhalbert.xyz | |
* Twitter: https://twitter.com/lucashalbert | |
* My Blog: https://techspertadvice.com | |
* LinkedIn: https://www.linkedin.com/in/lucashalbert | |
* Github: https://github.com/lucashalbert | |
Date: 06/19/2020 | |
Changes: Initial draft | |
#> | |
#requires -version 2 | |
Param( | |
[Parameter( Mandatory=$true)] | |
[string]$installer, | |
[Parameter( Mandatory=$true)] | |
[string]$server, | |
[Parameter( Mandatory=$true)] | |
[string]$token, | |
[Parameter( Mandatory=$false)] | |
[string]$skip_tls, | |
[Parameter( Mandatory=$false)] | |
[string]$nodename | |
) | |
if (!($nodename)) { | |
$sysinfo = Get-WmiObject -Class Win32_ComputerSystem | |
$nodename = ("{0}.{1}" -f $sysinfo.Name, $sysinfo.Domain).ToLower() | |
} | |
if (!($skip_tls)) { | |
$skip_tls = "false" | |
} | |
Write-Hosts "$(Get-Date): Installing and configuring Graylog sidecar" | |
Start-Process -Wait -FilePath $installer -ArgumentList "/S","-SERVERURL=$server","-APITOKEN=$token","-TLS_SKIP_VERIFY=$skip_tls","-NODENAME=$nodename" | |
Write-Hosts "$(Get-Date): Installing Graylog sidecar service" | |
Start-Process -Wait -FilePath C:\Program Files\Graylog\sidecar\graylog-sidecar.exe -ArgumentList "--service","install" | |
Write-Hosts "$(Get-Date): Starting Graylog sidecar service" | |
Start-Process -Wait -FilePath C:\Program Files\Graylog\sidecar\graylog-sidecar.exe -ArgumentList "--service","start" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment