resourcesAfter.ps1

<#
This is an example configuration file
 
By default, it is enough to have a single one of them,
however if you have enough configuration settings to justify having multiple copies of it,
feel totally free to split them into multiple files.
#>


<#
# Example Configuration
Set-PSFConfig -Module 'ax2012.tools' -Name 'Example.Setting' -Value 10 -Initialize -Validation 'integer' -Handler { } -Description "Example configuration setting. Your module can then use the setting using 'Get-PSFConfigValue'"
#>


Set-PSFConfig -Module 'ax2012.tools' -Name 'Import.DoDotSource' -Value $false -Initialize -Validation 'bool' -Description "Whether the module files should be dotsourced on import. By default, the files of this module are read as string value and invoked, which is faster but worse on debugging."
Set-PSFConfig -Module 'ax2012.tools' -Name 'Import.IndividualFiles' -Value $false -Initialize -Validation 'bool' -Description "Whether the module files should be imported individually. During the module build, all module code is compiled into few files, which are imported instead by default. Loading the compiled versions is faster, using the individual files is easier for debugging and testing out adjustments."

Set-PSFConfig -Module 'ax2012.tools' -Name 'active.aos.computername' -Value "" -Initialize -Description "The computername on which the specific AOS instance is running."
Set-PSFConfig -Module 'ax2012.tools' -Name 'active.aos.bindirectory' -Value "" -Initialize -Description "The path to the bin directory where the AOS instance is installed."
Set-PSFConfig -Module 'ax2012.tools' -Name 'active.aos.instance.number' -Value "" -Initialize -Description "The registered instance number the AOS has on the specific machine."
Set-PSFConfig -Module 'ax2012.tools' -Name 'active.aos.instancename' -Value "" -Initialize -Description "The registered instance name the AOS has on the specific machine."
Set-PSFConfig -Module 'ax2012.tools' -Name 'active.aos.databaseserver' -Value "" -Initialize -Description "The registered SQL Server the AOS is communicating with."
Set-PSFConfig -Module 'ax2012.tools' -Name 'active.aos.database' -Value "" -Initialize -Description "The registered database the AOS is saving all its data."
Set-PSFConfig -Module 'ax2012.tools' -Name 'active.aos.modelstoredatabase' -Value "" -Initialize -Description "The registered modelstore database the AOS is storing all its code."
Set-PSFConfig -Module 'ax2012.tools' -Name 'active.aos.aos.port' -Value "" -Initialize -Description "The registered port the AOS is listing for clients on."
Set-PSFConfig -Module 'ax2012.tools' -Name 'active.aos.wsdl.port' -Value "" -Initialize -Description "The registered WSDL port the AOS is exposing WSDL services on."
Set-PSFConfig -Module 'ax2012.tools' -Name 'active.aos.nettcp.port' -Value "" -Initialize -Description "The registered NetTcp port the AOS is exposing Custom services on."

Set-PSFConfig -Module 'ax2012.tools' -Name 'active.logicapp.email' -Value "" -Initialize -Description "The registered email address the Invoke-AxLogicApp should notify when firing a notification request."
Set-PSFConfig -Module 'ax2012.tools' -Name 'active.logicapp.url' -Value "" -Initialize -Description "The registered URL/URI the Invoke-AxLogicApp should contact when firing a notification request."
Set-PSFConfig -Module 'ax2012.tools' -Name 'active.logicapp.subject' -Value "" -Initialize -Description "The registered subject the Invoke-AxLogicApp should use as context when firing a notification request."


<#
# Example:
Register-PSFTeppScriptblock -Name "ax2012.tools.alcohol" -ScriptBlock { 'Beer','Mead','Whiskey','Wine','Vodka','Rum (3y)', 'Rum (5y)', 'Rum (7y)' }
#>


<#
# Example:
Register-PSFTeppArgumentCompleter -Command Get-Alcohol -Parameter Type -Name ax2012.tools.alcohol
#>


New-PSFLicense -Product 'ax2012.tools' -Manufacturer 'Motz' -ProductVersion $script:ModuleVersion -ProductType Module -Name MIT -Version "1.0.0.0" -Date (Get-Date "2018-10-03") -Text @"
Copyright (c) 2018 Motz
 
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
 
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"@


$Script:TimeSignals = @{}

Write-PSFMessage -Level Verbose -Message "Gathering all variables to assist the different cmdlets to function" -FunctionName "Variables.ps1"

$Script:IsAdminRuntime = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)

$Script:AxPowerShellModule = "C:\Program Files\Microsoft Dynamics AX\60\ManagementUtilities\Microsoft.Dynamics.ManagementUtilities.ps1"

$Script:RegistryAos = "HKLM:\SYSTEM\ControlSet001\Services\Dynamics Server\6.0"

$Script:RegistryClient = "HKCU:\Software\Microsoft\Dynamics\6.0\Configuration"

$Script:LayerDictionary = @{"ISV" = "01."; "ISP" = "02."; "VAR" = "03."; "VAP" = "04."; "CUS" = "05."; "CUP" = "06."; "USR" = "07." ; "USP" = "08."}

$Script:ClientBin = Get-ClientBinDir

#Microsoft.Dynamics.BusinessConnectorNet.dll

Update-ActiveVariables

$Script:DefaultTempPath = "c:\temp\ax2012.tools"

# ActiveAosAosPort -
# ActiveAosBindirectory -
# ActiveAosComputername -
# ActiveAosDatabase -
# ActiveAosInstancename -
# ActiveAosInstanceNumber -
# ActiveAosModelstoredatabase -
# ActiveAosNettcpPort -
# ActiveAosWsdlPort -

$maskOutput = @(
    "AccessToken"
)

(Get-Variable -Scope Script) | ForEach-Object {
    $val = $null

    if ($maskOutput -contains $($_.Name)) {
        $val = "The variable was found - but the content masked while outputting."
    }
    else {
        $val = $($_.Value)
    }
   
    Write-PSFMessage -Level Verbose -Message "$($_.Name) - $val" -Target $val -FunctionName "Variables.ps1"
}

Write-PSFMessage -Level Verbose -Message "Finished outputting all the variable content." -FunctionName "Variables.ps1"