PowerShell: ConfigMgr 2007 – Create Maintenance Window

Download “Create-Maintanance-Window-1.0.zip” Create-Maintanance-Window-1.02.zip – Downloaded 179 times – 1 KB

I am preparing new runbook for System Center Orchestrator.

In this runbook I am going to try to help out on some of the challenges found in Software Updates.

In this case I needed to create maintenance windows from Opalis/Orchestrator. It is not supported by default, therefore I had to make or find a PowerShell script.

I discovered that no scripts was available, so I created below script. This is the first version, don’t hesitate to bring comments about it and about improvements.

but  this can be used for the basic need.

I used the SDK example as inspiration


About the Author:

Jakob Gottlieb Svendsen

Twitter: @JakobGSvendsen

Jakob Gottlieb Svendsen is a Microsoft Cloud and Data Center Management MVP (http://mvp.microsoft.com/en-us/default.aspx), Working as Global Lead Developer, Senior Consultant and Trainer at CTGlobal, where he is one of the driving forces in keeping CTGlobal a System Center Gold Partner and member of the System Center Alliance.

Since he started at Coretech in 2007, he has focused on Scripting and Development, primarily developing tools, extensions and scripts for the System Center Suite. His main area is Automation (including OMS/Azure Automation, Service Management Automation, PowerShell and Orchestrator). Another area is Windows Azure Pack / Azure Stack, where he does implementation, development, workshops and presentations. He is a world-wide renowned voice in the Automation field.

He is passionately devoted to the community, to which he contributes by being a moderator at TechNet and sharing his knowledge at https://blog.ctglobalservices.com/jgs

  • Co-founder: PowerShell User Group Denmark
  • Speaker at MMS 2016, Minneapolis (www.mmsmoa.com)
  • SCU Europe 2014, 2015, 2016 (www.systemcenteruniverse.ch)
  • Microsoft TechEd North America 2014, Houston
  • NIC 2012,2013,2014,2015, Oslo (www.nic.com)
  • Microsoft CampusDays 2011, 2013, Copenhagen
  • Microsoft TechDays 2015, Sweden (www.techdays.se)
  • Microsoft Partner Event: New in SC2012 SP1
  • User group meetings (PSUG.DK , SCUG.DK/BE/NO, AZMUG + more)
  • Microsoft Certified Trainer.
  • Microsoft Scripting Guys Forum Moderator

Main working areas:

  • Automation (Azure Automation, SMA, SCO)
  • Windows Azure Pack / Azure Stack
  • System CenterVisual Studio Team Services / Team Foundation Server
  • Development:C#.Net, VB.NET, VBScript, PowerShell, Service Manager, OpsMgr, ConfigMgr
  • Orchestrator
  • Windows Azure Pack / Azure Stack

Training:

  • Azure Automation
  • Service Management Automation
  • System Center Orchestrator
  • PowerShell, VBScript, C#.Net, VB.Net
  • Windows Azure Pack / Azure Stack Development Workshops

6 Comments

  1. LazarusRS October 5, 2011 at 22:52 - Reply

    I am trying to achieve the same thing and stumbled accross your script when searching for solutions. The problem I having is that when running both the MSDN sample code or your script above I get a WMI Generic Failure. You got any idea what this might be related to?

  2. Jakob Gottlieb Svendsen
    Jakob Gottlieb Svendsen October 6, 2011 at 8:59 - Reply

    Hello Lararus.

    On which line do you get the generic error?

    it bet it mostly because of one of the values being invalid.

  3. LazarusRS October 7, 2011 at 21:28 - Reply

    On the $collsettings.Put() line

  4. LazarusRS October 7, 2011 at 22:36 - Reply

    Sorted it, you were right! The code i was using to create my schedule string was incorrect and so I was passing an invalid schedule…thanks for the help (and the powershell script!)

  5. VJ September 1, 2014 at 11:12 - Reply

    Hi,
    I am trying to set RecurrentType of Service window as 1 ( which equals none) but could not see effect on the Schedule and still it shows as Daily. Can you help me

    • Jakob Gottlieb Svendsen
      Jakob Gottlieb Svendsen September 2, 2014 at 11:12 - Reply

      Do you set the service window schedules to “” ?

      otherwise try that. Unfortunately i dont have a SCCM2007 env available anymore.

Leave A Comment