Adds help for several Cmdlets

This commit is contained in:
Lord Hepipud 2020-05-22 09:52:48 +02:00
parent c4179338a1
commit 84975a4759
10 changed files with 236 additions and 0 deletions

View file

@ -1,3 +1,29 @@
<#
.SYNOPSIS
Installs the Icinga Plugins PowerShell module from a remote or local source
.DESCRIPTION
Installs the Icinga PowerShell Plugins from a remote or local source into the
PowerShell module folder and makes them available for usage with Icinga 2 or
other components.
.FUNCTIONALITY
Installs the Icinga Plugins PowerShell module from a remote or local source
.EXAMPLE
PS>Install-IcingaFrameworkPlugins;
.EXAMPLE
PS>Install-IcingaFrameworkPlugins -PluginsUrl 'C:/icinga/icinga-plugins.zip';
.EXAMPLE
PS>Install-IcingaFrameworkPlugins -PluginsUrl 'https://github.com/Icinga/icinga-powershell-plugins/archive/v1.0.0.zip';
.PARAMETER PluginsUrl
The URL pointing either to a local or remote ressource to download the plugins from. This requires to be the
full path to the .zip file to download.
.INPUTS
System.String
.OUTPUTS
System.Hashtable
.LINK
https://github.com/Icinga/icinga-powershell-framework
#>
function Install-IcingaFrameworkPlugins()
{
param(

View file

@ -1,3 +1,29 @@
<#
.SYNOPSIS
Installs the Icinga PowerShell Services as a Windows service
.DESCRIPTION
Uses the Icinga Service binary which is already installed on the system to register
it as a Windows service and sets the proper user for it
.FUNCTIONALITY
Installs the Icinga PowerShell Services as a Windows service
.EXAMPLE
PS>Install-IcingaFrameworkService -Path C:\Program Files\icinga-service\icinga-service.exe;
.EXAMPLE
PS>Install-IcingaFrameworkService -Path C:\Program Files\icinga-service\icinga-service.exe -User 'NT Authority\NetworkService';
.PARAMETER Path
The location on where the service binary executable is found
.PARAMETER User
The service user the service is running with
.PARAMETER Password
If the specified service user is requiring a password for registering you can provide it here as secure string
.INPUTS
System.String
.OUTPUTS
System.Object
.LINK
https://github.com/Icinga/icinga-powershell-framework
#>
function Install-IcingaFrameworkService()
{
param(

View file

@ -1,3 +1,27 @@
<#
.SYNOPSIS
Update the current version of the PowerShell Framework with a newer or older one
.DESCRIPTION
Allows you to specify a download url or being asked by a wizard on where a update for
the PowerShell framework can be fetched from and applies the up- or downgrade
.FUNCTIONALITY
Update the current version of the PowerShell Framework with a newer or older one
.EXAMPLE
PS>Install-IcingaFrameworkUpdate;
.EXAMPLE
PS>Install-IcingaFrameworkUpdate -FrameworkUrl 'C:/icinga/framework.zip';
.EXAMPLE
PS>Install-IcingaFrameworkUpdate -FrameworkUrl 'https://github.com/Icinga/icinga-powershell-framework/archive/v1.0.2.zip';
.PARAMETER FrameworkUrl
The url to a remote or local ressource pointing directly to a .zip file containing the required files for updating
.INPUTS
System.String
.OUTPUTS
Null
.LINK
https://github.com/Icinga/icinga-powershell-framework
#>
function Install-IcingaFrameworkUpdate()
{
param(

View file

@ -1,3 +1,32 @@
<#
.SYNOPSIS
Wrapper for Remove-Item to secuerly remove items allowing better handling for errors
.DESCRIPTION
Removes files and folders from disk and catches possible exceptions with proper return
values to handle errors better
.FUNCTIONALITY
Wrapper for Remove-Item to secuerly remove items allowing better handling for errors
.EXAMPLE
PS>Remove-ItemSecure -Path C:\icinga;
.EXAMPLE
PS>Remove-ItemSecure -Path C:\icinga -Recurse;
.EXAMPLE
PS>Remove-ItemSecure -Path C:\icinga -Recurse -Force;
.PARAMETER Path
The path to a file or folder you wish you delete
.PARAMETER Recurse
Removes sub-folders and sub-files for a given location
.PARAMETER Force
Tries to forefully removes a files and folders if they are either being used or a folder is
still containing items
.INPUTS
System.String
.OUTPUTS
System.Boolean
.LINK
https://github.com/Icinga/icinga-powershell-framework
#>
function Remove-ItemSecure()
{
param(

View file

@ -1,3 +1,23 @@
<#
.SYNOPSIS
Wrapper for Restart-Service which catches errors and prints proper output messages
.DESCRIPTION
Restarts a service if it is installed and prints console messages if a restart
was triggered or the service is not installed
.FUNCTIONALITY
Wrapper for restart service which catches errors and prints proper output messages
.EXAMPLE
PS>Restart-IcingaService -Service 'icinga2';
.PARAMETER Service
The name of the service to be restarted
.INPUTS
System.String
.OUTPUTS
Null
.LINK
https://github.com/Icinga/icinga-powershell-framework
#>
function Restart-IcingaService()
{
param(
@ -7,5 +27,7 @@ function Restart-IcingaService()
if (Get-Service $Service -ErrorAction SilentlyContinue) {
Write-IcingaConsoleNotice ([string]::Format('Restarting service "{0}"', $Service));
Restart-Service $Service;
} else {
Write-IcingaConsoleWarning -Message 'The service "{0}" is not installed' -Objects $Service;
}
}

View file

@ -1,3 +1,23 @@
<#
.SYNOPSIS
Wrapper for Start-Service which catches errors and prints proper output messages
.DESCRIPTION
Starts a service if it is installed and prints console messages if a start
was triggered or the service is not installed
.FUNCTIONALITY
Wrapper for Start-Service which catches errors and prints proper output messages
.EXAMPLE
PS>Start-IcingaService -Service 'icinga2';
.PARAMETER Service
The name of the service to be started
.INPUTS
System.String
.OUTPUTS
Null
.LINK
https://github.com/Icinga/icinga-powershell-framework
#>
function Start-IcingaService()
{
param(
@ -5,6 +25,9 @@ function Start-IcingaService()
);
if (Get-Service $Service -ErrorAction SilentlyContinue) {
Write-IcingaConsoleNotice -Message 'Starting service "{0}"' -Objects $Service;
Start-Service $Service;
} else {
Write-IcingaConsoleWarning -Message 'The service "{0}" is not installed' -Objects $Service;
}
}

View file

@ -1,3 +1,23 @@
<#
.SYNOPSIS
Wrapper for Stop-Service which catches errors and prints proper output messages
.DESCRIPTION
Stops a service if it is installed and prints console messages if a stop
was triggered or the service is not installed
.FUNCTIONALITY
Wrapper for Stop-Service which catches errors and prints proper output messages
.EXAMPLE
PS>Stop-IcingaService -Service 'icinga2';
.PARAMETER Service
The name of the service to be stopped
.INPUTS
System.String
.OUTPUTS
Null
.LINK
https://github.com/Icinga/icinga-powershell-framework
#>
function Stop-IcingaService()
{
param(
@ -5,6 +25,9 @@ function Stop-IcingaService()
);
if (Get-Service $Service -ErrorAction SilentlyContinue) {
Write-IcingaConsoleNotice -Message 'Stopping service "{0}"' -Objects $Service;
Stop-Service $Service;
} else {
Write-IcingaConsoleWarning -Message 'The service "{0}" is not installed' -Objects $Service;
}
}

View file

@ -1,3 +1,26 @@
<#
.SYNOPSIS
Compares a binary within a .zip file to a included .md5 to ensure
the checksum is matching
.DESCRIPTION
Compares a possible included .md5 checksum file with the provided binary
to ensure they are identical
.FUNCTIONALITY
Compares a binary within a .zip file to a included .md5 to ensure
the checksum is matching.
.EXAMPLE
PS>Test-IcingaZipBinaryChecksum -Path 'C:\Program Files\icinga-service\icinga-service.exe';
.PARAMETER Path
Path to the binary to be checked for. A Corresponding .md5 file with the
extension added on the file is required, like icinga-service.exe.md5
.INPUTS
System.String
.OUTPUTS
Null
.LINK
https://github.com/Icinga/icinga-powershell-framework
#>
function Test-IcingaZipBinaryChecksum()
{
param(

View file

@ -1,3 +1,25 @@
<#
.SYNOPSIS
Unblocks a folder with PowerShell module/script files to make them usable
on certain environments
.DESCRIPTION
Wrapper command to unblock recursively a certain folder for PowerShell script
and module files
.FUNCTIONALITY
Unblocks a folder with PowerShell module/script files to make them usable
on certain environments
.EXAMPLE
PS>Unblock-IcingaPowerShellFiles -Path 'C:\Program Files\WindowsPowerShell\Modules\my-module';
.PARAMETER Path
The path to a PowerShell module folder or script file to unblock it
.INPUTS
System.String
.OUTPUTS
Null
.LINK
https://github.com/Icinga/icinga-powershell-framework
#>
function Unblock-IcingaPowerShellFiles()
{
param(

View file

@ -1,3 +1,21 @@
<#
.SYNOPSIS
Uninstalls the Icinga PowerShell Service as a Windows Service
.DESCRIPTION
Uninstalls the Icinga PowerShell Service as a Windows Service. The service binary
will be left on the system.
.FUNCTIONALITY
Uninstalls the Icinga PowerShell Service as a Windows Service
.EXAMPLE
PS>Uninstall-IcingaFrameworkService;
.INPUTS
System.String
.OUTPUTS
System.Object
.LINK
https://github.com/Icinga/icinga-powershell-framework
#>
function Uninstall-IcingaFrameworkService()
{
Stop-IcingaService 'icingapowershell';