Giter Club home page Giter Club logo

update-vms's Introduction

Update-VMs

Snapshot, patch, health-check, and potentially roll-back Windows VMs

Overview

This script inventories all VMs in VCenter specified and rolls out patches within defined patch windows to all systems over the course of 1 week.

When a machine is in its patching window, the script takes a snapshot of the VM (and removes any old snapshots created by the script), installs Windows patches, and then runs a healthcheck script (if it exists) at C:\scripts\healthcheck.ps1. If the healthcheck is not succesful or if the system is not accessible for a period of time after patching, the script rolls the VM back to the snapshot taken prior to patching and sends an email to alert administrators.

Getting Started

Tag all of your VMs that you want patched with the following attributes:

  • "Patching - Schedule" in format of Daily 0000 for patching at midnight, Daily 1200 for patching at noon, etc.
  • "BetaGroup" in format of 1,2,3,4 to define the sequence in which VMs are patched (see below for more details)

Run the script with the -Install flag to inventory all VMs that can be patched based on the above attributes.

Detailed Process

  • Initial Run (-Install Flag)

    • Get all Systems from source (default: VCenter)
    • Creates beta groups based on patching windows and criticality (if defined in VM properties)
    • Installs scheduled task to run patching jobs starting on the next Patch Tuesday and running every 30 minutes to patch any system in a patching window
  • Scheduled Task

    • Executes on Patch Tuesday at midnight for initial run patching against Beta1 Systems whenever they are in their patch windows (as defined in VCenter)
    • Every 30 minutes run through list to check if Beta1 systems are in patching window
    • If in patching window, apply latest patches
    • Wait 1 day
    • Patch all Beta 2 systems in their windows
    • Wait 1 day
    • Patch all Beta 3 systems in their windows
    • Wait 2 days
    • Patch all Beta 4 (all remaining) systems in their windows

Switches

-Install

-Inventory VMs from VCenter and build patch beta groups

-Installs self as a scheduled task to run every 30 minutes and patch systems according to beta schedule and patch windows  

-Audit

-Takes -VMName as argument and queries for available patches

-RegularPatch

-Apply patches based on patching windows and according to beta group schedule (Should be run in scheduled task) 

-OnDemandPatch

-Takes -VMName as argument and immediately applies available patches 

-VMName

-Name of single VM to patch or audit

-VMList

-Filename containing individual VM names line by line

OR

-"-VMList all" will patch or audit all VMs in VCenter

-KBs

-List of specific patches to apply when running OnDemandPatch

-Verbose

-Print detailed logging of script activities

update-vms's People

Contributors

jcjohnson34 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.