It really works natively in this batch during OS deployment or pushed to computers.
I’m currently in the process of translating all my scripts to PSADT and started with the base software installed on all computers during OS Deployment.
This software is currently installed or deployed on 5.650 computers (2.542 are Windows 10, 3.108 are Windows 7). It’s included in the OSD TS.
We are in the process of upgrading the version from 5.0.5 to 5.2.10.
We have 2 use cases : with or without transfert (meaning with or without dictaphone)
My current batch for 5.2.10 is the same as it was for 5.0.5 :
Here it is (on Windows 10 computers) :
REM Create Tools Directory
md C:\Tools\Zenidoc
REM Kill Running Process
echo.%date% - %time% --------- Debut --------- Kill Running Process >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
taskkill /F /IM “Transfert.exe” >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
taskkill /F /IM “Transfert2.exe” >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
taskkill /F /IM “Recorder.exe” >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
taskkill /F /IM “ZenidocPlus.exe” >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
taskkill /F /IM “UpdCorres.exe” >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
taskkill /F /IM “Zenidoc.exe” >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
taskkill /F /IM “ButtonEventsCL.exe” >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
taskkill /F /IM “ZenPrepaCL.exe” >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
echo.%date% - %time% --------- Fin --------- Kill Running Process >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
REM Delete C:\Zenidoc Directory
echo.%date% - %time% --------- Debut --------- Delete C:\Zenidoc Directory >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
RD C:\Zenidoc /S /Q
echo.%date% - %time% --------- Fin --------- Delete C:\Zenidoc Directory >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
REM Install Zenidoc MSI
msiexec /i “CLDNT3_v5_2_10_CHUNice.msi” INSTALLDIR=C:\Zenidoc TARGETDIR=C:\ /l*v “C:\Tools\Zenidoc\Zenidoc-5210-Base-%computername%.log” /quiet /norestart
REM Install PhilipsSpeechDriversSetup
echo.%date% - %time% --------- Debut --------- Install PhilipsSpeechDriversSetup >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
PhilipsSpeechDriversSetup.exe /S /v/qn
echo.%date% - %time% --------- Fin --------- Install PhilipsSpeechDriversSetup >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
REM Configure Computer
echo.%date% - %time% --------- Debut --------- Configure Computer >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
regedit /s RecordFromThisComputer.reg >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
regedit /s speechmike_clt.reg >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
regedit /s Zenidoc_Run.reg >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
regedit /s recorder-64bits.reg >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
regsvr32.exe “C:\Zenidoc\Code\detectsm\detectsmx.dll” /s >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
regsvr32.exe “C:\Zenidoc\Code\detectsm\spmikectrl.dll” /s >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
copy /y “DetectSMX.dll” “C:\Zenidoc\Code\detectsm\DetectSMX.dll” >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
attrib +R “C:\Zenidoc\Code\detectsm\DetectSMX.dll” >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
echo.%date% - %time% --------- Fin --------- Configure Computer >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
REM Option Client - Base
echo.%date% - %time% --------- Debut --------- Option Client - Base >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
copy /y “TranscriptionAnywhere.ini” “C:\Program Files (x86)\Zenidoc\Client\TranscriptionAnywhere.ini” >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
copy /y “Transfert.exe” “C:\Program Files (x86)\Zenidoc\Transfert.exe” >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
echo.%date% - %time% --------- Fin --------- Option Client - Base >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
REM Create directories in Zenidoc
echo.%date% - %time% --------- Debut --------- Create directories in Zenidoc >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
for /d %%a in (C:\Zenidoc\Informations*) do rd “%%a” /q /s
md “C:\zenidoc\Informations a traiter\Backups”
md “C:\zenidoc\Informations a traiter\BackupsMP3”
md “C:\zenidoc\Informations a traiter\S_DEVERSES”
echo.%date% - %time% --------- Fin --------- Create directories in Zenidoc >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
REM Configure rights on Client Directory
echo.%date% - %time% --------- Debut --------- Configure rights on Client Directory >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
icacls “C:\Program Files (x86)\zenidoc” /grant *S-1-5-32-545:(OI)(CI)(M) /T >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
echo.%date% - %time% --------- Fin --------- Configure rights on Client Directory >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
REM Delete shortcut in Startup
echo.%date% - %time% --------- Debut --------- Delete shortcut in Startup >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
del “C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\Demarrage Transfert.lnk” /S /Q >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
echo.%date% - %time% --------- Fin --------- Delete shortcut in Startup >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
REM Tasks Installation
echo.%date% - %time% --------- Debut --------- Patch Multisessions Windows 10 >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
copy /y DetectKill.exe "C:\Program Files (x86)\Zenidoc" >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
copy /y KillCL.exe "C:\Program Files (x86)\Zenidoc" >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
REM Find if Tasks is already scheduled
echo.%date% - %time% --------- Debut --------- Tasks Scheduler >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
schtasks > C:\Tools\Zenidoc\Tasks.txt
FIND /C /I “Zenidoc - KillCL Process” C:\Tools\Zenidoc\Tasks.txt >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
IF %ERRORLEVEL% NEQ 0 schtasks /Create /XML “KillCL Process.xml” /tn “Zenidoc - KillCL Process” >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
FIND /C /I “Zenidoc - LaunchDetectKill” C:\Tools\Zenidoc\Tasks.txt >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
IF %ERRORLEVEL% NEQ 0 schtasks /Create /XML “LaunchDetectKill_CL.xml” /tn “Zenidoc - LaunchDetectKill” >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
del C:\Tools\Zenidoc\Tasks.txt /S >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
REM Create witness file
echo %date% >> “C:\Program Files (x86)\Zenidoc\ZenSched-v2.0.txt”
echo.%date% - %time% --------- Fin --------- Tasks Scheduler >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
echo.%date% - %time% --------- Fin --------- Patch Multisessions Windows 10 >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
REM Delete Option File
echo.%date% - %time% --------- Debut --------- Delete Option File >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
del “C:\Program Files (x86)\Zenidoc\Option Client - *.txt” /S >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
echo.%date% - %time% --------- Fin --------- Delete Option File >> “C:\Tools\Zenidoc\Zenidoc-5210-Base.log”
REM Creation fichier Option
echo %date% >> “C:\Program Files (x86)\Zenidoc\Option Client - Base.txt”
I have translated this into :
[CmdletBinding()]
Param (
[Parameter(Mandatory=$false)]
[ValidateSet(‘Install’,‘Uninstall’,‘Repair’)]
[string]$DeploymentType = ‘Install’,
[Parameter(Mandatory=$false)]
[ValidateSet(‘Base’,‘Transfert’)]
[string]$DeploymentVersion = ‘Base’,
[Parameter(Mandatory=$false)]
[ValidateSet(‘Interactive’,‘Silent’,‘NonInteractive’)]
[string]$DeployMode = ‘Interactive’,
[Parameter(Mandatory=$false)]
[switch]$AllowRebootPassThru = $false,
[Parameter(Mandatory=$false)]
[switch]$TerminalServerMode = $false,
[Parameter(Mandatory=$false)]
[switch]$DisableLogging = $false
)
Try {
Set the script execution policy for this process
Try { Set-ExecutionPolicy -ExecutionPolicy ‘ByPass’ -Scope ‘Process’ -Force -ErrorAction ‘Stop’ } Catch {}
##===============================================
## VARIABLE DECLARATION
##*===============================================
Variables: Application
[string]$appVendor = ‘Zenidoc’
[string]$appName = ‘Client Leger’
[string]$appVersion = ‘5.2.10’
[string]$appArch = ‘’
[string]$appLang = ‘EN’
[string]$appRevision = ‘01’
[string]$appScriptVersion = ‘1.0.0’
[string]$appScriptDate = ‘12/04/2020’
[string]$appScriptAuthor = ‘Christophe Girardy’
[string]$appCloseApps = ‘Transfert,Transfert2,Recorder,ZenidocPlus,UpdCorres,Zenidoc,ButtonEventsCL,ZenPrepaCL’
[string]$appInstallMSIParameters = ‘INSTALLDIR=C:\Zenidoc TARGETDIR=C:\ /q /norestart’
[string]$appInstallMSIParameters2 = ‘/q /norestart’
[string]$appInstallEXEParameters = ‘/S /v/qn’
[string]$HKLMx64 = ‘HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node’
[string]$HKLMx86 = ‘HKEY_LOCAL_MACHINE\SOFTWARE’
[string]$HKCUx64 = ‘HKEY_CURRENT_USER\SOFTWARE\WOW6432Node’
[string]$HKCUx86 = ‘HKEY_CURRENT_USER\SOFTWARE’
[string]$ZenDirRoot = ‘C:\Zenidoc’
[string]$ZenDirx64 = ‘C:\Program Files (x86)\Zenidoc’
[string]$ZenDirx86 = ‘C:\Program Files\Zenidoc’
##*===============================================
Variables: Install Titles (Only set here to override defaults set by the toolkit)
[string]$installName = ‘’
[string]$installTitle = ‘’
##* Do not modify section below
#region DoNotModify
Variables: Exit Code
[int32]$mainExitCode = 0
Variables: Script
[string]$deployAppScriptFriendlyName = ‘Deploy Application’
[version]$deployAppScriptVersion = [version]‘3.8.1’
[string]$deployAppScriptDate = ‘28/03/2020’
[hashtable]$deployAppScriptParameters = $psBoundParameters
Variables: Environment
If (Test-Path -LiteralPath ‘variable:HostInvocation’) { $InvocationInfo = $HostInvocation } Else { $InvocationInfo = $MyInvocation }
[string]$scriptDirectory = Split-Path -Path $InvocationInfo.MyCommand.Definition -Parent
Dot source the required App Deploy Toolkit Functions
Try {
[string]$moduleAppDeployToolkitMain = “$scriptDirectory\AppDeployToolkit\AppDeployToolkitMain.ps1”
If (-not (Test-Path -LiteralPath $moduleAppDeployToolkitMain -PathType ‘Leaf’)) { Throw “Module does not exist at the specified location [$moduleAppDeployToolkitMain].” }
If ($DisableLogging) { . $moduleAppDeployToolkitMain -DisableLogging } Else { . $moduleAppDeployToolkitMain }
}
Catch {
If ($mainExitCode -eq 0){ [int32]$mainExitCode = 60008 }
Write-Error -Message “Module [$moduleAppDeployToolkitMain] failed to load: n$($_.Exception.Message)
n `n$($_.InvocationInfo.PositionMessage)” -ErrorAction ‘Continue’
## Exit the script, returning the exit code to SCCM
If (Test-Path -LiteralPath ‘variable:HostInvocation’) { $script:ExitCode = $mainExitCode; Exit } Else { Exit $mainExitCode }
}
#endregion
##* Do not modify section above
##===============================================
## END VARIABLE DECLARATION
##*===============================================
If ($deploymentType -ine ‘Uninstall’ -and $deploymentType -ine ‘Repair’) {
##===============================================
## PRE-INSTALLATION
##===============================================
[string]$installPhase = ‘Pre-Installation’
## Show Welcome Message, close Internet Explorer if required, allow up to 3 deferrals, verify there is enough disk space to complete the install, and persist the prompt
Show-InstallationWelcome -CloseApps $appCloseApps -CloseAppsCountdown 120 -CheckDiskSpace -PersistPrompt
## Show Progress Message (with the default message)
Show-InstallationProgress
##
Remove-Folder -Path “C:\Zenidoc”
##===============================================
##* INSTALLATION
##===============================================
[string]$installPhase = ‘Installation’
## Handle Zero-Config MSI Installations
If ($useDefaultMsi) {
[hashtable]$ExecuteDefaultMSISplat = @{ Action = ‘Install’; Path = $defaultMsiFile }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add(‘Transform’, $defaultMstFile) }
Execute-MSI @ExecuteDefaultMSISplat; If ($defaultMspFiles) { $defaultMspFiles | ForEach-Object { Execute-MSI -Action ‘Patch’ -Path $_ } }
}
##
Execute-MSI -Action Install -Path “$DirFiles\CLDNT3_v5_2_10_CHUNice.msi” -Parameters $appInstallMSIParameters
If ($envOSName -like ‘Windows 7’){
Write-Log -Message “Installing Philips Speech Drivers on $envOSName” -Severity 1 -Source $deployAppScriptFriendlyName
Execute-Process -Path “$DirSupportFiles\PhilipsSpeechDriversSetup.exe” -Parameters $appInstallEXEParameters
Write-Log -Message “Copy Transfert for $envOSName” -Severity 1 -Source $deployAppScriptFriendlyName
Copy-File -Path “$dirSupportFiles_Transfert\transfert.ini” -Destination "$ZenDirx86"
If ($DeploymentVersion -ieq ‘Transfert’){
Write-Log -Message “Installing Transfert for $envOSName” -Severity 1 -Source $deployAppScriptFriendlyName
Set-RegistryKey -Key “$HKLMx86\Microsoft\Windows\CurrentVersion\Run” -Name ‘Transfert’ -Value “$ZenDirx86\Transfert.exe” -Type String
}
}
Else {
Write-Log -Message “Installing Philips Speech Drivers on $envOSName” -Severity 1 -Source $deployAppScriptFriendlyName
Execute-MSI -Action Install -Path “$DirSupportFiles\Philips\Philips Speech Drivers.msi” -Parameters $appInstallMSIParameters2
Write-Log -Message “Copy Transfert for $envOSName” -Severity 1 -Source $deployAppScriptFriendlyName
Copy-File -Path “$dirSupportFiles_Transfert\transfert.ini” -Destination "$ZenDirx64"
If ($DeploymentVersion -ieq ‘Transfert’){
Write-Log -Message “Installing Transfert for $envOSName” -Severity 1 -Source $deployAppScriptFriendlyName
Set-RegistryKey -Key “$HKLMx64\Microsoft\Windows\CurrentVersion\Run” -Name ‘Transfert’ -Value “$ZenDirx64\Transfert.exe” -Type String
}
}
Write-Log -Message “Copy DetectSMX.DLL” -Severity 1 -Source $deployAppScriptFriendlyName
Copy-File -Path “$dirSupportFiles\DetectSMX.dll” -Destination "$ZenDirRoot\Code\detectsm"
Set-ItemProperty “$ZenDirRoot\Code\detectsm\DetectSMX.dll” -name IsReadOnly -value $true
Write-Log -Message “Register DLLs” -Severity 1 -Source $deployAppScriptFriendlyName
Register-DLL -FilePath “$ZenDirRoot\Code\detectsm\detectsmx.dll”
Register-DLL -FilePath “$ZenDirRoot\Code\detectsm\spmikectrl.dll”
Write-Log -Message “Create Zenidoc Directory” -Severity 1 -Source $deployAppScriptFriendlyName
Remove-Folder -Path “$ZenDirRoot\Informations à traiter”
New-Folder -Path “$ZenDirRoot\Informations a traiter\Backups”
New-Folder -Path “$ZenDirRoot\Informations a traiter\BackupsMP3”
New-Folder -Path “$ZenDirRoot\Informations a traiter\S_DEVERSES”
Write-Log -Message “Delete Zenidoc Shortcut” -Severity 1 -Source $deployAppScriptFriendlyName
Remove-File -Path “C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\Demarrage Transfert.lnk” -ContinueOnError $true
##===============================================
##* POST-INSTALLATION
##===============================================
[string]$installPhase = ‘Post-Installation’
##
If ($Is64Bit){
Write-Log -Message “64-bit OS. Installing the 64-bit $appVendor $appName $appVersion” -Severity 1 -Source $deployAppScriptFriendlyName
Write-Log -Message “Set Rights on Zenidoc directory” -Severity 1 -Source $deployAppScriptFriendlyName
Execute-Process -Path “$envSystem32Directory\icacls.exe” -Parameters “”“$ZenDirx64"” /grant S-1-5-32-545:(OI)(CI)(M) /T"
Write-Log -Message “RecordFromThisComputer Reg Key” -Severity 1 -Source $deployAppScriptFriendlyName
Set-RegistryKey -Key “$HKLMx64\Systancia\AppliDis\Clients” -Name ‘RecordFromThisComputer’ -Value ‘00000001’ -Type DWord
Write-Log -Message “SpeechMike Reg Keys” -Severity 1 -Source $deployAppScriptFriendlyName
Set-RegistryKey -Key “$HKCUx64\Microsoft\Terminal Server Client\Default\Addins\PspMix” -Name ‘Name’ -Value ‘Pspmixerwtsclnt.dll’ -Type String -ContinueOnError $true
Set-RegistryKey -Key “$HKCUx64\Microsoft\Terminal Server Client\Default\Addins\PspSbEx” -Name ‘Name’ -Value ‘Pspsbextwtsclnt.dll’ -Type String -ContinueOnError $true
Set-RegistryKey -Key “$HKCUx64\Microsoft\Terminal Server Client\Default\Addins\XPspCtrl” -Name ‘Name’ -Value ‘PSPWTSControlClient.dll’ -Type String -ContinueOnError $true
Set-RegistryKey -Key “$HKCUx64\Microsoft\Terminal Server Client\Default\Addins\XPspMix” -Name ‘Name’ -Value ‘XPSPMixerWtsClnt.dll’ -Type String -ContinueOnError $true
Set-RegistryKey -Key “$HKCUx64\Microsoft\Terminal Server Client\Default\Addins\XPspSbEx” -Name ‘Name’ -Value ‘XPSPSBExtWtsClnt.dll’ -Type String -ContinueOnError $true
Write-Log -Message “Run Zenidoc Reg Keys” -Severity 1 -Source $deployAppScriptFriendlyName
Set-RegistryKey -Key “$HKLMx64\Microsoft\Windows\CurrentVersion\Run” -Name ‘ButtonEventsCL’ -Value “$ZenDirx64\ButtonEventsCL.exe” -Type String
Set-RegistryKey -Key “$HKLMx64\Microsoft\Windows\CurrentVersion\Run” -Name ‘ZenidocPrepaCL’ -Value “$ZenDirx64\ZenPrepaCL.exe” -Type String
Write-Log -Message “Recorder Reg Keys” -Severity 1 -Source $deployAppScriptFriendlyName
Execute-Process -Path “$envSystemRoot\regedit.exe” -Parameters “/s "$DirSupportFiles\recorder-64bits.reg
”"
Write-Log -Message “Copy Files” -Severity 1 -Source $deployAppScriptFriendlyName
Copy-File -Path “$dirSupportFiles\TranscriptionAnywhere.ini” -Destination "$ZenDirx64\Client"
Copy-File -Path “$dirSupportFiles\Transfert.exe” -Destination "$ZenDirx64"
Write-Log -Message “DetectKill Task Scheduler” -Severity 1 -Source $deployAppScriptFriendlyName
Copy-File -Path “$dirSupportFiles\DetectKill.exe” -Destination "$ZenDirx64"
Copy-File -Path “$dirSupportFiles\KillCL.exe” -Destination "$ZenDirx64"
Register-ScheduledTask -Xml (get-content “$dirSupportFiles\KillCL Process.xml” | out-string) -TaskName “Zenidoc - KillCL Process” -Force
Register-ScheduledTask -Xml (get-content “$dirSupportFiles\LaunchDetectKill_CL.xml” | out-string) -TaskName “Zenidoc - LaunchDetectKillCL” -Force
Write-Log -Message “Create Option File” -Severity 1 -Source $deployAppScriptFriendlyName
Get-ChildItem -Path "$ZenDirx64\Option Client.txt" | ForEach-Object {Remove-Item $PSItem -Recurse}
If ($DeploymentVersion -ieq ‘Transfert’){
Write-Log -Message “Create Option File for $DeploymentVersion” -Severity 1 -Source $deployAppScriptFriendlyName
$CurrentDateTime | Out-File -FilePath “$ZenDirx64\Option Client - Transfert.txt” -Encoding utf8
}
Else {
Write-Log -Message “Create Option File for $DeploymentVersion” -Severity 1 -Source $deployAppScriptFriendlyName
$CurrentDateTime | Out-File -FilePath “$ZenDirx64\Option Client - Base.txt” -Encoding utf8
}
}
else{
Write-Log -Message “32-bit OS. Installing the 32-bit $appVendor $appName $appVersion” -Severity 1 -Source $deployAppScriptFriendlyName
Write-Log -Message “Set Rights on Zenidoc directory” -Severity 1 -Source $deployAppScriptFriendlyName
Execute-Process -Path “$envSystem32Directory\icacls.exe” -Parameters “”“$ZenDirx86"” /grant S-1-5-32-545:(OI)(CI)(M) /T"
Write-Log -Message “RecordFromThisComputer Reg Key” -Severity 1 -Source $deployAppScriptFriendlyName
Set-RegistryKey -Key “$HKLMx86\Systancia\AppliDis\Clients” -Name ‘RecordFromThisComputer’ -Value ‘00000001’ -Type DWord
Write-Log -Message “SpeechMike Reg Keys” -Severity 1 -Source $deployAppScriptFriendlyName
Set-RegistryKey -Key “$HKCUx86\Microsoft\Terminal Server Client\Default\Addins\PspMix” -Name ‘Name’ -Value ‘Pspmixerwtsclnt.dll’ -Type String
Set-RegistryKey -Key “$HKCUx86\Microsoft\Terminal Server Client\Default\Addins\PspSbEx” -Name ‘Name’ -Value ‘Pspsbextwtsclnt.dll’ -Type String
Set-RegistryKey -Key “$HKCUx86\Microsoft\Terminal Server Client\Default\Addins\XPspCtrl” -Name ‘Name’ -Value ‘PSPWTSControlClient.dll’ -Type String
Set-RegistryKey -Key “$HKCUx86\Microsoft\Terminal Server Client\Default\Addins\XPspMix” -Name ‘Name’ -Value ‘XPSPMixerWtsClnt.dll’ -Type String
Set-RegistryKey -Key “$HKCUx86\Microsoft\Terminal Server Client\Default\Addins\XPspSbEx” -Name ‘Name’ -Value ‘XPSPSBExtWtsClnt.dll’ -Type String
Write-Log -Message “Run Zenidoc Reg Key” -Severity 1 -Source $deployAppScriptFriendlyName
Set-RegistryKey -Key “$HKLMx86\Microsoft\Windows\CurrentVersion\Run” -Name ‘ButtonEventsCL’ -Value “$ZenDirx86\ButtonEventsCL.exe” -Type String
Set-RegistryKey -Key “$HKLMx86\Microsoft\Windows\CurrentVersion\Run” -Name ‘ZenidocPrepaCL’ -Value “$ZenDirx86\ZenPrepaCL.exe” -Type String
Write-Log -Message “Recorder Reg Keys” -Severity 1 -Source $deployAppScriptFriendlyName
Execute-Process -Path “$envSystemRoot\regedit.exe” -Parameters “/s "$DirSupportFiles\recorder-32bits.reg
”"
Write-Log -Message “Copy Files” -Severity 1 -Source $deployAppScriptFriendlyName
Copy-File -Path “$dirSupportFiles\TranscriptionAnywhere.ini” -Destination "$ZenDirx86\Client"
Copy-File -Path “$dirSupportFiles\Transfert.exe” -Destination "$ZenDirx86"
Write-Log -Message “Create Option File” -Severity 1 -Source $deployAppScriptFriendlyName
Get-ChildItem -Path "$ZenDirx86\Option Client.txt" | ForEach-Object {Remove-Item $PSItem -Recurse}
If ($DeploymentVersion -ieq ‘Transfert’){
Write-Log -Message “Create Option File for $DeploymentVersion” -Severity 1 -Source $deployAppScriptFriendlyName
$CurrentDateTime | Out-File -FilePath “$ZenDirx86\Option Client - Transfert.txt” -Encoding utf8
}
Else {
Write-Log -Message “Create Option File for $DeploymentVersion” -Severity 1 -Source $deployAppScriptFriendlyName
$CurrentDateTime | Out-File -FilePath “$ZenDirx86\Option Client - Base.txt” -Encoding utf8
}
## Display a message at the end of the install
#If (-not $useDefaultMsi) { Show-InstallationPrompt -Message ‘You can customize text to appear at the end of an install or remove it completely for unattended installations.’ -ButtonRightText ‘OK’ -Icon Information -NoWait }
}
}
ElseIf ($deploymentType -ieq ‘Uninstall’)
{
##===============================================
##* PRE-UNINSTALLATION
##===============================================
[string]$installPhase = ‘Pre-Uninstallation’
## Show Welcome Message, close Internet Explorer with a 60 second countdown before automatically closing
Show-InstallationWelcome -CloseApps $appCloseApps -CloseAppsCountdown 60
## Show Progress Message (with the default message)
Show-InstallationProgress
##
##===============================================
##* UNINSTALLATION
##===============================================
[string]$installPhase = ‘Uninstallation’
## Handle Zero-Config MSI Uninstallations
If ($useDefaultMsi) {
[hashtable]$ExecuteDefaultMSISplat = @{ Action = ‘Uninstall’; Path = $defaultMsiFile }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add(‘Transform’, $defaultMstFile) }
Execute-MSI @ExecuteDefaultMSISplat
}
#
Execute-MSI -Action UnInstall -Path ‘{229BE0DA-AA41-441B-96CD-E442B1B7C133}’ -Parameters $appInstallMSIParameters2
Write-Log -Message “Removing Philips Speech Drivers” -Severity 1 -Source $deployAppScriptFriendlyName
Execute-MSI -Action UnInstall -Path ‘{903E64B1-7A35-4BCD-891E-56BA08ECFBE8}’ -Parameters $appInstallMSIParameters2
##===============================================
##* POST-UNINSTALLATION
##===============================================
[string]$installPhase = ‘Post-Uninstallation’
##
If ($envOSName -like ‘Windows 7’){
Write-Log -Message “Removing Zenidoc from Run on $envOSName” -Severity 1 -Source $deployAppScriptFriendlyName
Remove-ItemProperty -Path “HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run” -Name “ButtonEventsCL”
Remove-ItemProperty -Path “HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run” -Name ‘ZenidocPrepaCL’
Remove-ItemProperty -Path “HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run” -Name ‘Transfert’
}
If ($envOSName -like ‘Windows 10’){
Write-Log -Message “Deleting Zenidoc Scheduled Tasks on $envOSName” -Severity 1 -Source $deployAppScriptFriendlyName
$tasks = Get-ScheduledTask -TaskName Zenidoc
Unregister-ScheduledTask -TaskName $tasks.TaskName -TaskPath $tasks.TaskPath -Confirm: $False
Write-Log -Message “Removing Zenidoc from Run on $envOSName” -Severity 1 -Source $deployAppScriptFriendlyName
Remove-ItemProperty -Path “HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run” -Name “ButtonEventsCL”
Remove-ItemProperty -Path “HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run” -Name ‘ZenidocPrepaCL’
Remove-ItemProperty -Path “HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run” -Name ‘Transfert’
}
Write-Log -Message “Deleting C:\Zenidoc Folder on $envOSName” -Severity 1 -Source $deployAppScriptFriendlyName
Remove-Folder -Path “C:\Zenidoc”
}
ElseIf ($deploymentType -ieq ‘Repair’)
{
##===============================================
## PRE-REPAIR
##===============================================
[string]$installPhase = ‘Pre-Repair’
## Show Progress Message (with the default message)
Show-InstallationProgress
##
##===============================================
##* REPAIR
##===============================================
[string]$installPhase = ‘Repair’
## Handle Zero-Config MSI Repairs
If ($useDefaultMsi) {
[hashtable]$ExecuteDefaultMSISplat = @{ Action = ‘Repair’; Path = $defaultMsiFile; }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add(‘Transform’, $defaultMstFile) }
Execute-MSI @ExecuteDefaultMSISplat
}
#
##===============================================
##* POST-REPAIR
##===============================================
[string]$installPhase = ‘Post-Repair’
##
}
##===============================================
##* END SCRIPT BODY
##*===============================================
Call the Exit-Script function to perform final cleanup operations
Exit-Script -ExitCode $mainExitCode
}
Catch {
[int32]$mainExitCode = 60001
[string]$mainErrorMessage = “$(Resolve-Error)”
Write-Log -Message $mainErrorMessage -Severity 3 -Source $deployAppScriptFriendlyName
Show-DialogBox -Text $mainErrorMessage -Icon ‘Stop’
Exit-Script -ExitCode $mainExitCode
}
You have to notice that I’m not a PowerShell scripting expert so there might be optimizations that could be done in this code. I’m totally opened to suggestions if you want to optimize it.
At the moment, it works well W7 and W10 VMs I’m using to validate the installation.
I’ll include it in my test OS deployment TS this week-end and check if everything works well before using it as my main W10 deployment TS.