Windows Update Popup erscheinen lassen
Hallo,
Windows8 x64
Nach einem manuellem Update, ist es möglich das Windows Update Popup für den User anzeigen zu lassen mit dem Timer zum neustart?
z.b. firefox wird geupdated dann wird das popup geöffnet 10min zeit oder in 4h etc..
Windows8 x64
Nach einem manuellem Update, ist es möglich das Windows Update Popup für den User anzeigen zu lassen mit dem Timer zum neustart?
z.b. firefox wird geupdated dann wird das popup geöffnet 10min zeit oder in 4h etc..
Please also mark the comments that contributed to the solution of the article
Content-Key: 272771
Url: https://administrator.de/contentid/272771
Printed on: April 23, 2024 at 07:04 o'clock
4 Comments
Latest comment
Zitat von @Marabunta:
das weiß ich, es ist aber irrelevant wenn ich die meldung manuell aufrufen kann
Da müsstest du schon die Windows DLLs analysieren ... IMHO ist es einfacher sich selber die Funktionalität nachzubauen, geht auch mit Powershell ohne das ein Powershell-Fenster zu sehen ist.das weiß ich, es ist aber irrelevant wenn ich die meldung manuell aufrufen kann
Gruß jodel32
Moin Marabunta,
wenn eine sehr ähnliche nachgebaute Variante des Dialogs nichts ausmacht :
Grüße Uwe
wenn eine sehr ähnliche nachgebaute Variante des Dialogs nichts ausmacht :
$showWindowAsync = Add-Type –memberDefinition @”
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
“@ -name “Win32ShowWindowAsync” -namespace Win32Functions –passThru
function Hide-PowerShell() {
[void]$showWindowAsync::ShowWindowAsync((Get-Process –id $pid).MainWindowHandle, 2)
}
#region Import the Assemblies
[reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null
[reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null
#endregion
#region Generated Form Objects
$formReminder = New-Object System.Windows.Forms.Form
$lblTitle = New-Object System.Windows.Forms.Label
$pbIcon = New-Object System.Windows.Forms.PictureBox
$comboDelay = New-Object System.Windows.Forms.ComboBox
$label2 = New-Object System.Windows.Forms.Label
$btnDelay = New-Object System.Windows.Forms.Button
$btnReboot = New-Object System.Windows.Forms.Button
$label1 = New-Object System.Windows.Forms.Label
$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
$timer = New-Object System.Windows.Forms.Timer
$waittime = 0
#endregion Generated Form Objects
#Provide Custom Code for events specified in PrimalForms.
$handler_btnReboot_Click=
{
$timer.Stop()
$timer.Dispose()
$formReminder.Close()
shutdown -r -t 0
}
$handler_btnDelay_Click=
{
switch ($comboDelay.SelectedIndex){
0{$waittime = 600*1000}
1{$waittime = 1800*1000}
2{$waittime = 3600*1000}
3{$waittime = 7200*1000}
4{$waittime = 4*3600*1000}
}
$timer.Interval = $waittime
$timer.Start()
$formReminder.Hide()
}
$handler_formReminder_Load=
{
$comboDelay.SelectedIndex = 0
}
$handler_timerTick = {
$timer.Stop()
$formReminder.ShowDialog()
}
$handler_pbIcon_Paint=
{
[System.Drawing.Graphics]$g = $_.Graphics
$g.DrawImage([System.Drawing.Icon]::ExtractAssociatedIcon("$($env:SystemRoot)\System32\shdocvw.dll").ToBitmap(),0,0)
}
$OnLoadForm_StateCorrection=
{#Correct the initial state of the form to prevent the .Net maximized form issue
$formReminder.WindowState = $InitialFormWindowState
}
#----------------------------------------------
#region Generated Form Code
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 195
$System_Drawing_Size.Width = 382
$formReminder.ClientSize = $System_Drawing_Size
$formReminder.ControlBox = $false
$formReminder.DataBindings.DefaultDataSourceUpdateMode = 0
$formReminder.FormBorderStyle = 3
$formReminder.ShowInTaskbar = $false
$formReminder.MaximizeBox = $false
$formReminder.MinimizeBox = $false
$formReminder.Name = "formReminder"
$formReminder.Text = "Update Erinnerung"
$formReminder.TopMost = $true
$formReminder.SizeGripStyle = 2
$formReminder.add_Load($handler_formReminder_Load)
$formReminder.StartPosition = 0
$formReminder.Left = [int]([System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Width - $formReminder.Width)
$formReminder.Top = [int]([System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Height - ($formReminder.Height + 30))
$timer.Enabled = $false
$timer.Interval = 60000
$timer.add_tick($handler_timerTick)
$pbIcon.DataBindings.DefaultDataSourceUpdateMode = 0
$pbIcon.BackColor = [System.Drawing.Color]::FromArgb(255,253,202,65)
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 10
$System_Drawing_Point.Y = 7
$pbIcon.Location = $System_Drawing_Point
$pbIcon.Name = "pbIcon"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 32
$System_Drawing_Size.Width = 32
$pbIcon.Size = $System_Drawing_Size
$pbIcon.TabIndex = 6
$pbIcon.TabStop = $False
$pbIcon.add_Paint($handler_pbIcon_Paint)
$formReminder.Controls.Add($pbIcon)
$lblTitle.BackColor = [System.Drawing.Color]::FromArgb(255,253,202,65)
$lblTitle.DataBindings.DefaultDataSourceUpdateMode = 0
$lblTitle.Font = New-Object System.Drawing.Font("Calibri",15.75,1,3,0)
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 0
$System_Drawing_Point.Y = 0
$lblTitle.Location = $System_Drawing_Point
$lblTitle.Name = "lblTitle"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 45
$System_Drawing_Size.Width = 392
$lblTitle.Size = $System_Drawing_Size
$lblTitle.TabIndex = 5
$lblTitle.Text = " Update Erinnerung"
$lblTitle.TextAlign = 16
$formReminder.Controls.Add($lblTitle)
$comboDelay.DataBindings.DefaultDataSourceUpdateMode = 0
$comboDelay.FormattingEnabled = $True
$comboDelay.DropDownStyle = 2
$comboDelay.Items.Add("10 Minuten")|Out-Null
$comboDelay.Items.Add("30 Minuten")|Out-Null
$comboDelay.Items.Add("1 Stunde")|Out-Null
$comboDelay.Items.Add("2 Stunden")|Out-Null
$comboDelay.Items.Add("4 Stunden")|Out-Null
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 273
$System_Drawing_Point.Y = 105
$comboDelay.Location = $System_Drawing_Point
$comboDelay.Name = "comboDelay"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 21
$System_Drawing_Size.Width = 97
$comboDelay.Size = $System_Drawing_Size
$comboDelay.TabIndex = 4
$formReminder.Controls.Add($comboDelay)
$label2.DataBindings.DefaultDataSourceUpdateMode = 0
$label2.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",9,0,3,0)
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 156
$System_Drawing_Point.Y = 106
$label2.Location = $System_Drawing_Point
$label2.Name = "label2"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 111
$label2.Size = $System_Drawing_Size
$label2.TabIndex = 3
$label2.Text = "Erneut erinnern in"
$formReminder.Controls.Add($label2)
$btnDelay.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 273
$System_Drawing_Point.Y = 138
$btnDelay.Location = $System_Drawing_Point
$btnDelay.Name = "btnDelay"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 97
$btnDelay.Size = $System_Drawing_Size
$btnDelay.TabIndex = 2
$btnDelay.Text = "&Später"
$btnDelay.UseVisualStyleBackColor = $True
$btnDelay.add_Click($handler_btnDelay_Click)
$formReminder.Controls.Add($btnDelay)
$btnReboot.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 173
$System_Drawing_Point.Y = 138
$btnReboot.Location = $System_Drawing_Point
$btnReboot.Name = "btnReboot"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 23
$System_Drawing_Size.Width = 94
$btnReboot.Size = $System_Drawing_Size
$btnReboot.TabIndex = 1
$btnReboot.Text = "&Neustart"
$btnReboot.UseVisualStyleBackColor = $True
$btnReboot.add_Click($handler_btnReboot_Click)
$formReminder.Controls.Add($btnReboot)
$label1.DataBindings.DefaultDataSourceUpdateMode = 0
$label1.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",9,0,3,0)
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 30
$System_Drawing_Point.Y = 51
$label1.Location = $System_Drawing_Point
$label1.Name = "label1"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Height = 51
$System_Drawing_Size.Width = 340
$label1.Size = $System_Drawing_Size
$label1.TabIndex = 0
$label1.Text = "Windows kann Dateien und Dienste nicht aktualisieren solange sie benutzt werden. Stellen sich sicher das sie Ihre Arbeit speichern bevor sie neu starten."
$formReminder.Controls.Add($label1)
#endregion Generated Form Code
#Save the initial state of the form
$InitialFormWindowState = $formReminder.WindowState
#Init the OnLoad event to correct the initial state of the form
$formReminder.add_Load($OnLoadForm_StateCorrection)
Hide-PowerShell
$formReminder.ShowDialog()
while($timer.Enabled){
[System.Windows.Forms.Application]::DoEvents()
sleep -Milliseconds 500
}