Delete-PersistentApps.ps1
function Delete-PersistentApps { <# .SYNOPSIS This function ... .DESCRIPTION A bit more description .PARAMETER FromPipeline Shows how to process input from the pipeline, remaining parameters or by named parameter. .EXAMPLE Delete-PersistentApps 'abc' Description of the example. #> <# Enable -Confirm and -WhatIf. #> [CmdletBinding(SupportsShouldProcess = $true)] param( [parameter(Mandatory=$false,Position=0)] [string]$persistentAppManagerBaseFolder ="c:\qlikEngine", [parameter(Mandatory=$false,Position=1)] [string]$persistentAppManagerWebHostAndPort = "http://localhost:3000", [parameter(Mandatory=$false,Position=2)] [switch]$IncludepersistentAppDefDeploy ) begin { } process { If($IncludepersistentAppDefDeploy.IsPresent){ Copy-Item -Path C:\Migrate\persistentAppDefs $persistentAppManagerBaseFolder -Recurse -Force } $fileInputs = gci C:\Migrate\persistentAppDefs #TODO: Add Switch to the copy item forEach($fileInput in $fileInputs){ $json = (@{ persistentFile=$fileInput.BaseName; } | ConvertTo-Json -Compress -Depth 10) return Invoke-Post ($persistentAppManagerWebHostAndPort += "/deletePersistent") $json } } end { } } if ($loadingModule) { Export-ModuleMember -Function 'Delete-PersistentApps' } |