Make Show-InstallationWelcome say "uninstalled" instead of "installed"

I placed the Show-InstallationWelcome inside the PRE-UNINSTALLATION block. Went that line is ran in the uninstall process it says “The following application is about to be installed” and I would like it to say “The following application is about to be uninstalled” instead

Is this possible?

psadt_question_uninstall_help_002

2 Likes

For just rename - open “AppDeployToolkitConfig.xml” and edit Line 200 with your wishes

Line200 is only correct if you use a standard configuration.

I have not tested this yet but if I edit this, then I still have a problem because it is not dynamic I assume. If I edit this to say “uninstall,” then during the installation when I use Show-InstallationWelcome, it will say “uninstall” during the installation phase.

<!-- Text displayed when counting down to automatically closing applications. -->
<DeferPrompt_WelcomeMessage>The following application is about to be installed:</DeferPrompt_WelcomeMessage>
<!-- Text displayed when only the deferral dialog is to be displayed and there are no applications to close. -->
<DeferPrompt_ExpiryMessage>You can choose to defer the installation until the deferral expires:</DeferPrompt_ExpiryMessage>

I just tested this and this does not work because every time I run the install block, it will now say “uninstall” instead of “install” in the text. I need this to by dynamic. I hope that makes sense.

The reason for this is that when it is installing or uninstalling, it is still saying “install” and “installation” in the text which I do not want to confuse our users.

I think this is a bad idea but if you wish to have more rope, I’ll give it to you.

At the beginning of AppDeployToolkitMain.ps1, PSADT reads the XML file.
This line reads the <DeferPrompt_WelcomeMessage> from the XML file:

[String]$configDeferPromptWelcomeMessage = $xmlUIMessages.DeferPrompt_WelcomeMessage

From this, we now know that the message you see in GUI is stored in the $configDeferPromptWelcomeMessage variable.

To use it for your needs, add something like the following code before you launch the uninstall in your “PRE-UNINSTALLATION block”:

$Backup_DeferPromptWelcomeMessage = $configDeferPromptWelcomeMessage
$configDeferPromptWelcomeMessage = "This is an uninstallation during the installation NetDocuments."

After the uninstall, revert it back.

$configDeferPromptWelcomeMessage = $Backup_DeferPromptWelcomeMessage

Thank you for the reply. Let me test this and see the results it produces.

Looks like that just adds a message inside there but during this uninstall it still displays “installation” below it.

I guess there is no real easy way around this.

I think I will leave it as is then and not tinker around with it that much.

If you have any suggestions other than this, please let me know.

Here’s how I’m doing it in my template:

AppDeployToolkitConfig.xml - added below code, along with what’s already there for Installation. Just make sure you’re placing it properly.

		<!-- ######################################################################################################-->
		<!-- Modifying uninstall text messages-->
		<ClosePrompt_UninstallButtonDefer>Defer the Uninstallation</ClosePrompt_UninstallButtonDefer>
		<!-- Text displyed on the defer button when prompting to close running programs during uninstallation. -->
		<DeferPrompt_UninstallWelcomeMessage>The following application is about to be uninstalled.</DeferPrompt_UninstallWelcomeMessage>
		<!-- Uninstall message modified. -->
		<DeferPrompt_UninstallExpiryMessage>You can choose to defer the uninstallation until the deferral expires:</DeferPrompt_UninstallExpiryMessage>
		<!-- Uninstall message modified. -->
		<!-- ######################################################################################################-->

AppDeployToolkitMain.ps1 - Now let’s add the new xml info in our Main.ps1 file so it can be recognized because just having it in XML file won’t do anything.

Right after this line,

[string]$configDeferPromptExpiryMessage = $xmlUIMessages.DeferPrompt_ExpiryMessage

I added my lines:

####################################################
if($deploymentType -ieq 'Uninstall') 
{
[string]$configDeferPromptExpiryMessage = $ExecutionContext.InvokeCommand.ExpandString($xmlUIMessages.DeferPrompt_UninstallExpiryMessage)
[string]$configDeferPromptWelcomeMessage = $ExecutionContext.InvokeCommand.ExpandString($xmlUIMessages.DeferPrompt_UninstallWelcomeMessage)
[string]$configClosePromptButtonDefer = $ExecutionContext.InvokeCommand.ExpandString($xmlUIMessages.ClosePrompt_UninstallButtonDefer)
[string]$configClosePromptMessage = $ExecutionContext.InvokeCommand.ExpandString($xmlUIMessages.ClosePrompt_UninstallMessage)
}
####################################################

This way whenever I run Uninstall script, I don’t have to change the text in GUI. If you use Repair then you can do the same and then just introduce it in Main.ps1.

Let me know if you have any questions, hope it helps :slight_smile:

3 Likes

I will give this a try when I return to the office for work. Thank you! This might work!

Thank you so much. This worked successfully! I appreciate your help!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.