Quantcast
Channel: Configuration Manager 2012 - Application Management forum
Viewing all articles
Browse latest Browse all 4762

Reboot message pc when not rebooted 30 days

$
0
0
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.

Jan Hoedt


Viewing all articles
Browse latest Browse all 4762

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>