3 0

Download & Update Simplex

Do not overwrite on install. Install in Update folder and copy/paste/overwrite to Simplex folder to retain file permissions.

Register components:

regsvr32 /s S:\Simplex\EAGetMailObj.dll
regsvr32 /s S:\Simplex\EASendMailObj.dll
REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\VxD\VREDIR" /v "DiscardCacheOnOpen" /t REG_DWORD /d 1 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /v "EnableOplockForceClose" /t REG_DWORD /d 1 /f

Install DLLs:
$SimplexPath = "S:\Simplex"
$File = "DLLRegistratie.exe"
Start-Process -FilePath "$SimplexPath\$File" -ArgumentList "/SILENT /NORESTART /CLOSEAPPLICATIONS /NOICONS /MERGETASKS=!desktopicon" -Wait

[showhide type="10221431" more_text="Click to show example 1022 + 1431" less_text="Example 1022 + 1431:"]

# Stop and disable Services
Get-ScheduledTask -TaskPath "\Simplex\" | Disable-ScheduledTask
Get-Process -Name "simplex*" | Where-Object { $_.ProcessName -notlike "simdb*" } | Stop-Process -Force
Set-Service -Name "svSimDbService" -Status stopped -StartupType Disabled

# Back-up, Download and install
$BackupPath = "S:\Backup"
$UpdatePath = "S:\Update"
$SimplexPath = "S:\Simplex"
$DownloadPath = "C:\Users\Public\Downloads"
$Link = "https://download.simplex-dental.nl/SimplexSetup.exe"
$File = "SimplexSetup.exe"

# Set other variables
$DateFolder = (Get-Date).ToString("yyyyMMdd")

# Back-up
mkdir $BackupPath\$DateFolder
Copy-Item -Path $SimplexPath\gsn.* -Destination $BackupPath\$DateFolder | Out-Null
Copy-Item -Path $SimplexPath\lex\userdic.tlx -Destination $BackupPath\$DateFolder | Out-Null

# Download
$ProgressPreference = "SilentlyContinue"
if (Test-Path $DownloadPath\$File) {
  Remove-Item $DownloadPath\$File
}
Invoke-WebRequest -Uri $Link -OutFile $DownloadPath\$File -UseBasicParsing

# Install to UpdatePath
Start-Process -FilePath "$DownloadPath\$File" -ArgumentList "/SILENT /NORESTART /DIR=$UpdatePath\$DateFolder /NOICONS /MERGETASKS=!desktopicon" -Wait
Remove-Item -fo $UpdatePath\$DateFolder\lex\userdic.tlx

# Copy to SimplexPath
Copy-Item $Updatepath\$DateFolder\* $SimplexPath -Force -Recurse

# Register MailObj.dll
regsvr32 /s $SimplexPath\EAGetMailObj.dll
regsvr32 /s $SimplexPath\EASendMailObj.dll

# Add terminalserver=1
$filePath = "S:\Simplex\Simwinstart.ini"
$content = Get-Content -Path $filePath
if ($content -match "^terminalserver=") {
    $content = $content -replace "^terminalserver=.*", "terminalserver=1"
} else {
    $content += "terminalserver=1"
}
Set-Content -Path $filePath -Value $content

# Enable and Start Services
Set-Service -Name "svSimDbService" -StartupType Automatic -Status running
Get-ScheduledTask -TaskPath "\Simplex\" | Enable-ScheduledTask

[/showhide]

[showhide type="1047" more_text="Click to show example 1047" less_text="Example 1047:"]

# Stop and disable Services
Get-ScheduledTask -TaskPath "\Simplex\" | Disable-ScheduledTask
Get-Process -Name "simplex*" | Where-Object { $_.ProcessName -notlike "simdb*" } | Stop-Process -Force
Set-Service -Name "SimserverSMS" -Status stopped -StartupType Disabled
Set-Service -Name "svSimDbService" -Status stopped -StartupType Disabled

# Back-up, Download and install
$BackupPath = "S:\Backup"
$UpdatePath = "S:\Update"
$SimplexPath = "S:\Simplex"
$DownloadPath = "C:\Users\Public\Downloads"
$Link = "https://download.simplex-dental.nl/SimplexSetup.exe"
$File = "SimplexSetup.exe"

# Set other variables
$DateFolder = (Get-Date).ToString("yyyyMMdd")

# Back-up
mkdir $BackupPath\$DateFolder
Copy-Item -Path $SimplexPath\gsn.* -Destination $BackupPath\$DateFolder | Out-Null
Copy-Item -Path $SimplexPath\lex\userdic.tlx -Destination $BackupPath\$DateFolder | Out-Null

# Download
$ProgressPreference = "SilentlyContinue"
if (Test-Path $DownloadPath\$File) {
  Remove-Item $DownloadPath\$File
}
Invoke-WebRequest -Uri $Link -OutFile $DownloadPath\$File -UseBasicParsing

# Install to UpdatePath
Start-Process -FilePath "$DownloadPath\$File" -ArgumentList "/SILENT /NORESTART /DIR=$UpdatePath\$DateFolder /NOICONS /MERGETASKS=!desktopicon" -Wait
Remove-Item -fo $UpdatePath\$DateFolder\lex\userdic.tlx

# Copy to SimplexPath
Copy-Item $Updatepath\$DateFolder\* $SimplexPath -Force -Recurse

# Register MailObj.dll
regsvr32 /s $SimplexPath\EAGetMailObj.dll
regsvr32 /s $SimplexPath\EASendMailObj.dll

# Add terminalserver=1
$filePath = "S:\Simplex\Simwinstart.ini"
$content = Get-Content -Path $filePath
if ($content -match "^terminalserver=") {
    $content = $content -replace "^terminalserver=.*", "terminalserver=1"
} else {
    $content += "terminalserver=1"
}
Set-Content -Path $filePath -Value $content

# Enable and Start Services
Set-Service -Name "svSimDbService" -StartupType Automatic -Status running
Set-Service -Name "SimserverSMS" -StartupType Automatic -Status running
Get-ScheduledTask -TaskPath "\Simplex\" | Enable-ScheduledTask

[/showhide]

[showhide type="1004" more_text="Click to show example 1004" less_text="Example 1004:"]

# Stop and disable Services
Get-ScheduledTask -TaskPath "\Simplex\" | Disable-ScheduledTask
Get-Process -Name "simplex*" | Where-Object { $_.ProcessName -notlike "simdb*" } | Stop-Process -Force
Set-Service -Name "SimserverSMS" -Status stopped -StartupType Disabled
Set-Service -Name "svSimDbService" -Status stopped -StartupType Disabled
Set-Service -Name "svSimDbServiceTPB" -Status stopped -StartupType Disabled

# Back-up, Download and install
# Edit variables
$BackupPath = "S:\Backup"
$UpdatePath = "S:\Update"
$SimplexPath = "S:\"
$Simplex = "Simplex"
$TPB = "TPB"
$DownloadPath = "C:\Users\Public\Downloads"
$Link = "https://download.simplex-dental.nl/SimplexSetup.exe"
$File = "SimplexSetup.exe"

# Set other variables
$DateFolder = (Get-Date).ToString("yyyyMMdd")

# Back-up
mkdir $BackupPath\$DateFolder
mkdir $BackupPath\$DateFolder\$TPB
mkdir $BackupPath\$DateFolder\$Simplex

Copy-Item -Path $SimplexPath\$TPB\$Simplex\gsn.* -Destination $BackupPath\$DateFolder\$TPB | Out-Null
Copy-Item -Path $SimplexPath\$TPB\$Simplex\lex\userdic.tlx -Destination $BackupPath\$DateFolder\$TPB | Out-Null
Copy-Item -Path $SimplexPath\$Simplex\gsn.* -Destination $BackupPath\$DateFolder\$Simplex | Out-Null
Copy-Item -Path $SimplexPath\$Simplex\lex\userdic.tlx -Destination $BackupPath\$DateFolder\$Simplex | Out-Null

# Download
$ProgressPreference = "SilentlyContinue"
if (Test-Path $DownloadPath\$File) {
  Remove-Item $DownloadPath\$File
}
Invoke-WebRequest -Uri $Link -OutFile $DownloadPath\$File -UseBasicParsing

# Install to UpdatePath
Start-Process -FilePath "$DownloadPath\$File" -ArgumentList "/SILENT /NORESTART /DIR=$UpdatePath\$DateFolder /NOICONS /MERGETASKS=!desktopicon" -Wait
Remove-Item -fo $UpdatePath\$DateFolder\lex\userdic.tlx

# Copy to SimplexPath
Copy-Item $Updatepath\$DateFolder\* $SimplexPath\$Simplex -Force -Recurse
Copy-Item $Updatepath\$DateFolder\* $SimplexPath\$TPB\$Simplex -Force -Recurse

# Register MailObj.dll
regsvr32 /s $SimplexPath$Simplex\EAGetMailObj.dll
regsvr32 /s $SimplexPath$Simplex\EASendMailObj.dll

# Function to edit the file
function Edit-SimwinstartFile($filePath) {
    $content = Get-Content -Path $filePath
    if ($content -match "^terminalserver=") {
        $content = $content -replace "^terminalserver=.*", "terminalserver=1"
    } else {
        $content += "terminalserver=1"
    }
    Set-Content -Path $filePath -Value $content
}

# Edit the first file
$filePath1 = "S:\Simplex\Simwinstart.ini"
Edit-SimwinstartFile -filePath $filePath1

# Edit the second file
$filePath2 = "S:\TPB\Simplex\Simwinstart.ini"
Edit-SimwinstartFile -filePath $filePath2

# Enable and Start Services
Set-Service -Name "svSimDbService" -StartupType Automatic -Status running
Set-Service -Name "SimserverSMS" -StartupType Automatic -Status running
Set-Service -Name "svSimDbServiceTPB" -StartupType Automatic -Status running
Get-ScheduledTask -TaskPath "\Simplex\" | Enable-ScheduledTask

[/showhide]

[showhide type="1329" more_text="Click to show example 1329" less_text="Example 1329:"]

# Stop and disable Services
Get-ScheduledTask -TaskPath "\Simplex\" | Disable-ScheduledTask
Get-Process -Name "simplex*" | Where-Object { $_.ProcessName -notlike "simdb*" } | Stop-Process -Force
Set-Service -Name "SMUSSvrc" -Status stopped -StartupType Disabled
Set-Service -Name "svSimDbService" -Status stopped -StartupType Disabled

# Back-up, Download and install
$BackupPath = "S:\Backup"
$UpdatePath = "S:\Update"
$SimplexPath = "S:\Simplex"
$DownloadPath = "C:\Users\Public\Downloads"
$Link = "https://download.simplex-dental.nl/SimplexSetup.exe"
$File = "SimplexSetup.exe"

# Set other variables
$DateFolder = (Get-Date).ToString("yyyyMMdd")

# Back-up
mkdir $BackupPath\$DateFolder
Copy-Item -Path $SimplexPath\gsn.* -Destination $BackupPath\$DateFolder | Out-Null
Copy-Item -Path $SimplexPath\lex\userdic.tlx -Destination $BackupPath\$DateFolder | Out-Null

# Download
$ProgressPreference = "SilentlyContinue"
if (Test-Path $DownloadPath\$File) {
  Remove-Item $DownloadPath\$File
}
Invoke-WebRequest -Uri $Link -OutFile $DownloadPath\$File -UseBasicParsing

# Install to UpdatePath
Start-Process -FilePath "$DownloadPath\$File" -ArgumentList "/SILENT /NORESTART /DIR=$UpdatePath\$DateFolder /NOICONS /MERGETASKS=!desktopicon" -Wait
Remove-Item -fo $UpdatePath\$DateFolder\lex\userdic.tlx

# Copy to SimplexPath
Copy-Item $Updatepath\$DateFolder\* $SimplexPath -Force -Recurse

# Register MailObj.dll
regsvr32 /s $SimplexPath\EAGetMailObj.dll
regsvr32 /s $SimplexPath\EASendMailObj.dll

# Add terminalserver=1
$filePath = "S:\Simplex\Simwinstart.ini"
$content = Get-Content -Path $filePath
if ($content -match "^terminalserver=") {
    $content = $content -replace "^terminalserver=.*", "terminalserver=1"
} else {
    $content += "terminalserver=1"
}
Set-Content -Path $filePath -Value $content

# Enable and Start Services
Set-Service -Name "svSimDbService" -StartupType Automatic -Status running
Set-Service -Name "SMUSSvrc" -StartupType Automatic -Status running
Get-ScheduledTask -TaskPath "\Simplex\" | Enable-ScheduledTask

[/showhide]

[showhide type="mc" more_text="Click to show example MC" less_text="Example MC:"]

# Back-up, Download and install
# Edit variables
$BackupPath = "C:\SimplexBackup"
$UpdatePath = "C:\SimplexUpdate"
$SimplexPath = "C:\Simplex"
$DownloadPath = "C:\Users\Public\Downloads"
$Link = "https://download.simplex-dental.nl/SimplexSetup.exe"
$File = "SimplexSetup.exe"

# Set other variables
$DateFolder = (Get-Date).ToString("yyyyMMdd")

# Close Simplex
Get-Process -Name "simplex*" | Where-Object { $_.ProcessName -notlike "simdb*" } | Stop-Process -Force

# Create folders
if (-Not (Test-Path $BackupPath)) {
  New-Item -ItemType directory -Path $BackupPath
}
mkdir $BackupPath\$DateFolder
if (-Not (Test-Path $UpdatePath)) {
  New-Item -ItemType directory -Path $UpdatePath
}
mkdir $UpdatePath\$DateFolder

# Back-up
Copy-Item -Path $SimplexPath\gsn.* -Destination $BackupPath\$DateFolder | Out-Null
Copy-Item -Path $SimplexPath\lex\userdic.tlx -Destination $BackupPath\$DateFolder | Out-Null
Copy-Item -Path $SimplexPath\Simplex2022.exe -Destination $BackupPath\$DateFolder | Out-Null

# Download
$ProgressPreference = "SilentlyContinue"
if (Test-Path $DownloadPath\$File) {
  Remove-Item $DownloadPath\$File
}
Invoke-WebRequest -Uri $Link -OutFile $DownloadPath\$File -UseBasicParsing

# Install to UpdatePath
Start-Process -FilePath "$DownloadPath\$File" -ArgumentList "/SILENT /NORESTART /DIR=$UpdatePath\$DateFolder /NOICONS /MERGETASKS=!desktopicon" -Wait
Remove-Item -fo $UpdatePath\$DateFolder\lex\userdic.tlx

# Copy to SimplexPath
Copy-Item $Updatepath\$DateFolder\* $SimplexPath -Force -Recurse

# Register MailObj.dll
regsvr32 /s $SimplexPath\EAGetMailObj.dll
regsvr32 /s $SimplexPath\EASendMailObj.dll

[/showhide]

[showhide type="demo" more_text="Click to show example demo" less_text="Example demo:"]

$SimplexPath = "C:\Simplex"
$DownloadPath = "C:\Users\Public\Downloads"
$Link = "https://www.gsn.nl/download/5218/"
$File = "SimplexDemo.exe"

# Download
$ProgressPreference = "SilentlyContinue"
if (Test-Path $DownloadPath\$File) {
  Remove-Item $DownloadPath\$File
}
Invoke-WebRequest -Uri $Link -OutFile $DownloadPath\$File -UseBasicParsing

# Install to SimplexPath
Start-Process -FilePath "$DownloadPath\$File" -ArgumentList "/SILENT /NORESTART /DIR=$SimplexPath"
Start-Sleep -Seconds 10
$Shell = New-Object -ComObject WScript.Shell
$Location = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs"
$Application = "SimplexDemo.lnk"
$Shortcut = $shell.CreateShortcut("$Location\$Application")
$Shortcut.TargetPath = "C:\Simplex\Simplex2022.exe"
$Shortcut.IconLocation = "C:\Simplex\Simplex2022.exe,0"
$Shortcut.Description = "Simplex Demo"
$Shortcut.WorkingDirectory = "C:\Simplex\"
if (-Not (Test-Path $Location\$Application)) {
$Shortcut.Save()
}
REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\VxD\VREDIR" /v "DiscardCacheOnOpen" /t REG_DWORD /d 1 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /v "EnableOplockForceClose" /t REG_DWORD /d 1 /f

[/showhide]

[showhide type="Optimalisatie" more_text="Click to show Optimalisatie" less_text="Optimalisatie:"]

# Stop and disable Services
Get-Process -Name "simplex*" | Stop-Process -Force
Set-Service -Name "svSimDbService" -Status stopped -StartupType Disabled

# Edit variables
$BackupPath = "S:\Backup"
$SimplexPath = "S:\Simplex"
$DateFolder = (Get-Date).ToString("yyyyMMdd")

# Back-up
mkdir $BackupPath\$DateFolder
Copy-Item -Path $SimplexPath\gsn.* -Destination $BackupPath\$DateFolder | Out-Null

# Enable and Start Services
Set-Service -Name "svSimDbService" -StartupType Automatic -Status running

[/showhide]