Simple (Windows) Powershell Script to Update BPQ32 v1.1

This very VERY basic script was created for a friend to update their Windows 10 install of BPQ32 to the latest beta releases. As beta releases by John G8BPQ don’t have any identifying characteristics other than file server time stamp, the update process is as simple as downloading the latest binaries and zipped DLL from the same locations periodically.

To get this script to work on your system you will be required to enable Powershell scripts in the system settings. Follow the below menu path to locate the section containing the security override.

Start Menu -> PC Settings -> Updates & Security -> Developer Options -> Scroll down to Powershell section.

Check the box next to ”Change execution policy to allow local Powershell scripts to run” and click Apply.

To create the script, find and run from the start menu:

$BpqUpgradeFolder = "D:\BPQ32\UPGRADE"
$BpqBackupFolder = "D:\BPQ32\UPGRADE_BACKUPS"
$BpqMainFolder = "D:\BPQ32"

$BpqDllName = "bpq32.dll"
$BpqMailName = "BPQMail.exe"
$BpqChatName = "BPQChat.exe"

$BpqDllFile = "$BpqMainFolder\$BpqDllName"
$BpqMailFile = "$BpqMainFolder\$BpqMailName"
$BpqChatFile = "$BpqMainFolder\$BpqChatName"

$BpqDllTemp = "$BpqUpgradeFolder\$BpqDllName"
$BpqMailTemp = "$BpqUpgradeFolder\$BpqMailName"
$BpqChatTemp = "$BpqUpgradeFolder\$BpqChatName"


Write-Host "`n`n`n`n Updating BPQ DLL and EXE files, please make sure BPQ is shut down first... `n`n`n`n`n"



New-Item -ItemType Directory -Force -Path "$BpqUpgradeFolder"
New-Item -ItemType Directory -Force -Path "$BpqBackupFolder"


$BpqDllDate = (Get-Item "$BpqDllFile").LastWriteTime
$BpqMailDate = (Get-Item "$BpqMailFile").LastWriteTime
$BpqChatDate = (Get-Item "$BpqChatFile").LastWriteTime

Write-Host "Cleaning up Temporary files"

Get-ChildItem -Path $BpqUpgradeFolder -File -Recurse | Remove-Item

Write-Host "Downloading Files..."

Invoke-WebRequest -Uri "" -OutFile "$BpqUpgradeFolder\"
Invoke-WebRequest -Uri "" -OutFile "$BpqUpgradeFolder\BPQChat.exe"
Invoke-WebRequest -Uri "" -OutFile "$BpqUpgradeFolder\BPQMail.exe"

echo "Extracting..."

Expand-Archive -Path "$BpqUpgradeFolder\" -DestinationPath "$BpqUpgradeFolder" -Force

# v1.1

$FileDateOriginal = $BpqDllDate
$FileDateDownload = (Get-Item "$BpqDllTemp").LastWriteTime

  $NewFileName = $FileDateOriginal -replace '\s','_'
  $NewFileName = $NewFileName -replace ':','_'
  $NewFileName = $NewFileName -replace '/','_'
  $NewFileName = "$BpqDllName.$NewFileName"

  Write-Host "Backing up $BpqDllFile to $NewFileName"
  Write-Host "`n`n`n"
  Copy-Item "$BpqDllFile" -Destination "$BpqBackupFolder\$NewFileName"

  Copy-Item "$BpqDllTemp" -Destination "$BpqDllFile" 

$FileDateOriginal = $BpqMailDate 
$FileDateDownload = (Get-Item "$BpqMailTemp").LastWriteTime

  $NewFileName = $FileDateOriginal -replace '\s','_'
  $NewFileName = $NewFileName -replace ':','_'
  $NewFileName = $NewFileName -replace '/','_'
  $NewFileName = "$BpqMailName.$NewFileName"

  Write-Host "Backing up $BpqMailFile to $NewFileName"
  Write-Host "`n`n`n"
  Copy-Item "$BpqMailFile" -Destination "$BpqBackupFolder\$NewFileName" -Force

  Copy-Item "$BpqMailTemp" -Destination "$BpqMailFile" -Force

$FileDateOriginal = $BpqChatDate 
$FileDateDownload = (Get-Item "$BpqChatTemp").LastWriteTime

  $NewFileName = $FileDateOriginal -replace '\s','_'
  $NewFileName = $NewFileName -replace ':','_'
  $NewFileName = $NewFileName -replace '/','_'
  $NewFileName = "$BpqChatName.$NewFileName"

  Write-Host "Backing up $BpqChatFile to $NewFileName"
  Write-Host "`n`n`n"
  Copy-Item "$BpqChatFile" -Destination "$BpqBackupFolder\$NewFileName" -Force

  Copy-Item "$BpqChatTemp" -Destination "$BpqChatFile" -Force

Write-Host "Update Complete. Backup files are available in $BpqBackupFolder"

Copy the contents of the script into the upper part of the PowerShell editor,

Then edit the following lines to match your system:

$BpqUpgradeFolder = "D:\BPQ32\UPGRADE"
$BpqBackupFolder = "D:\BPQ32\UPGRADE_BACKUPS"
$BpqMainFolder = "D:\BPQ32"

The ”BpqUpgradeFolder” folder mentioned above is a temporary directory created each time the script is run where the zip file and executables are then downloaded to, the entire directory is erased each time the script is executed, so be sure not to set this incorrectly as you may lose files.

After setting the paths appropriately, use the File menu to save the script into an appropriate location.

Before testing, shut down your BPQ32 application, test the script by using the green Play button in the PowerShell editor. It is necessary to shut down BPQ before running the script from wherever you saved it to.

If you find the articles, or content in general posted here useful, enjoyable or maybe even something else, please consider making a small contribution towards my hosting fund so that I may continue to provide my services for free to as many people as possible.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s