TerminalServiceUpdate.ps1
$logsPath = Join-Path $env:ProgramData 'Logeto\TerminalService\Logs' Start-Transcript -OutputDirectory $logsPath -IncludeInvocationHeader try { $importModuleScriptPath = Join-Path $env:ProgramData 'Logeto\TerminalService\Update\InstallLogetoModule.ps1' . $importModuleScriptPath } catch {} Import-Module -Name "Logeto" try { Install-LogetoProduct 'TerminalService' Update-LogetoProductSystemEnvironment 'TerminalService' 'All' } finally { $packageName = "B158BDD8.LogetoTerminal_kaaqb1ec1n05t" $usersInfo = Get-AppxPackage -AllUsers | ? {$_.PackageFamilyName -eq $packageName} ForEach ($user in $usersInfo) { $sidArray = $user.PackageUserInformation.UserSecurityId.SID ForEach ($sid in $sidArray) { $user = Get-childItem -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList' | ForEach-Object {Get-ItemProperty -Path $_.pspath } | Where-Object { $_.pschildname -eq $sid} $path = $user.profileImagePath $localPath = "$path\AppData\Local\Packages\$packageName\LocalState" Write-LogetoDebug "LocalPath is: $localPath" if (Test-Path $localPath) { $local = Get-InstalledModule -AllVersions -Name "Logeto" $a = [system.String]::Join(", ", $local.Version) $a | Out-File "$localPath\PSVersionSystem.txt" -Force $serviceExePath = "$ENV:ProgramFiles\Systemart\Logeto.UWP.Service\Logeto.UWP.Service.Host.exe" if (Test-Path $serviceExePath) { $v = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($serviceExePath).FileVersion $v | Out-File "$localPath\ServiceVersion.txt" -Force } } } } } |