NN.PwshHelper.psm1
#Region './Public/Build-PwshRequestBody.ps1' 0 function Build-PwshRequestBody { [CmdletBinding()] param ( [Parameter(Mandatory)][hashtable]$Params, [array]$ExcludedParams ) process { $Body = $null $Params.Keys.ForEach({ [string]$Key = $_ $Value = $Params.$key if ($ExcludedParams -contains $Key) { return } $Body += @{ $Key = $Value } }) Write-Output ($Body | ConvertTo-Json -Depth 99) } } #EndRegion './Public/Build-PwshRequestBody.ps1' 26 #Region './Public/Write-Log.ps1' 0 function Write-Log { param ( [Parameter(Mandatory,ValueFromPipeline,Position=0)]$Message, [Parameter(Mandatory)][string]$Path ) $logDir = $Path.Substring(0, $Path.lastIndexOf('\')) if (!(Test-Path $logDir)) { $null = New-Item -ItemType Directory $logDir } $timeStamp = Get-Date -Format "yy-MM-dd HH:mm:ss" if ($Message.gettype().Name -eq "String") { Out-File -Path $Path -Append -InputObject "$timeStamp $message" } else { Out-File -Path $Path -Append -InputObject @" $timeStamp ----------------- "@ Out-File -Path $Path -Append -InputObject $Message } } #EndRegion './Public/Write-Log.ps1' 24 |