0 0

VisiQuick installation Azure SQL

VisiQuick:
https://downloads.citodent.com/pub/VisiQuick/Latest/

Microsoft OLE DB Driver for SQL Server:
C:\VisiQuick_installer\Tools\Database\Sql Server Client\MsOleDbForSql\msoledbsql(x64).msi C:\VisiQuick_installer\Tools\Database\Sql Server Client\Native\sqlncli-x64.msi

If version latest version is not installed, Download, Unzip and Install latest version:

# Function to get the latest version from JSON
function Get-LatestVersion {
    $jsonUrl = "https://downloads.citodent.com/pub/VisiQuick/Latest/visiquick-latest-version.json"
    $jsonContent = Invoke-RestMethod -Uri $jsonUrl -Method Get
    $global:downloadUrl = $jsonContent.DownloadURL
    $majorVersion = $jsonContent.MajorVersion
    $minorVersion = $jsonContent.MinorVersion
    $releaseVersion = $jsonContent.ReleaseVersion
    $buildNumber = $jsonContent.BuildNumber
    $latestVersion = "$majorVersion.$minorVersion.$releaseVersion.$buildNumber"
    Write-Host "Latest version: $latestVersion"
    Write-Host "Download URL: $downloadUrl"
    return $latestVersion
}

# Settings
$lang = "NL"
$ToothNum = "FDI"
$DateFolder = (Get-Date).ToString("yyyyMMddHHmmss")

# Folders
$Path = "C:\Users\Public\Downloads"
$installdrive = "C:\"
$Folder = "VisiQuick"
$VisiQuick = "VisiQuick.exe"
$Sharedfolder = "\SharedData"

# Function to handle version issues
function Handle-Version-Issue {
    param (
        [string]$message
    )
    Write-Host $message
    Write-Host "Starting the update process for VisiQuick..."
    
    # Download the latest VisiQuick installer
    Write-Host "Downloading the latest VisiQuick installer..."
    $ProgressPreference = "SilentlyContinue"
    $File = $downloadUrl.Split('/')[-1]
    $DownloadPath = Join-Path -Path $Path -ChildPath $File
    Invoke-WebRequest -Uri $downloadUrl -OutFile $DownloadPath -UseBasicParsing
    Write-Host "Download completed: $DownloadPath"
    
    # Extract the downloaded file
    Write-Host "Extracting the downloaded file..."
    $ExtractionPath = Join-Path -Path $Path -ChildPath $Folder
    if (Test-Path -Path $ExtractionPath) {
        Write-Host "Renaming existing folder: $ExtractionPath to $DateFolder"
        Rename-Item -Path $ExtractionPath -NewName "$DateFolder"
    }
    Expand-Archive -Path $DownloadPath -DestinationPath $ExtractionPath -Force
    Write-Host "Extraction completed to: $ExtractionPath"
    
    # Clear pending file rename operations (precaution)
    Write-Host "Clearing pending file rename operations (if any)..."
    cmd /c "reg delete 'HKLM\SYSTEM\CurrentControlSet\Control\Session Manager' /v PendingFileRenameOperations /f 2>nul"
    Write-Host "Pending file rename operations cleared."
    
    # Install the necessary components
    Write-Host "Installing SQL Server Client (MS OLE DB)..."
    Start-Process "msiexec.exe" -ArgumentList "/i `"$ExtractionPath\Tools\Database\Sql Server Client\MsOleDbForSql\msoledbsql(x64).msi`" /qn /L*v `"$Path\msoleinstall.log`" IACCEPTMSOLEDBSQLLICENSETERMS=YES" -Wait
    Write-Host "SQL Server Client installation completed."
    
    Write-Host "Installing VisiQuick..."
    Start-Process "msiexec.exe" -ArgumentList "/i `"$ExtractionPath\Msi\VisiQuicksetup.msi`" /qn /L*v `"$Path\vqinstall.log`" INSTALLDIR=`"$installdrive$Folder`" VQSHAREDFOLDER=`"$installdrive$Folder$Sharedfolder`" VQLANG=$lang TOOTHNUMBERING=$ToothNum" -Wait
    Write-Host "VisiQuick installation completed."
    Write-Host "Update process completed."
}

# Main script logic
$latestVersion = Get-LatestVersion

if (Test-Path "$installdrive$Folder\$VisiQuick") {
    $currentVersion = [System.Version]::Parse((Get-Item "$installdrive$Folder\$VisiQuick").VersionInfo.ProductVersion)
    $latestVersionObject = [System.Version]::Parse($latestVersion)
    
    if ($currentVersion -ge $latestVersionObject) {
        Write-Host "$VisiQuick is up to date: $($currentVersion.ToString())"
    } else {
        Handle-Version-Issue "$VisiQuick is not up to date. Current version: $($currentVersion.ToString()), Latest version: $latestVersion"
    }
} else {
    Handle-Version-Issue "$VisiQuick not found in $installdrive$Folder."
}

Installation:

$installdrive="C:\"
$installfolder="VisiQuick"
$Sharedfolder="\SharedData"
$MSI_Path="C:\VisiQuick_installer\Msi"
$lang="NL" # DK;NL;US;FR;GE;IT;ES;SW;NO
$ToothNum="FDI" # FDI;USA;DANISH;BRITTISH
new-item -Path $installdrive -name $installfolder -ItemType "Directory"
msiexec.exe /i $MSI_Path\VisiQuicksetup.msi /qn /L*v install.log INSTALLDIR=$installdrive$installfolder VQSHAREDFOLDER=$installdrive$installfolder$Sharedfolder VQLANG=$Lang TOOTHNUMBERING=$ToothNum

Download, unzip and install:

$ProgressPreference = "SilentlyContinue"
$installdrive="C:\"
$Folder = "VisiQuick"
$Sharedfolder="\SharedData"
$Link = "https://downloads.citodent.com/pub/VisiQuick/Latest/"
$Response = Invoke-WebRequest -Uri $Link
$File = $Response.ParsedHtml.getElementsByTagName('a') | Where-Object { $_.href -like '*.zip' } | ForEach-Object { $_.innerText }
$Path = "C:\Users\Public\Downloads"
Invoke-WebRequest -Uri "$Link$File" -OutFile $Path\$File -UseBasicParsing
Expand-Archive "$Path\$File" "$Path\$Folder"
$lang="NL"
$ToothNum="FDI"
cmd /c "reg delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager" /v PendingFileRenameOperations /f 2>nul"
msiexec.exe /i "$Path\$Folder\Tools\Database\Sql Server Client\MsOleDbForSql\msoledbsql(x64).msi"  /qn /L*v $Path\msoleinstall.log IACCEPTMSOLEDBSQLLICENSETERMS=YES
Start-Sleep -Seconds 10
msiexec.exe /i $Path\$Folder\Msi\VisiQuicksetup.msi /qn /L*v $Path\vqinstall.log INSTALLDIR=$installdrive$Folder VQSHAREDFOLDER=$installdrive$Folder$Sharedfolder VQLANG=$Lang TOOTHNUMBERING=$ToothNum

Obtain the latest version number and its download link:
$jsonUrl = "https://downloads.citodent.com/pub/VisiQuick/Latest/visiquick-latest-version.json"
$jsonContent = Invoke-RestMethod -Uri $jsonUrl -Method Get
$downloadUrl = $jsonContent.DownloadURL
$majorVersion = $jsonContent.MajorVersion
$minorVersion = $jsonContent.MinorVersion
$releaseVersion = $jsonContent.ReleaseVersion
$buildNumber = $jsonContent.BuildNumber
$latestversion = "$majorVersion.$minorVersion.$releaseVersion.$buildNumber"
Write-Host "$downloadUrl"
Write-Host "$latestversion"

Intune detectieregel:
# Define the target version
$targetVersion = "4.7.3.4585"

# Check if VisiQuick.exe exists
$visiQuickPath = "C:\VisiQuick\VisiQuick.exe"
if (Test-Path $visiQuickPath) {
    # Get the version of VisiQuick.exe
    $version = [System.Version]::Parse((Get-Item $visiQuickPath).VersionInfo.ProductVersion)

    # Check if the version matches the target version
    if ($version.ToString() -eq $targetVersion) {
        Write-Host "VisiQuick is at correct version: $($version.ToString())"
        Exit 0  # Success
    } else {
        Write-Host "VisiQuick version mismatch: $($version.ToString())"
        Exit 1001  # Wrong version
    }
} else {
    Write-Output "VisiQuick.exe not found at C:\VisiQuick\"
    Exit 1  # File not found
}