Show Maintenance Windows information for a device in ConfigMgr 2012

Maintenance Windows in ConfigMgr can help you a great deal to determine when installations will occur on your clients. Since the Maintenance Windows are configured per a collection basis, it’s recommended to have dedicated Maintenance Windows collection where you use the Include rule for collection membership. But this may not always be the case, and in some environments Maintenance Windows can be configured on a variety of collection, and in the end it might be quite hard to find out the enabled Maintenance Windows the device has. It would be nice if you’d have such a tab in the Device properties window, but unfortunately we don’t have such a luxury (yet).
This is where our friends PowerShell and the SMS Provider comes to the rescue. Since we can determine what collections the device is a member of by querying the SMS_FullCollectionMembership WMI class, it’s from there on quite easy to see which collections the device is a member of. And when we know that, we can query each collection for the Maintenance Window it has configured.
So I decided to create a right-click console extension that can show all the Maintenance Windows that affects a specific device. But since this functionality is already present in Peter van der Woude’s great tool, Peter gave me the idea to also show the upcoming Maintenance Windows. I figured this was a great addition to what I had decided to go with from the start, and set out for trying to figure out how to accomplish the upcoming Maintenance Windows part. It proved to be a difficult task from the start, but now when I look back at the code, it wasn’t really that hard after all.

Download the script

I’ve made the code available on the TechNet Gallery, and the direct link can be found here.

How to use the script from the ConfigMgr console

Previously when I made my Dell Warranty Extension Tool, I created a small executable that would install the tool automatically. This time around, I’ve decided not to do that but instead guide you through the steps. It’s actually really easy and doesn’t take very long.
1. Download the script from the TechNet Gallery and save it as Get-MaintenanceWindows.ps1.
2. Put the script in any desired location, for the purpose of this demonstration, I’ll put it in C:\Scripts.
3. Browse to the location below and create a folder called ed9dee86-eadd-4ac8-82a1-7234a4646e62.
<ConfigMgr console installation location>\XmlStorage\Extensions\Actions
Tip: You can always get the location of where the ConfigMgr console is installed by running the following PowerShell command:


4. Copy the XML data from below and create a XML file called MW.xml and save it in the ed9dee86-eadd-4ac8-82a1-7234a4646e62 folder. You may have to create the MW.xml file somewhere on the system where UAC won’t interfere and then copy it to the folder mentioned above. What I mean is that you may have to create MW.xml in your Documents folder and then copy it from there to the ed9dee86-eadd-4ac8-82a1-7234a4646e62 folder.

<ActionDescription Class="Executable" DisplayName="Show Maintenance Windows" MnemonicDisplayName="Show Maintenance Windows" Description="Show Maintenance Windows" SqmDataPoint="53">
		<Parameters>-noninteractive -windowstyle hidden -executionpolicy bypass -file "C:\Scripts\Get-MaintenanceWindows.ps1" -SiteServer "##SUB:__SERVER##" -SiteCode "##SUB:SiteCode##" -ResourceID "##SUB:ResourceID##"</Parameters>

If you take a look at the XML data, you’ll notice the Parameters section just below FilePath, is looking for the file I saved the PowerShell script as. For this to work in your environment, change the location to where you’ve saved the script downloaded from the TechNet Gallery.
5. Relaunch any already open ConfigMgr console.
6. When you go to the Devices node in Assets and Compliance, right-click on any device you’ll now get a new option called Show Maintenance Windows.
7.  When you click on this option, a new window will open showing you what Maintenance Windows the device is affected by and show the date for the next upcoming one for each recurrence type.

Nickolaj Andersen

Chief Technical Architect and Enterprise Mobility MVP since 2016. Nickolaj has been in the IT industry for the past 10 years specializing in Enterprise Mobility and Security, Windows devices and deployments including automation. Awarded as PowerShell Hero in 2015 by the community for his script and tools contributions. Creator of ConfigMgr Prerequisites Tool, ConfigMgr OSD FrontEnd, ConfigMgr WebService to name a few. Frequent speaker at conferences such as Microsoft Ignite, NIC Conference and IT/Dev Connections including nordic user groups.


  • Great sharing! ๐Ÿ™‚
    What would be the XML if I like to call a PowerShell script from a selected User, rather than a Device?
    Many thanks in advance

  • Thanks. This helped me figure out which collection had a maintenance window that was used for testing originally but wasn’t removed after migrating to production and thereby causing mass reboots.

  • Awesome script! Feature request: show values of “Apply this schedule to:” for the MW object. There are three possible value available: “All Deployments”, “Software Updates”, “Task Sequences”. It would be awesome if we can see it in the same GUI.

  • Hello,
    I copied the instruction exactly but when I right click Show Maintenance Windows the form comes up blank with no information.

  • Hi ,
    thanks for the script. I get the action in the context manu, however I only get a blank form – no data.
    I am using sccm 2012 1511. Not sure if this is the problem. Just so that you know
    I have Peter’s script working without any problems. thanks for the link to that one.
    I would be grateful if you could point me in the right direction here please.

  • You do not know how much this tool is helping me! I couldn’t find where the maintenance windows I had applied were. I was trying to troubleshoot Patch Management but the maintenance window was blocking this.

  • How would I make this appear when right-clicking a device displayed in a “sub-collection” of Devices? I can only see it when right-clicking a device from the huge list that appears when viewing all devices.
    Thanks for what it does do though.

  • Is there a way to have the script display the status of devices within a collection? I.E – right-click a collection and have it output MW for each device in the collection.

  • Idea is really great, but script shows wrong information.
    E.g. I have collection which has maintenance window once per 6 months, but script shows that this window is for every month..
    I think it should work much deeper with information from DB about service windows..

    • Hi Zilva,
      Yeah I’m aware of that this is not working for all scenarios. I’ll see if there’s time to take a look at the script again and rewrite it.

  • Great tool,
    One question though, If I have a Maintenance Window that is recurring Monthly, ex. the 3rd Saturday every month, the “Upcoming Maintenance Windows” returns nothing. Is this a known feature?

    • Hi Tata,
      That’s not a know feature, and I’d assume it should at least try to calculate the next upcoming one. I’ll have to review the code and see if I can re-create the issue.

      • Hi,
        I’ve experienced the same problem and I’ve edited the script to solve this. This happens when the maintenance window for the present month has already passed (date in the past, in the same month). I’ve edited the script to add additional months if needed, my maintenance window occurs every 3 months the third Tuesday. If you are interested, let me know and I’ll provide you with the script.

      • Hi Bert, it would be a pleasure if you can share your script with me, weยดve got the same Scenario. BR

    • I also have this issue, a recurring maintenance window with the “monthly” recurrence, say every last Saturday doesn’t work with the script.

  • Let the drums roll! And that magic did the trick! Thank you Nickolaj for your your time and effort ๐Ÿ™‚

    • I see, you’d then need to create a folder called 3fd01cd1-9e01-461e-92cd-94866b8d1f39 and put the XML file in that and restart the Console for it to work ๐Ÿ™‚

  • Wow for the fast reply! ๐Ÿ™‚ No, you got me wrong. I’m ok with the per device basis. But when I try to get a maintenance window of a specific system in a custom collection, your extension does not appear in right click menu. It only appears in “Devices” node, not in collections. Thank you any way ๐Ÿ™‚

    • I’m not sure what you mean, have you put it in the correct GUID folder? Please attach a screenshot of where you want it to be ๐Ÿ™‚

  • Hello. Thank you for this precious extension. Is it possible to use it on any collection? Because the context menu does not appear in collections except “Devices”. It’d be much more useful this way ๐Ÿ˜‰

    • Hi Turker,
      Unfortunately, the extension is only per a device basis. At this moment I’ve no plans on re-writing this extensions. Maybe in the future ๐Ÿ™‚

  • Great script Nickolaj!! You just saved me a ton of time for something we needed to do here. Now if only I can figure out how to make this work on a whole collection, I can modify it and save even more time. Thanks again!

    • Hi Eric,
      I’m happy to help ๐Ÿ™‚
      If you manage to modify the script to work for a collection instead, please share it here so that others are able to make use of it (if you’re OK with that of course).


Categories use cookies to ensure that we give you the best experience on our website.