<# Invoke-LFGetBulkAction.ps1 .SYNOPSIS Launches LFGet-BulkAction.ps1 in a hidden, elevated Windows PowerShell session. .DESCRIPTION Starts Windows PowerShell with administrative privileges, hides the console window, and forwards required parameters to LFGet-BulkAction.ps1 so unattended LFGet operations can run with consistent defaults. See LFGet-BulkAction.ps1 for detailed information on parameters defaults, which are required and optional for each LFGet command, and additional examples. Input validation happens in LFGet-BulkAction.ps1, not here. The official product documentation for LFGet is available at: https://doc.laserfiche.com/laserfiche.documentation/12/userguide/en-us/content/install-installer.htm .NOTES Authors (human): Samuel Carson (Laserfiche) Authors (AI): GPT-5-Codex (OpenAI) Date: 2025-11-12 Requires: Administrator privileges to elevate the PowerShell process .PARAMETER Script Path to LFGet-BulkAction.ps1. Defaults to C:\Temp\LFGet\LFGet-BulkAction.ps1. .PARAMETER LFGetCommand LFGet command to execute. Mandatory; supports the same values as LFGet-BulkAction.ps1. .PARAMETER LFGetDirectory Directory containing LFGet.exe and its dependencies. Forwarded when provided. Mandatory when using deployment agents, as the default value is a user AppData directory. .PARAMETER CopyLFGetFromSource Optional source directory containing LFGet.exe and dependencies. Forwarded when provided. .PARAMETER InstallationCode Laserfiche Support site installation code. Forwarded when provided. .PARAMETER DownloadDirectory Download destination for installation packages. Forwarded when provided. .PARAMETER PackageDirectory Directory containing installation packages. Forwarded when provided. .PARAMETER CopyPackagesFromSource Optional source directory containing LFGet packages. Forwarded when provided. .PARAMETER LogDirectory Log destination. Forwarded when provided. .PARAMETER TempDirectory Temporary extraction directory. Forwarded when provided. .PARAMETER Products List of product names to pass through to LFGet-BulkAction.ps1. Forwarded when provided. .OUTPUTS None directly. This script launcher starts a new process and does not generate outputs. All logging is handled by LFGet-BulkAction.ps1. .EXAMPLE .\Invoke-LFGetBulkAction.ps1 -Script 'C:\Temp\LFGet\LFGet-BulkAction.ps1' -LFGetCommand install-product -Products 'WebToolsAgent,WindowsClient' -LFGetDirectory 'C:\Temp\LFGet\LFGet' -InstallationCode 'XXXXXXXXXX' Runs LFGet-BulkAction.ps1 in a hidden elevated session to install the specified products using the specified LFGet directory and installation code. .EXAMPLE .\Invoke-LFGetBulkAction.ps1 -Script 'C:\Temp\LFGet\LFGet-BulkAction.ps1' -LFGetCommand download-product -Products 'WebToolsAgent,WindowsClient' -LFGetDirectory 'C:\Temp\LFGet\LFGet' -InstallationCode 'XXXXXXXXXX' -DownloadDirectory 'C:\Temp\LFGet\Packages' Runs LFGet-BulkAction.ps1 in a hidden elevated session to install the specified products using the specified LFGet directory, installation code, and download directory. .EXAMPLE .\Invoke-LFGetBulkAction.ps1 -Script 'C:\Temp\LFGet\LFGet-BulkAction.ps1' -LFGetCommand install-local-package -Products 'WebToolsAgent,WindowsClient' -LFGetDirectory 'C:\Temp\LFGet\LFGet' -PackageDirectory 'C:\Temp\LFGet\Packages' Runs LFGet-BulkAction.ps1 in a hidden elevated session to install the specified products using the specified LFGet directory and package directory. .EXAMPLE .\Invoke-LFGetBulkAction.ps1 -Script 'C:\Temp\LFGet\LFGet-BulkAction.ps1' -LFGetCommand repair-product -Products 'WindowsClient' -LFGetDirectory 'C:\Temp\LFGet\LFGet' -LogDirectory 'C:\Temp\LFGet\Logs' Runs LFGet-BulkAction.ps1 in a hidden elevated session to repair the specified products using the specified LFGet directory and log directory. .EXAMPLE .\Invoke-LFGetBulkAction.ps1 -Script 'C:\Temp\LFGet\LFGet-BulkAction.ps1' -LFGetCommand uninstall-product -Products 'WebToolsAgent,ScanningSetup' -LFGetDirectory 'C:\Temp\LFGet\LFGet' -LogDirectory 'C:\Temp\LFGet\Logs' Runs LFGet-BulkAction.ps1 in a hidden elevated session to uninstall the specified products using the specified LFGet directory and log directory. .LICENSE MIT License Copyright (c) 2025 Laserfiche 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. #> param( [Parameter()] [ValidateNotNullOrEmpty()] [string] $Script = 'C:\Temp\LFGet\LFGet-BulkAction.ps1', [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string] $LFGetCommand, [string]$LFGetDirectory, [string]$CopyLFGetFromSource, [string]$InstallationCode, [string]$DownloadDirectory, [string]$PackageDirectory, [string]$CopyPackagesFromSource, [string]$LogDirectory, [string]$TempDirectory, [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$Products ) $psExe = "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe" # ensure Windows PowerShell if (-not (Test-Path $Script)) { throw "LFGet bulk action script not found at path '$Script'." } $arguments = New-Object System.Collections.Generic.List[string] $arguments.AddRange([string[]]@( '-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', "`"$($Script.TrimEnd('\'))`"", '-LFGetCommand', "`"$LFGetCommand`"" )) $LFGetCommandParams = [ordered]@{ LFGetDirectory = $LFGetDirectory CopyLFGetFromSource = $CopyLFGetFromSource InstallationCode = $InstallationCode DownloadDirectory = $DownloadDirectory PackageDirectory = $PackageDirectory CopyPackagesFromSource = $CopyPackagesFromSource LogDirectory = $LogDirectory TempDirectory = $TempDirectory Products = $Products } foreach ($entry in $LFGetCommandParams.GetEnumerator()) { if (-not [string]::IsNullOrWhiteSpace($entry.Value)) { $arguments.Add("-{0}" -f $entry.Key) # Trim trailing backslashes to prevent escaping the closing quote $arguments.Add("`"$($entry.Value.TrimEnd('\'))`"") } } $workingDirectory = Split-Path -Path $Script Start-Process -FilePath $psExe ` -ArgumentList $arguments ` -WorkingDirectory $workingDirectory ` -Verb RunAs ` -WindowStyle Hidden