# End user text prompts for software removal?

**URL:** https://forums.powershell.org/t/end-user-text-prompts-for-software-removal/16668
**Category:** PowerShell Help
**Created:** [May 27, 2021, 3:14pm UTC](https://forums.powershell.org/t/end-user-text-prompts-for-software-removal/16668 "2021-05-27T15:14:59Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![net1994](https://avatars.discourse-cdn.com/v4/letter/n/e5b9ba/32.png) [@net1994](https://forums.powershell.org/u/net1994)
#### Post date: [May 27, 2021, 3:14pm UTC](https://forums.powershell.org/t/end-user-text-prompts-for-software-removal/16668/1 "2021-05-27T15:14:59Z")

</div>

Hello all – We need to in remove some software, but give the user notice on-screen before and after. When the software is removed, it must be in silent mode (or the user will be able to cancel it). I need two prompts and thinking PowerShell is the best bet. We have the software removal part working and don’t need help on that. Just end user notification prompts.

1. First prompt. Notification pops up with something like “This software will uninstall.” Then have a countdown where it hits zero, it proceeds to software removal. Or if the user doesn’t want to wait until it hits 0, they can hit ‘Start Now’ and then it exits the script.
2. Software removed.
3. Second prompt. Another prompt to the user that simply says, ‘Update Complete.’ They hit okay and script exits.

Do any of you know if there are PowerShell script that would do this?

---

<div class="post-metadata">

### Author: ![tonyd](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/tonyd/32/1041_2.png) [@tonyd](https://forums.powershell.org/u/tonyd)
#### Post date: [May 27, 2021, 3:46pm UTC](https://forums.powershell.org/t/end-user-text-prompts-for-software-removal/16668/2 "2021-05-27T15:46:39Z")

</div>

A simply Message Box with OK is basically a one liner. The countdown timer part may require that you use a Windows Form which adds more complexity.

[https://ss64.com/ps/messagebox.html](https://ss64.com/ps/messagebox.html)

---

<div class="post-metadata">

### Author: ![net1994](https://avatars.discourse-cdn.com/v4/letter/n/e5b9ba/32.png) [@net1994](https://forums.powershell.org/u/net1994)
#### Post date: [May 28, 2021, 12:05am UTC](https://forums.powershell.org/t/end-user-text-prompts-for-software-removal/16668/3 "2021-05-28T00:05:53Z")

</div>

This script I got to do what I need. However what happens is when it’s sent remotely to the pc, on the pc itself you can see the powershell window open up in the background, and then the prompt appears on screen. Is there a way to prevent the powershell window from showing, but still have the script present itself on screen?

```auto
Add-Type -AssemblyName PresentationFramework, WindowsBase

$Form = [Windows.Markup.XamlReader]::Load((New-Object Xml.XmlNodeReader([xml]@'

<Window Name='Window' xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' WindowStartupLocation='CenterScreen' WindowStyle='None' WindowState='Normal' Width='300' Height='280' Background='#FFFFFF' Topmost='True' ResizeMode='NoResize' AllowsTransparency='True' >

<Border BorderBrush="#0178D6" BorderThickness="2" Height="280" Margin="0,0,0,0" VerticalAlignment="Top" Width="300">

<Grid>

<Button Name='Minimize' Content='_' HorizontalAlignment='Right' VerticalAlignment='Top' Padding='0,10,0,10' FontSize='20' Background='#0178D6' Foreground='White' Margin='0,5,5,0' Width='30' Height='30' />

<StackPanel HorizontalAlignment='Center' VerticalAlignment='Top' Margin='0,30,0,0'>

<StackPanel HorizontalAlignment='Center' VerticalAlignment='Top' Margin='0,10,0,0'>

<Label Name='Title' Content='Microsoft Update Required' HorizontalAlignment='Center' FontSize='20' Foreground='Red'/>

<Label Content='Save All Open Work' HorizontalAlignment='Center' FontSize='30' Foreground='Red' Margin='0,20,0,0'/>

<Label Name='Countdown' Content='' HorizontalAlignment='Center' FontSize='14' Foreground='Black' Margin='0,20,0,0'/>

</StackPanel>

</StackPanel>

<StackPanel Margin='0,0,0,30' VerticalAlignment='Bottom'>

<Button Name='Install' Content='Update Now' Width='Auto' HorizontalAlignment='Center' Padding='20,10,20,10' FontSize='14' Background='#0178D6' Foreground='white'/>

</StackPanel>

</Grid>

</Border>

</Window>

'@)))

$Minimize=$Form.FindName('Minimize')

$OK=$Form.Findname('Install')

$Countdown=$Form.Findname('Countdown')

$Timer = New-Object System.Windows.Threading.DispatcherTimer

$Timer.Interval = [TimeSpan]'0:0:0:1'

$Global:RemainingTime=300

$Timer.Add_Tick{

$Global:RemainingTime=$Global:RemainingTime - 1

$Countdown.Content="Update will begin in $Global:RemainingTime seconds."

If ($Global:RemainingTime -le 0){$Form.close()}

}

$OK.Add_Click{

$Form.close()

}

$Form.Add_SourceInitialized{

$Timer.Start()

}

$Minimize.Add_Click{$Form.WindowState='Minimized'}

$Form.Showdialog()

```

---

<div class="post-metadata">

### Author: ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)
#### Post date: [May 16, 2024, 8:24pm UTC](https://forums.powershell.org/t/end-user-text-prompts-for-software-removal/16668/4 "2024-05-16T20:24:28Z")

</div>


