I have a powershell app I'm working on. One of my buttons is called GPUPDATE Verify where it calls a function to check the system log on a remote system to make sure GPUPDATE ran on it and send output to a textbox.
Below are codes. Can't figure out why it is not displaying the results into the textbox.
I'm still new to all this so please be gentle! lol
#OUtput Box
$OutputTxtbx = New-Object System.Windows.Forms.Textbox
$OutputTxtbx.Location = '335,200'
$OutputTxtbx.Size = '200,280'
$outputTxtbx.MultiLine = $True
$outputTxtbx.BackColor = "Black"
$outputTxtbx.foreColor = "White"
$outputTxtbx.Borderstyle = "none"
$objForm.Controls.Add($OutputTxtbx)
$objForm.Topmost = $True
$objForm.add_Shown({$objForm.Activate()})
[void] $objForm.ShowDialog()
#GPUPDATE Verify
$GPVButton = New-Object System.Windows.Forms.Button
$GPVButton.Location = '110,150'
$GPVButton.Size = '100,23'
$GPVButton.Text = "Gpupdate Verify"
$GPVButton.Add_Click({Verify})
$objForm.Controls.Add($GPVButton)
Function Verify{
{
$GPVButton.Add_Click({$GPV = Get-EventLog -ComputerName $WS -LogName System -InstanceId 1502 -Newest 1})
#$GPV = Get-EventLog -ComputerName $WS -LogName System -InstanceId 1502 -Newest 1
$GPTIME = $GPV.TimeGenerated
$OutputTxtbx.text = $GPTIME
}
}