GithubHelp home page GithubHelp logo

codaamok / pscmsnowflakepatching Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 75 KB

PSCMSnowflakePatching is a PowerShell module used to remotely invoke the install of software updates deployed to Microsoft Endpoint Configuration Manager clients.

License: GNU General Public License v3.0

PowerShell 100.00%
configmgr mecm memcm patching powershell sccm

pscmsnowflakepatching's Introduction

Branch Build status Last commit Latest release PowerShell Gallery GitHub
master GitHub Workflow Status (branch) GitHub last commit (branch) GitHub release (latest by date) GitHub Release Date PowerShell Gallery GitHub all releases

PSCMSnowflakePatching is a PowerShell module used to remotely invoke the install of software updates deployed to Microsoft Endpoint Configuration Manager clients.

With this module you can:

  • Pass a list of one or more computer names, a ConfigMgr device collection ID, or interactively choose a ConfigMgr device collection
  • For each host, invoke the install of all software updates deployed to it
  • See realtime feedback and result from each patch job written to the PowerShell console
  • Receive an output object when patching is complete for all hosts with the results

To read more of a discussion about how to use this module, see my blog post Patching Snowflakes with ConfigMgr and PowerShell.

Functions

Invoke-CMSnowflakePatching is the primary function of interest in this module. The others are actually helper functions for it, however I decided to make them public functions as they might be useful for you for other needs.

Requirements

In order to use PSCMSnowflakePatching, here are the requirements:

  • For each host you wish to target for remotely invoking the install of software updates, they must be reachable using PowerShell Remoting. Here is the Microsoft doc for PowerShell Remote requirements: (about_Remote_Requirements](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_remote_requirements)
  • Microsoft Endpoint Configuration Manager PowerShell module must be installed
  • You, or the service running the code, must have access to Configuration Manager itself in order to retrieve device collections and its members.
  • You, or the service running the code, must have permissions on the remote hosts to:
    • Reboot
    • Query WMI classes and invoke methods in the root\CCM namespace
      • A quick and dirty way to test, import the module and run the below safe commands and if no errors are thrown, you're probably OK:
Start-CMClientAction -ComputerName 'hostname' -ScheduleId 'MachinePolicyEvaluation'
Get-CMSoftwareUpdates -ComputerName 'hostname'

Getting started

Install and import:

Install-Module PSCMSnowflakePatching
Import-Module PSCMSnowflakePatching

Make one or more update available to a target system by deploying it from Microsoft Endpoint Configuration Manager.

For example, I deployed a handful to my test collection and executed the below:

$result = Invoke-CMSnowflakePatching -CollectionId 'P0100016'

Write-Host is used to produce realtime feedback about the process:

Within the $result variable is the output object, which could be handy for your other automation needs:

By default it doesn't reboot or make any retry attempts, but there parameters for this if you need it:

  • -AllowReboot switch will reboot the system(s) if any update returned an exit code indicating a reboot is required
  • -Attempts parameter will let you indicate the maximum number of retries you would like the function to install updates if there was a failure in the previous attempt

To do

  • Pass alternate credentials for connecting to remote hosts
  • Consider using PendingReboot or Test-PendingReboot from the gallery to make the IsPendingReboot reflect more than just the newly installed updates exit code

pscmsnowflakepatching's People

Contributors

actions-user avatar codaamok avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.