Home

Set-SCOMMaintenanceMode Deluxe ed. [#opsmgr #powershell]

Untimely, perhapsWhile most of us are waiting for SCOM 2016 RTM to be generally available i’ve completely forgot to blog about my little Set-SCOMMaintenanceModeDeluxe.ps1 script I wrote a while ago. It is pretty much a small extension to the regular Set-SCOMMaintenanceMode cmdlet that allows you to set Computers, Groups or specific Windows Services into maintenance mode.I have yet to make it a proper module (although I have promised myself to do so) so you’d still have to manually download the script and execute it the old-fashioned way. I’ve uploaded it as a public gist on github, so feel free to add adapt it to your needs. Here’s the gist

Resize all images in a Word document with #vbs #macro

TLDRQuick and dirty macro to resize all images in a word document to 145 mm. I am lazy like that. Get the gist of it here. The “Why”Ok, so. I am a consultant, as you may know. And as a consultant, people pay me to do stuff and expect me to be efficient and deliver with high quality.Part of that entails writing documentation containing how I do stuff, where I do it and often why I do it.This documentation is expected to be detailed enough to make sure my customers will be able to follow the steps and produce a copy of my work. Most of the timethese document are a big part of the disaster recovery processes and might have to be executed by the on-call staff with no previous knowledge of the product. This means screenshots. Lots of screenshots.And while templates are nice and help me out a lot, the screenshots have to be from the actual installation and not some copy-pasta from a previous assignment.To help me out, I use the excellent free program Greenshot to quickly generate screenshots into a WIP-folder (or directly into Word if that is appropriate) and that makes it possible tograb snapshots of the process without having to pause all the time to PrtScn-Alt+Tab-Ctrl+V-Crop-Ctrl+C-Alt+Tab-Ctrl+C. I simply press PrtScn and go on with the installation. Being a bit pedantic, doesn’t help me out here though as I find myself selecting and resizing all the images in the Word document I have produced. This is a very time-consuming process and not the most exact one either.I want all images to be of scaled, if necessary, to an equal maximum width that fits comfortably withing the margins of the document template my company has prepared for me. So I created a fairly simple macro to do it for me. The “How”If you are un-familiar with macros in Word, you will find them under the “View” tab.Clicking on “Macros” will give you the option to execute the ones you have, or you can create your own using VBA (Visual Basic for Applications).To create one, select where you want it saved (normal.dotx in my case, as I want it readily available) and enter a name for it.This will bring up the Visual Basic for Applications IDE, where you can write your own fun stuff.

PoSH Grid Dashboard for RDSH [#opsmgr]

TLDRCustomer wanted to see all RDS Host servers in a view with their current total session count. Decided to use a powershell grid dashboard, and share the script. Here’s the gist of it: SCOM_RDSH_TotalSession_PoSHWidget.ps1 How ToKeeping it fairly short this time. Pre-requisites are: System Center 2012 R2 with UR2 or later Microsoft RDS Management Pack Microsoft Windows Core OS Management Pack Create a dashboard Rightclick and create a new view somewhere, make it a Dashboard View Enter Name and Description Select Grid type, and layout

In transit, again

We’re moving!Yep. Again. Although, it’s been a year or two since the last time. The reason(s)Ok, so I’ve using Wordpress for quite a long time now and it’s been good. Mostly.It’s a fairly solid platform and has a whole slew of feautures that work nicely. Before Wordpress I used Textpattern, a very slimmed, minimalistic authoring experience and my first contact with textile andsimilar markup/writing/notation languages. For those unaware, textile is not unlike markdown.Or should we say that markdown is not unlike textile? Considering that textile was invented by Dean Allen two years before markdown.Anyhow. Both work pretty much as good as the other, allowing the author to write in any text-editor, using easily readable and fairly logical formatting. Before that I used Movable Type, and prior to that either Dreamweaver or… well, notepad or vim. Problem with all of those platforms, however, is that they require dynamically generated webpages and technologies like PHP, Perl, .NET, Java and whatnot.That, in itself, has been a very minor issue until lately. Sure, it requires servers with logics, engines, add-ons, execution rights to the local filesystem etc, butstill a minor nuisance. Mostly a financial nuisance really as active servers tend to cost money while finding static hosting for free is still pretty easy.Hell! I could put a webserver on a RaspberryPi and get good performance for a small-ish blog like mine if all I am using is static content. But, again. Not a major problem in itself. The main instigating factors to move away from Wordpress are the increasing size of the package, the lack of personal control,the lack of ease to extend my platform due to ever-expanding APIs and the fact that it is so popular that every “hacker” and it’s mother knows how to find exploits on it.My webhost, NFSN has been very good at detecting probing and brute-force attempts and automatically block public access to stuff like the login-pages and XML-RPC interfaces when that happens.I am just so sick and tired of having to constantly be on top of it with software updates, plugin updates, theme updates, security updates, spam-filtering, re-enabling the login page… Back to the basicsTeknoglot.se will be served statically from now on, and it will be hosted for free on Github Pages.Using Hexo.io I can write my posts using markdown, then with a simple hexo generate --deploy generate and update the static files and publish them.No login pages to hack, no dynamic pages to exploit, no server security to worry about.

Event Id 4001 – “Cannot Add Type” in [#SQL] MP 6.6.4.0 for [#OpsMgr2012]

Was troubleshooting this little error message for a customer after deploying the SQL Server Management Pack version 6.6.4.0. The event is the generic “Health Service Script” with id 4001. Management Group: REDACTED. Script: Main Module: CPUUsagePercentDataSource.ps1 :Computer Name = "REDACTED.redacted.com" WMI = "ComputerManagement11" Service Name = "MSSQLSERVER" SQL Instance Name = "MSSQLSERVER"Error occured during CPU Usage for SQL Instances data source executing.Computer: REDACTEDReason: Cannot add type. Compilation errors occurred.Position:256Offset:21Detailed error output: Cannot add type. Compilation errors occurred.--------(0) : No source files specified(1) : using System;--------(0) : Source file "C:\Windows\TEMP\njdqtgfb.0.cs" could not be found(1) : using System; There are some known errors to the 6.6.4.0 version of the SQL management packs, and one of them does mention “Cannot add type. Compilation errors occured.”In a thread on the Technet Forums it was suggested that it has to do with rights, but focusing mainly on the SQL instance. What caught our eyes, however, was the fact that the script is using the C:\Windows\TEMP folder instead of its private one. And this seems to be because it is using a few .Net components that do some sort of JIT compilation.We took a quick look using procmon, filtered on C:\Windows\TEMP\ and yes indeed. The monitoring account used is trying to create and delete its temporary files in that very folder. A wild work-around appears!The work-around is simple, but cumbersome. Just make sure that the assigned RunAs account have read/write/delete rights on C:\Windows\TEMP.Now you just have to manage this on all your SQL-servers! (yaaaay)

OpsMgr 2012 R2 UR4 - Field Notes [#opsmgr]

Quick and unrefined notes on Update Roll-up 4 for System Center 2012 R2 -Operations Manager PreparationThe usual routine applies. Check the KB for instructions and take not ofknown issues. Check if Kevin Holman has written something about it. As thisis an update roll up, I pre-emptively expect that gotchas in UR3 mayapply. Remember to open the update catalog in IE as the downloader is notworking in other browsers. Download, unpack, toss what languages that does not apply to your organization. It is advised to disable any mail-generating alert subscriptions during theupgrade process to avoid unnecessary spammage. Issues - So Far[updated: 2014-11-03] Got a few problems with cross-platform monitoring templates not working after the update. This was due to missing files in the update package. Make sure you download the updated version! Have not updated a customer using gateways yet, so unless theyhave fixed the issues in UR3, expect an update to this section soon. Planning

SquaredUp Installation - Manual? Pfffft! [#opsmgr #squaredup]

Story-timeI saw SquaredUp some year or two ago while googling about on behalf of a customer looking for a dashboard kind of thingy. It looked good and fairly simple, but for some reason it never clicked with the customer and we ended up going for some custom-made dashboards with a little scripting and some DB-queries. I kind of liked the look of their product though and have kept an eye on them now and then.Fast-forward to may 21st this year and the release of version 1.8 and a whole slew of nifty little features. What specifically piqued my interest was the linked dashboards, SharePoint integration and the included SLA and Map plugins. This basically ticked a lot of boxes many of my customers have looked for and something we’ve normally been looking into… err… other products for. That, coupled with some new videos on their Youtube-channel, a few well-placed tweets and a little mail-correspondence had me setting it up in my portable little lab. One of the interesting points is how, supposedly easy, it is to set the portal up. So I reset my lab – PDT is just wonderful – and decided to go for the hail-dummy approach. No manual, no preparations, no check-lists… Next-next-next then hopefully a working portal. The InstallationFirst, download the installation file (yes, singular) through the link you’ve got in your email and save it somewhere proper. Doubleclicked the installation packaged and it now tells me it will install a few pre-requisites and configure the website for me. Next! The EULA I am sure each one of you are reading. Next! Installing, or rather configuring, IIS and pre-requisites for me. Very nice. Next!

OpsMgr 2012 R2 UR3 - Field Notes [#opsmgr]

Quick and unrefined notes on Update Roll-up 3 for System Center 2012 R2 - Operations Manager. PreparationUsual routine, check the KB for instructions and known issues. Double-check with Holman’s blog and take note of any irregularities.Download, curse your favourite deity and re-try in IE. Unpack the CAB-files (why do you keep putting them in CAB-files?) and throw away all the unnecessary language-specific console patches. Notify affected parts of the organisation, I’ve had the benefit to work with good release managers at all clients so far, so no biggie. Then try to close as many consoles as possible to avoid any blocks in database. Make sure you have the credentials for the Data Access service account at hand. Issues - So Far(updated 2014-09-02) The SQL Script for the OpsDW was deadlocked at all sites and customers without exception. It’s easily fixed by stopping the management server services. A few dashboards (the 2012 versions) went blank. Self-healed after some aggregation job over night. From what I’ve noticed, only the SLA Dashboards are affected but never all of them. Agents behind daisy-chained Gateways is not identified as in need of an update. “Repairing” them from the Console is one work-around that seems to work consistently. A few agents that was updated using Windows Update did not report as updated. Repair fixed that nuisance. Had to flush the cache on a few Gateways to avoid heartbeat failures from their agents. Only daisy-chained ones if I recall correctly. Planning

Cloudflare as Dynamic DNS [#cloudflare #mikrotik #script]

BackgroundI have, for a time, been using CloudFlare for CDN, Optimizations and DNS Management for this and a few other domains. At the same time, I’ve been using DynDNS to provide name resolution to my home network/lab. Browsing around the CloudFlare JSON API I noticed that I can update DNS records through some fairly simple HTTP GET requests, and since the RouterOS (the operating system used by Mikrotik’s routerboards) has support for some pretty decent scripting I decided to let my router update CloudFlare for some custom and free dynamic DNS resolution. AttributionMy current script is a modified version of a script developed by Konstantin Antselovich. Original script: http://konstant1n.livejournal.com/9759.html Original Author website: http://konstantin.antselovich.com/ Thanks! How you do itWhat you need RouterOS v6+ for HTTPS support Cloudflare API key, aka “Token”, found at the account page Cloudflare DNS Zone name Cloudflare Record Id (more on that later) Cloudflare subdomain name Name of the external router interface

Quick Demo - Add Windows Performance Collection Rule [#opsmgr, #mpauthoring]

By request, I uploaded a short clip demonstrating how you would add a windows performance counter to a performance collection rule using the Authoring Console. It is a fairly simple task to complete but does require the Authoring Console, obviously, and a better target class than what I use in the demo. The demo also assumes that this counter exist on all the targeted servers in your environment. It would be wise, when making your management pack, to check that it’s there on all targeted operating systems, and that’s what I use Performance Monitor for. (just search for perfmon in your start menu or run perfmon.exe) Enjoy.