Had an interesting request come up this week. Someone asked me, 

"I want to patch my servers, but I'd like to have a System Restore done before hand, and also be able to have patching verify this has been done before hand."

So that got me thinking; well I know we could run a PowerShell command to enable and create a system restore point. 

enable system restore:
Enable-ComputerRestore -drive "c:\"

Create a restore point:
Checkpoint-Computer -description "My_first_checkpoint" -restorepointtype "Modify_Settings"

Source: http://mcpmag.com/articles/2012/02/21/powershell-windows-restore.aspx

How to run this above command from the K1 using Launch a Program:

NOTE: I found in the description, you can not use spaces

However, I wanted to take that a step further, and setup a Smart Label that includes only systems that have had a system restore point in the last 24 hours. 
To accomplish this, i would need to get a date of the last checkpoint into the K1000 in a date type format so I can use date operators on it. 
For that, I introduce to you the ShellCommandDateReturn custom inventory rule!

To get the last date of the last system restore point created, I run this:
get-computerrestorepoint | format-table @{Label=" "; Expression={$_.ConvertToDateTime($_.CreationTime)}} -HideTableHeaders

This should output something like this:
mPqxnP.png

(If you want to see the whole enchilada, you can run just get-computerrestorepoint to see all the details and verify the output above)

From there, I tried using just the command above in my shellcommanddatereturn rule:

ShellCommandDateReturn(cmd /q /c powershell.exe -command "get-computerrestorepoint | Sort-Object -property CreationTime -descending | Select-Object -first 1 | format-table @{Label=' '; Expression={$_.ConvertToDateTime($_.CreationTime)}} -HideTableHeaders")



And it worked beautifully!
ZMacAd.png

Now I can make a smart label based off of that date:
SScUen.png


BONUS
Someone shared this with me a while ago and thought I'd share it here since it helps me immensely when looking for my custom inventory rules under Software:
Create a Software Custom Inventory Label with the following MySQL query:

SELECT ID FROM SOFTWARE
WHERE (SOFTWARE.IS_MANUAL='1')
AND ((SOFTWARE.INVENTORY_RULE != ''))

This will show you all your custom inventory rules. Enjoy!