Skip to content

[Documentation] Look at creating an AppLocker/WDAC integration article, or at least one just pertaining to Assigned Access. #146

Description

@The-Paddy

Prerequisites

PSAppDeployToolkit version

4.1.0-rc1

Describe the bug

We're using Assigned Access to configure a device for multi app kiosk mode.
When running Start-ADTMsiProcess to install a MSI it automatically tries to run Update-ADTDesktop after the installation. Update-ADTDesktop fails and the script terminates, the MSI however was installed correctly. On the next installation try, it detects that the MSI is already installed, skips Start-ADTMsiProcess and doesn't crash.

After having a quick look at the source, could this have to do with refreshing the desktop and env vars in user context?

I tried using $ErrorActionPreference = "SilentlyContinue" to skip over the error, but wasn't successfull.

Applocker (which is automatically configured by assigned access) logs, that it blocked PSADT.CLIENTSERVER.CLIENT.EXE

This log was from a MSI uninstall. but its the same issue. Sorry for the German error messages :/ If necessary I'll try to switch the computer to English

<![LOG[[Pre-Install] :: Executing [C:\Windows\system32\msiexec.exe /x "{b66b8a46-664b-4ca1-8388-8c74c25fc620}" REBOOT=ReallySuppress /QN /L*V "C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\TeamViewerHost_15.0.8397.0_Uninstall.log"]...]LOG]!><time="14:00:46.302+60" date="7-16-2025" component="Start-ADTProcess" context="NT-AUTORITÄT\SYSTEM" type="1" thread="3640" file="C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1">
<![LOG[[Pre-Install] :: Execution completed successfully with exit code [0].]LOG]!><time="14:00:48.766+60" date="7-16-2025" component="Start-ADTProcess" context="NT-AUTORITÄT\SYSTEM" type="0" thread="3640" file="C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1">
<![LOG[[Pre-Install] :: Refreshing the Desktop and the Windows Explorer environment process block.]LOG]!><time="14:00:48.777+60" date="7-16-2025" component="Update-ADTDesktop" context="NT-AUTORITÄT\SYSTEM" type="1" thread="3640" file="C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1">
<![LOG[[Pre-Install] :: Instantiating user client/server process.]LOG]!><time="14:00:48.913+60" date="7-16-2025" component="Invoke-ADTClientServerOperation" context="NT-AUTORITÄT\SYSTEM" type="1" thread="3640" file="C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1">
<![LOG[[Pre-Install] :: Failed to refresh the Desktop and the Windows Explorer environment process block.
Error Record:
-------------
 
Message               : Ausnahme beim Aufrufen von "Open" mit 0 Argument(en):  "Dieses Programm wurde durch eine Gruppenrichtlinie geblockt. Wenden Sie sich an den Systemadministrator, um weitere Informationen zu erhalten"
InnerException        : System.ComponentModel.Win32Exception (0x80004005): Dieses Programm wurde durch eine Gruppenrichtlinie geblockt. Wenden Sie sich an den Systemadministrator, um weitere Informationen zu erhalten
                           bei PSADT.LibraryInterfaces.AdvApi32.CreateProcessAsUser(SafeHandle hToken, String lpApplicationName, String lpCommandLine, Nullable`1 lpProcessAttributes, Nullable`1 lpThreadAttributes, BOOL bInheritHandles, PROCESS_CREATION_FLAGS dwCreationFlags, SafeEnvironmentBlockHandle lpEnvironment, String lpCurrentDirectory, STARTUPINFOW& lpStartupInfo, PROCESS_INFORMATION& lpProcessInformation) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT\LibraryInterfaces\AdvApi32.cs:Zeile 282.
                           bei PSADT.ProcessManagement.ProcessManager.LaunchAsync(ProcessLaunchInfo launchInfo) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT\ProcessManagement\ProcessManager.cs:Zeile 190.
                           bei PSADT.ClientServer.ServerInstance.Open() in D:\Repos\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Server\ServerInstance.cs:Zeile 67.
                           bei CallSite.Target(Closure , CallSite , Object )
 
FullyQualifiedErrorId : Win32Exception,Update-ADTDesktop
ScriptStackTrace      : bei Private:Invoke-ADTClientServerOperation, C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1: Zeile 1096
                        bei Update-ADTDesktop<Process>, C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1: Zeile 23745
                        bei Start-ADTMsiProcess<Process>, C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1: Zeile 20019
                        bei Uninstall-ADTApplication<Process>, C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1: Zeile 23512
                        bei Install-ADTDeployment, C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\Invoke-AppDeployToolkit.ps1: Zeile 140
                        bei <ScriptBlock>, C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\Invoke-AppDeployToolkit.ps1: Zeile 327
                        bei <ScriptBlock>, <Keine Datei>: Zeile 1
 
PositionMessage       : In C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1:20019 Zeichen:17
                        +                 & $Script:CommandTable.'Update-ADTDesktop'
                        +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]LOG]!><time="14:00:49.046+60" date="7-16-2025" component="Update-ADTDesktop" context="NT-AUTORITÄT\SYSTEM" type="3" thread="3640" file="C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1">
<![LOG[[Pre-Install] :: Ausnahme beim Aufrufen von "Open" mit 0 Argument(en):  "Dieses Programm wurde durch eine Gruppenrichtlinie geblockt. Wenden Sie sich an den Systemadministrator, um weitere Informationen zu erhalten"
Error Record:
-------------
 
Message               : Ausnahme beim Aufrufen von "Open" mit 0 Argument(en):  "Dieses Programm wurde durch eine Gruppenrichtlinie geblockt. Wenden Sie sich an den Systemadministrator, um weitere Informationen zu erhalten"
InnerException        : System.ComponentModel.Win32Exception (0x80004005): Dieses Programm wurde durch eine Gruppenrichtlinie geblockt. Wenden Sie sich an den Systemadministrator, um weitere Informationen zu erhalten
                           bei PSADT.LibraryInterfaces.AdvApi32.CreateProcessAsUser(SafeHandle hToken, String lpApplicationName, String lpCommandLine, Nullable`1 lpProcessAttributes, Nullable`1 lpThreadAttributes, BOOL bInheritHandles, PROCESS_CREATION_FLAGS dwCreationFlags, SafeEnvironmentBlockHandle lpEnvironment, String lpCurrentDirectory, STARTUPINFOW& lpStartupInfo, PROCESS_INFORMATION& lpProcessInformation) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT\LibraryInterfaces\AdvApi32.cs:Zeile 282.
                           bei PSADT.ProcessManagement.ProcessManager.LaunchAsync(ProcessLaunchInfo launchInfo) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT\ProcessManagement\ProcessManager.cs:Zeile 190.
                           bei PSADT.ClientServer.ServerInstance.Open() in D:\Repos\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Server\ServerInstance.cs:Zeile 67.
                           bei CallSite.Target(Closure , CallSite , Object )
 
FullyQualifiedErrorId : Win32Exception,Uninstall-ADTApplication
ScriptStackTrace      : bei Private:Invoke-ADTClientServerOperation, C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1: Zeile 1096
                        bei Update-ADTDesktop<Process>, C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1: Zeile 23745
                        bei Start-ADTMsiProcess<Process>, C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1: Zeile 20019
                        bei Uninstall-ADTApplication<Process>, C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1: Zeile 23512
                        bei Install-ADTDeployment, C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\Invoke-AppDeployToolkit.ps1: Zeile 140
                        bei <ScriptBlock>, C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\Invoke-AppDeployToolkit.ps1: Zeile 327
                        bei <ScriptBlock>, <Keine Datei>: Zeile 1
 
PositionMessage       : In C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\Invoke-AppDeployToolkit.ps1:140 Zeichen:9
                        +         Uninstall-ADTApplication -InstalledApplication $oldTeamViewer ...
                        +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]LOG]!><time="14:00:49.078+60" date="7-16-2025" component="Uninstall-ADTApplication" context="NT-AUTORITÄT\SYSTEM" type="3" thread="3640" file="C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1">
<![LOG[[Pre-Install] :: An unhandled error within [Invoke-AppDeployToolkit.ps1] has occurred.
Error Record:
-------------
 
Message               : Ausnahme beim Aufrufen von "Open" mit 0 Argument(en):  "Dieses Programm wurde durch eine Gruppenrichtlinie geblockt. Wenden Sie sich an den Systemadministrator, um weitere Informationen zu erhalten"
InnerException        : System.ComponentModel.Win32Exception (0x80004005): Dieses Programm wurde durch eine Gruppenrichtlinie geblockt. Wenden Sie sich an den Systemadministrator, um weitere Informationen zu erhalten
                           bei PSADT.LibraryInterfaces.AdvApi32.CreateProcessAsUser(SafeHandle hToken, String lpApplicationName, String lpCommandLine, Nullable`1 lpProcessAttributes, Nullable`1 lpThreadAttributes, BOOL bInheritHandles, PROCESS_CREATION_FLAGS dwCreationFlags, SafeEnvironmentBlockHandle lpEnvironment, String lpCurrentDirectory, STARTUPINFOW& lpStartupInfo, PROCESS_INFORMATION& lpProcessInformation) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT\LibraryInterfaces\AdvApi32.cs:Zeile 282.
                           bei PSADT.ProcessManagement.ProcessManager.LaunchAsync(ProcessLaunchInfo launchInfo) in D:\a\PSAppDeployToolkit\PSAppDeployToolkit\src\PSADT\PSADT\ProcessManagement\ProcessManager.cs:Zeile 190.
                           bei PSADT.ClientServer.ServerInstance.Open() in D:\Repos\PSAppDeployToolkit\src\PSADT\PSADT.ClientServer.Server\ServerInstance.cs:Zeile 67.
                           bei CallSite.Target(Closure , CallSite , Object )
 
FullyQualifiedErrorId : Win32Exception,Uninstall-ADTApplication
ScriptStackTrace      : bei Private:Invoke-ADTClientServerOperation, C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1: Zeile 1096
                        bei Update-ADTDesktop<Process>, C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1: Zeile 23745
                        bei Start-ADTMsiProcess<Process>, C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1: Zeile 20019
                        bei Uninstall-ADTApplication<Process>, C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1: Zeile 23512
                        bei Install-ADTDeployment, C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\Invoke-AppDeployToolkit.ps1: Zeile 140
                        bei <ScriptBlock>, C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\Invoke-AppDeployToolkit.ps1: Zeile 327
                        bei <ScriptBlock>, <Keine Datei>: Zeile 1
 
PositionMessage       : In C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\Invoke-AppDeployToolkit.ps1:140 Zeichen:9
                        +         Uninstall-ADTApplication -InstalledApplication $oldTeamViewer ...
                        +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]LOG]!><time="14:00:49.104+60" date="7-16-2025" component="Invoke-AppDeployToolkit.ps1" context="NT-AUTORITÄT\SYSTEM" type="3" thread="3640" file="C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\Invoke-AppDeployToolkit.ps1">
<![LOG[[Finalization] :: [TeamViewer_TeamViewerHost_15.67.5.0_x64_EN_01] install completed in [4,3206155] seconds with exit code [60001].]LOG]!><time="14:00:49.121+60" date="7-16-2025" component="Close-ADTSession" context="NT-AUTORITÄT\SYSTEM" type="3" thread="3640" file="C:\Windows\IMECache\a3fd3a20-32e3-46a8-97e7-9a10012eff24_1\PSAppDeployToolkit\PSAppDeployToolkit.psm1">

Steps to reproduce

  1. Configure assigned access
  2. Run Start-ADTMsiProcess
  3. It installs the MSI and trys to run Update-ADTDesktop
  4. Error and script stops

Environment data

OsName               : Microsoft Windows 11 Enterprise
OSDisplayVersion     : 24H2
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture       : 64-Bit
WindowsVersion       : 2009
WindowsProductName   : Windows 10 Enterprise
WindowsBuildLabEx    : 26100.1.amd64fre.ge_release.240331-1435
OsLanguage           : de-DE
OsMuiLanguages       : {de-DE, en-US}
KeyboardLayout       : de-DE
TimeZone             : (UTC+01:00) Amsterdam, Berlin, Bern, Rom, Stockholm, Wien
HyperVisorPresent    : True
CsPartOfDomain       : True
CsPCSystemType       : Mobile


Host:
  Version:      9.0.7
  Architecture: x64
  Commit:       3c298d9f00
  RID:          win-x64

.NET SDKs installed:
  No SDKs were found.

.NET runtimes installed:
  Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 8.0.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 9.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions