Skip to content

Latest commit

History

223 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Input Parameters

When using input parameters to the script

################################################## INPUT#################################################Param(
[hashtable] $params
)
#-----------------------------------------------# DEBUG SWITCH#-----------------------------------------------$debug=$false#-----------------------------------------------# INPUT PARAMETERS, IF DEBUG IS TRUE#-----------------------------------------------if ( $debug ) {
$params= [hashtable]@{
EmailFieldName="Email"TransactionType="Replace"scriptPath="C:\Apteco\Integration\MSSQL"ReplyToEmail=""database="dev"
}
}

Switching to current directory

################################################## SCRIPT ROOT#################################################if ( $debug ) {
# Load scriptpathif ($MyInvocation.MyCommand.CommandType-eq"ExternalScript") {
$scriptPath=Split-Path-Parent -Path $MyInvocation.MyCommand.Definition
} else {
$scriptPath=Split-Path-Parent -Path ([Environment]::GetCommandLineArgs()[0])
}
} else {
$scriptPath="$($params.scriptPath)" }
Set-Location-Path $scriptPath

Loading the settings

################################################## SETTINGS################################################## General settings$functionsSubfolder="functions"$settingsFilename="settings.json"$processId= [guid]::NewGuid()
$moduleName="GETMAILINGS"# Load settings$settings=Get-Content-Path "$($scriptPath)\$($settingsFilename)"-Encoding UTF8 -Raw |ConvertFrom-Json# append a suffix, if in debug modeif ( $debug ) {
$logfile="$($logfile).debug"
}

Loading all functions from a subfolder

################################################## FUNCTIONS#################################################Get-ChildItem".\$($functionsSubfolder)"-Filter "*.ps1"-Recurse |ForEach {
.$_.FullName
}

Other settings

Activate TLS 1.x and SSL3

if ( $settings.changeTLS ) {
$AllProtocols=@( [System.Net.SecurityProtocolType]::Tls12
#[System.Net.SecurityProtocolType]::Tls13,,[System.Net.SecurityProtocolType]::Ssl3
)
[System.Net.ServicePointManager]::SecurityProtocol =$AllProtocols
}

About

Scripts in PowerShell that can be used together with Apteco Interfaces

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages