v4.1RC2-Quite a long Invoke-AppDeployToolkit startup delay?

Hi everyone,

I’m new to PSADT, just started testing it today (the 4.0.6 and 4.1 versions).

One big issue I noticed is that the startup of Invoke-AppDeployToolkit.exe is pretty long, around 15 seconds. That is time between launching the exe file and getting the PSADT GUI popup and installation start.

So I added some write-outputs in the ps code and it seems that module import takes like 2 seconds, which is fine, but opening the session:

$adtSession = Open-ADTSession @adtSession @iadtParams -PassThru

takes the other 12-15 seconds.

Is this “normal” ? I feel like it’s kinda of problem, because since the session is not running these 15 seconds I can’t even use some function to call pop up that would say “Please wait, loading…” to the user.

Is this just 4.0 version issue ?

Can I do anything to get this down to 3-5 seconds?

Thanks a lot for any input on this issue :upside_down_face:

In your session logs on screen, how long does it say that module import and module initialisation took? On my system, it typically takes <1 second to initialise. We are looking at removing a number of WMI calls in the future though which will help here.

The module importing takes about 2 seconds, but that’s fine. The rest seems to be the problem.

Here’s an example:

in this run, it takes 13 seconds from starting the script to getting the window pop up, and sometimes it takes up to 20 seconds.

The command that takes majority of that time is the one I mentioned in the OP, the $adtSession = Open-ADTSession @adtSession @iadtParams -PassThru

The message [INFO] IADTSESSION-2 is right before this command, and it takes 11 seconds in this case to get to [Initialization] log messages.

Can you run the command through Profiler so we can get a breakdown on where the bottleneck is? GitHub - nohwnd/Profiler: Script, ScriptBlock and module performance profiler for PowerShell 5, and PowerShell 7.

It’ll likely be in New-ADTEnvironmentTable, but it’ll be good to be sure.

Editing to add this screenshot. This is off my development VM, but module initialisation times for me are always <0.75 seconds which is why it’d be good for you to run the profiler so we can see where the slow source is for you.

I am trying to use the profile but, either I’m doing something wrong or it’s not showing/recording the stuff that’s actually slowing the script.

This is what I get when running:

Trace-Script -ScriptBlock {& .\Invoke-AppDeployToolkit.ps1 -DeploymentType Install }

which shows that the start-sleep command is the longest one, which I put in there just for presentation purpose of progress bar feature.

While it took about 6 seconds to open the window this time (not sure why it was 13 seconds on Friday and it’s only 6 seconds today :smiley: )

(doing mutiple posts, because I can’t put more images in to one…)

This is just with addition of simple logging where it matters, where it’s slow in the script:

The normal output you showed, will now show you the slow part, because the delay is before that.

edit: nevermind I see it now, it shows the module import time and module intialization time…

I tried fresh VM now and yea in the VM it looks good, so I guess it’s something related to my laptop.

This is what I get on the Win11 Ent VM

[2025-07-28T11:25:41.5171016+02:00] [Initialization] [Open-ADTSession] [Info] :: [PSAppDeployToolkit] module imported in [1.2011492] seconds.
[2025-07-28T11:25:41.5171016+02:00] [Initialization] [Open-ADTSession] [Info] :: [PSAppDeployToolkit] module initialized in [0.8478097] seconds.

The problem here is you’re profiling everything, but I’d just profile Open-ADTSession or Initialize-ADTModule to find out what’s going wrong specifically during the initialisation.

These are pretty good times! They’re probably better on the whole than I get on my VM I develop from.

I’d say it’s possibly something to do with production machines having scriptblock logging enabled, it can drastically slow down performance. We actively avoid ForEach-Object and Where-Object to try and eliminate the performance issues with scriptblock logging, but its probably not bulletproof. Have a read of this great article for more info: Speeding Up the Pipeline - powershell.one

We’re doing things to make things after for 4.2.0 by reducing the amount of WMI calls, and while it should give an improvement, it may not necessarily resolve this issue on your prod devices.

Yep it’s definitely issue specific to my device, probably one of three things.

  • I have Delinea configured on my laptop, for permission elevation
  • Crowdstrike Falcon sensor
  • I have Intel Core Ultra 7 165H processor, it’s set to max performance and the efficiency cores are disabled, but there are still 2 special efficiency cores that can’t be disabled, not sure it’s possible that it could get scheduled to those

But one thing to note on fresh VM, is that it does run these very nice times I mentioned, but not on the first run after restart (even if I let the VM sit for 15 minutes after start, to let everything settle), the first run is always around following numbers:

[2025-07-30T12:46:52.5743296+02:00] [Initialization] [Open-ADTSession] [Info] :: [PSAppDeployToolkit] module version is [4.1.0].
[2025-07-30T12:46:52.5743296+02:00] [Initialization] [Open-ADTSession] [Info] :: [PSAppDeployToolkit] module imported in [3.3508105] seconds.
[2025-07-30T12:46:52.5743296+02:00] [Initialization] [Open-ADTSession] [Info] :: [PSAppDeployToolkit] module initialized in [2.8381122] seconds.

while the rest, for example from today’s testing is like:

[2025-07-30T12:48:29.0541319+02:00] [Initialization] [Open-ADTSession] [Info] :: [PSAppDeployToolkit] module imported in [1.6319052] seconds.
[2025-07-30T12:48:29.0541319+02:00] [Initialization] [Open-ADTSession] [Info] :: [PSAppDeployToolkit] module initialized in [0.9675569] seconds.
[2025-07-30T12:53:36.7328771+02:00] [Initialization] [Open-ADTSession] [Info] :: [PSAppDeployToolkit] module imported in [1.2424824] seconds.
[2025-07-30T12:53:36.7328771+02:00] [Initialization] [Open-ADTSession] [Info] :: [PSAppDeployToolkit] module initialized in [0.8952657] seconds.
[2025-07-30T12:53:55.0450981+02:00] [Initialization] [Open-ADTSession] [Info] :: [PSAppDeployToolkit] module imported in [1.2627828] seconds.
[2025-07-30T12:53:55.0450981+02:00] [Initialization] [Open-ADTSession] [Info] :: [PSAppDeployToolkit] module initialized in [0.8329341] seconds.

Not sure why that happens and if that’s expected or not.

The first execution on a cleanly booted machine will always be the slowest because nothing’s loaded within the GAC until it’s ran once. It’s definitely normal though.