By using this website, you agree to our Terms of Use (click here)
I am going to start posting some of utility scripts that help me with day to day on-premise tasks with Acumatica.
Here is a script in PowerShell that I use - so I don't have to babysit a dev server when I change out the version of Acumatica.
Steps of this script:
- It verifies that your are an administrate user.
- You pick the version of installer out of the directory of installers.
- It checks to closes ALL windows for Acumatica ERP Configuration Wizard on all profiles (saving the reboot flag from getting tripped).
- It silently uninstalls the current version.
- And installs Acumatica with an unattended install. (no prompts)
Corey Schafer / ERP Technican
E. corey@benpor.com
Bennett/Porter & Associates, Inc.
--
code: (change the directory to point to your installers)
---------------------------------------------------------------------
cls # Check if the current user has administrative rights function Test-AdminRights { $currentUser = [System.Security.Principal.WindowsIdentity]::GetCurrent() $principal = New-Object Security.Principal.WindowsPrincipal($currentUser) return $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) } # Check if the user has administrative rights if (Test-AdminRights) { Write-Host "User has administrative rights." Write-Host "Starting Version Switch" Write-Host "--Please Pick the Version to Install" # Create OpenFileDialog $openFileDialog = New-Object System.Windows.Forms.OpenFileDialog #CHANGE HERE !!! $openFileDialog.InitialDirectory = 'E:\Installers\' $openFileDialog.Filter = "MSI files (*.msi)|*.msi|All files (*.*)|*.*" $openFileDialog.Title = "Select an MSI file to execute" $openFileDialog.Multiselect = $false # Show OpenFileDialog $dialogResult = $openFileDialog.ShowDialog() # Check if an MSI file was selected if ($dialogResult -eq [System.Windows.Forms.DialogResult]::OK) { $msiFilePath = $openFileDialog.FileName Write-Host "Selected MSI file: $msiFilePath" # Execute the selected MSI file try { $windows = Get-Process | ForEach-Object { $_.MainWindowTitle } | Where-Object { $_ -eq "Acumatica ERP Configuration Wizard" } # Close each window found foreach ($window in $windows) { $process = Get-Process | Where-Object { $_.MainWindowTitle -eq $window } if ($process) { $process | ForEach-Object { $_.CloseMainWindow() } Write-Host "Closed window: $window" } else { Write-Host "Window not found: $window" } } Write-Host "Checking for Installed Versions of Acumatica" $MyApp = Get-WmiObject -Class Win32_Product | Where-Object{$_.Name -like "Acumatica*"} if ( $MyApp-ne $null ){ Write-Host "Removing old version" $MyApp.Uninstall() Write-Host "Uninstall Complete" } Write-Host "Starting Installation" Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$msiFilePath`" /qb" -Wait -NoNewWindow Write-Host "Acumatica Version Installed Successfully." } catch { Write-Host "Error executing MSI file: $_" } } else { Write-Host "No MSI file selected." } } else { Write-Host "User does not have administrative rights." }
Very cool. Thank you so much for sharing.