Repurpose the restart notification to work for running/delaying Snapins



  • Here is the scenario I am trying to accomplish:

    I would like to find a way that I can push a software update via a Snapin to an employee or group but give the end user the ability to postpone the update if they want. For example, if I pushed out a Zoom update to a user while they were in the middle of a Zoom call it would interrupt their call. It the user could postpone the snapin then it could run after they are off the call.

    Here is what I am thinking.

    In the “Create new Snapin” page two new options are created:

    1. Snapin confirmation (has a checkbox)
    2. Snapin confirmation message (has a text box that allows you to type in a message that the end user will see)

    ![0_1585338426908_chrome_WO9cHQWpuq.png](Uploading 100%)

    Before the Snapin runs, the notification will pop up. Instead of saying “This computer needs to reboot to apply new software.” the text will be the confirmation message. Instead of having a “Shutdown Now” button, the button will read “Run task now”. The user can then choose to hide the notification and the snapin will run after the time runs down or they can hit the “Run task now” button and the Snapin will run immediately.

    ![0_1585338465573_AgE0nmOHxf.png](Uploading 100%)

    There could even be a message to let the end user know that the computer will reboot after the task is run (if that is an option selected for the snapin).

    One of the biggest concerns with running some snapins is interrupting employees while they are doing an important task. This would give the end user more flexibility.

    On a similar note, is there any way to do something like this right now? Is there a way to call the notification via a Powershell script through a snapin?

    Thanks!



  • Hey thanks for all your help @Sebastian-Roth. This helps me look into things more.

    Today I will try to setup a sandbox VM so I can look into playing around with 1.6.

    Thanks again!


  • Senior Developer

    @mckay said in Repurpose the restart notification to work for running/delaying Snapins:

    Is this documented anywhere?

    Sorry no. Not because we want to keep this secret but because we don’t have enough time to document it all.

    I will try to give some answers on the options but as I haven’t been the author of that code I might not know all the details either.

    The parameters are given as JSON string. So action is the name of one parameter and request it’s value. As far as I understand the code this parameter is not used in this case. I just used it in the example because it’s used in the fog-client code like this as well. Testing a bit more I found that you can run it without that parameter: {"period": 60, "options": 2, "aggregatedDelayTime": 0, "message": "This is a test message."} (encoded: eyJwZXJpb2QiOiA2MCwgIm9wdGlvbnMiOiAyLCAiYWdncmVnYXRlZERlbGF5VGltZSI6IDAsICJtZXNzYWdlIjogIlRoaXMgaXMgYSB0ZXN0IG1lc3NhZ2UuIn0=)

    Now with the options parameter you can switch the button label (see code here). It will show “Hide” when you set options to the value of 2 or 0 but “Cancel” when set to 1. Please don’t ask me why. It’s just the way it was coded and I can’t tell you why.

    As mentioned before I have that feeling that might not get what you want to achieve using FOGShutdownGUI. I am not even sure if it’s worth investigating any further. Probably better to look forward to working-1.6 instead.



  • @Sebastian-Roth said in Repurpose the restart notification to work for running/delaying Snapins:

    aggregatedDelayTime

    OK. So I am looking at the code now and trying to figure some things out.

    I am trying to get a better understanding of what FOGShutdownGUI.exe can do but I am not finding anything in the code that gives me the answers I looking for.

    Specifically I am wondering about what options I can pass for “action”: “request”, and “options”: (is “request” the option for action?) Is this documented anywhere?

    Thanks!


  • Senior Developer

    @mckay If you get stuck at some point you can ask here and we should be able to help.



  • Hey @Sebastian-Roth I will see what I can do! I am definitely not a developer so it will be slow going while I try to figure things out but I would be happy to try to contribute to FOG.


  • Senior Developer

    @mckay Now that I look at this again I can see this has a few flaws. The user will see the FOG dialog twice if you run it yourself because the fog-client definitely calls it and I cannot see a way to prevent from this. As mentioned before it won’t be easy to grab the user input (postpone, …) as this is being sent back over a local connection instead of returned as exit code by the FOGShutdownGUI.exe.

    We have the plan to only add features to the FOG branch working-1.6 which is intended to be the next major FOG version 1.6… Though it’s still some work before this is ready to go and developers are scarce. So if you are keen to push this forward I would ask you to setup a testing FOG server instance in your network and install working-1.6 on that. We can work on adding this feature to that and you’ll be testing things alongside. What do you think?



  • Thanks so much for your reply @Sebastian-Roth! I will start playing around with this and see what I can come up with.

    I am definitely not a developer but I would be happy to help in any way I can. Thanks again.


  • Senior Developer

    @mckay While I do like your request and I can see why you are asking for it I have to say that we don’t have enough people working on FOG to implement such new features any time soon.

    On a similar note, is there any way to do something like this right now? Is there a way to call the notification via a Powershell script through a snapin?

    You should be able to run the notification dialog with a specific message like this:

    C:\Program Files (x86)\FOG\FOGShutdownGUI.exe "eyJhY3Rpb24iOiAicmVxdWVzdCIsICJwZXJpb2QiOiA2MCwgIm9wdGlvbnMiOiAyLCAiYWdncmVnYXRlZERlbGF5VGltZSI6IDAsICJtZXNzYWdlIjogIlRoaXMgaXMgYSB0ZXN0IG1lc3NhZ2UuIn0="
    

    The base 64 encoded parameter string is {"action": "request", "period": 60, "options": 2, "aggregatedDelayTime": 0, "message": "This is a test message."} and you can adjust the text message as needed and re-encode.

    As well I have figured out a way that can be used to run a process in user context (which doesn’t seem to be too easy from what I found:

    schtasks /create /tn "MyTask" /sc once /st 23:00 /tr "C:\Program Files (x86)\FOG\FOGShutdownGUI.exe ..." /ru "domain\username"
    schtasks /run /tn "MyTask"
    schtasks /delete /tn "MyTask" /f
    

    I know this is definitely not enough to accomplish what you were asking for but it’s something to look at and see if you can make it run the way you want it. One thing is to enumerate the logged on user and schedule the task accordingly. But the really tricky part will probably be to receive the user input from FOGShutdownGUI and postpone the actual snapin execution…

    If you are really keen to get this into FOG soon you might want to join in and help adding this feature.


Log in to reply
 

313
Online

7.1k
Users

14.3k
Topics

135.1k
Posts