Hey all, so… I know there’s plenty of people complaining about the lack of an MSI package for v20 (myself included). With that said, I have wrote out a complete script for mass domain deployment. All you need is the MSIX package stored on your typical network app deployment location.

# Define the name of the software
$softwareName = “3CX”

# Define the path to the MSIX package
$msixPath = “\\YOUR_FQDN_HERE\deploy$\3CX\3CX.msix”

# Log file path
$logFile = “$env:TEMP\3CXInstallationLog.txt”

# Function to log messages
function Write-Log {
param (
[string]$Message
)
$timestamp = Get-Date -Format “yyyy-MM-dd HH:mm:ss”
$logMessage = “$timestamp – $Message”
Write-Output $logMessage
Add-Content -Path $logFile -Value $logMessage
}

# Log the user identity
$userIdentity = whoami
Write-Log “Script is being executed by: $userIdentity”

# Check if the package is already installed
$existingPackage = Get-AppxPackage | Where-Object { $_.Name -like “*$softwareName*” }

if ($existingPackage) {
Write-Output “$softwareName is already installed. Skipping installation.”
exit
} else {
Write-Log “Starting script execution.”

Write-Log “Checking for existing installation of $softwareName…”

if (Test-Path -Path $msixPath) {
Write-Log “Found MSIX package at $msixPath. Starting installation…”

try {
# Install the MSIX package
Add-AppxPackage -Path $msixPath
Write-Log “$softwareName has been installed successfully.”
} catch {
$errorMessage = “An error occurred during the installation: $_.Exception.Message”
Write-Log $errorMessage
Write-Error $errorMessage
}
} else {
$errorMessage = “MSIX package for $softwareName not found at $msixPath. Please verify the path.”
Write-Log $errorMessage
Write-Error $errorMessage
}

Write-Log “Script execution completed.”
}

Hope this helps someone else down the line. You can fire this as a ps1 on logon for your on net users. For off net users, assuming you have a VPN, you can create a scheduled task that triggers on the event id of your successful VPN connection, which then fires off the above script as well.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *