Quantcast
Channel: SAPIEN Forums
Viewing all articles
Browse latest Browse all 480

PowerShell GUIs • Windows Updates - Output to textbox

$
0
0
Hi all,

I wrote a powershell script that we can use in our remote access tool to run Windows Updates without bothering the client, then just email them and request that they reboot.

In Powershell, I get to see the verbose output of the script, mainly the Get-WindowsUpdate command and it gives me a verbose output with key information.

Code:

VERBOSE: VDFF0002L (20/12/2023 3:16:10 pm): Connecting to Microsoft Update server. Please wait...
VERBOSE: Found [18] Updates in pre search criteria
VERBOSE: Found [1] Updates in post search criteria

VERBOSE: Accepted [1] Updates ready to Download
VERBOSE: Downloaded [1] Updates ready to Install
I've started converting my script into a GUI and have set it up to show the available updates and prompt to continue, I would like to know if it's possible to then output the verbose into my RichTextBox?

Code:

if ([System.Windows.Forms.MessageBox]::Show("Continue?", "Would you like to install these updates?", [System.Windows.Forms.MessageBoxButtons]::OKCancel) -eq "OK")
{
$richtextbox_Output.Clear()
$richtextbox1.SelectionColor = 'Blue'
$richtextbox1.AppendText("Installing updates... `n")
Get-WindowsUpdate -NotCategory "Drivers" -NotTitle "Windows 11" -Verbose -Install -AcceptAll -IgnoreReboot
}

Statistics: Posted by DReAMeRnz — Tue Dec 19, 2023 6:27 pm



Viewing all articles
Browse latest Browse all 480

Trending Articles