Below is a command I use within a batch file (I also have one in PS) to check WMI status, and a few other various quick checks prior to an Agent Push. If you get ‘PendingFileRenameOperations’ results, then the computer has a pending restart.  If the query states invalid, the keys do not exist and the computer doesn’t need to be restarted.

Change "servernamehere" value to the Agent in question: