Show-WelcomePrompt

Hey,

is there a way to use the function “Show-WelcomePrompt” without “Show-InstallationWelcome” to close apps based on commandline, then using the PID of the process.

Best regards

The Show-WelcomePrompt function is an “internal Function” that is called by the Show-InstallationWelcome function .
You do not have to use the -CloseApps parameter as it is not Mandatory.

I’m am guessing you want to give one of these 2 functions a PID and ask the user to close it?
If so, you cannot do it directly. You will have to create code to convert the PID to a ProcessName.
I would use Get-Process to build this code. (ID == PID)

No, i want to close a program may be “javaw.exe” or something other. The only thing i know is a part of the command line of the process.
Now i can read the command line, check it and want to close the running process by PID if the commandline is ok.
If i use the " Show-InstallationWelcome" -CloseApps “javaw” … all processes where closed, but that ist not the job… The job is, close only the process that match the commandline.

The function that checks the commandline, get PID and so on is not the Problem.
After that i want to show the toolkit window to inform the user, incl. the process names.
If the user Click “Close” i can close the special PIDs by myself. I only need the promp.

I understand now.
You want to prompt the user to close a ONE javaw process out of many javaw processes.
You will have to modify the Show-WelcomePrompt function to accept a PID instead of process name.

Do you need all the features of the Show-WelcomePrompt function as well? (e.g. Defer, countdown to killing the process, prevent relaunch)

I understand now.
You want to prompt the user to close a ONE javaw process out of many javaw processes.
You will have to modify the Show-WelcomePrompt function to accept a PID instead of process name.

Yes. And this by add a parameter -Commandline “*\Application\Somethink*”

Do you need all the features of the Show-WelcomePrompt function as well? (e.g. Defer, countdown to killing the process, prevent relaunch)

Yes. Because the application can have a spezial name so i have to use -CloseApps "javaw=Special Company Name,client,tool" -Commandline "*\Application\Somethink\*" -PersistPrompt -AllowDefer -DeferTimes 3
We know the Process, Commandline and now we can close the exact process and ignore all others.

This will be perfect for many application/processes.

Wow! looks like you figured it out!

You should post it as a feature request (Issues · PSAppDeployToolkit/PSAppDeployToolkit · GitHub) and/or a pull request (Pull requests · PSAppDeployToolkit/PSAppDeployToolkit · GitHub)

I’m sure the PSADT Authors would like to see it.

Adding this request to the template would be nice.

You can do otherwise with the actual template :

  • Copy the more.com from your sytem32 folder to your SupportFiles package folder
  • Rename it to make it unique, like 123456.com

In your deploy-application.ps1 file,

  1. Find the PID of the javaw.exe process with the matching command line
  2. If PID found, start 123456.com hidden
  3. In your -CloseApps parameter of your Welcome Prompt, add “123456=What you want”
  4. after the Welcome prompt line, add a Stop-Process -force of your previous PID

Sorry i am not able to do it. May be i dont understand how to do it.

I’m sorry. I thought you had solved your issue and I was asking for you to share your solution.

Modifying Show-WelcomePrompt to have a -Commandline parameter is no easy task because the Show-InstallationWelcome function would also need to be changed. Eventually, even the Block-AppExecution function might need to be updated.

That said, I happen to have code that will kill a PID based on a string in the commandline without prompting the user. I can post if if that will help.