Hi,
I would like to:
1.send a message to pc's which have not rebooted for 30 days (collection exists) and force them to
reboot.
2.send a message to pc's which have a pending reboot (collection exists) and didn't reboot for 1
week.
Therefore I tested this simple powershell, sent via an application:
$wshell = New-Object -ComObject Wscript.Shell
$wshell.Popup("Your pc hasn't rebooted for 30 days. `r`n `r`n A reboot will be forced within 12 hours
as from now.",0,"Reboot Message")
That works fine, users get a popup. I trigger a forced reboot afterwards and use this as detection method for the first scenario:
$boottime = Get-CimInstance -ClassName win32_operatingsystem | select lastbootuptime -ExpandProperty
lastbootuptime
$boottime -ge (get-date).AddDays(-30)
The second scenario, I can find my way.
It looks like everything is working well but before implementing it, would like your feedback and meanwhile sharing it (might come in handy for other users).
J.
I would like to:
1.send a message to pc's which have not rebooted for 30 days (collection exists) and force them to
reboot.
2.send a message to pc's which have a pending reboot (collection exists) and didn't reboot for 1
week.
Therefore I tested this simple powershell, sent via an application:
$wshell = New-Object -ComObject Wscript.Shell
$wshell.Popup("Your pc hasn't rebooted for 30 days. `r`n `r`n A reboot will be forced within 12 hours
as from now.",0,"Reboot Message")
That works fine, users get a popup. I trigger a forced reboot afterwards and use this as detection method for the first scenario:
$boottime = Get-CimInstance -ClassName win32_operatingsystem | select lastbootuptime -ExpandProperty
lastbootuptime
$boottime -ge (get-date).AddDays(-30)
The second scenario, I can find my way.
It looks like everything is working well but before implementing it, would like your feedback and meanwhile sharing it (might come in handy for other users).
J.
Jan Hoedt