Skip to main content

Posts

Showing posts from 2016

Giving a helping hand - Community power

PowerShell is getting increasing attention and gaining followers each day. That is a good thing in my book. I saw a tweet about Citrix OctoBlu automation where Dave Brett (@dbretty) was using it to save money with a PowerShell script (full post here) to power on and off VMs. I reached out to him and asked if he would like a little help with his PowerShell script. To my delight, he happily accepted and this post is about how I transformed his scripts to take advantage of the full power of The Shell. Fair warning is in order, since I have never used or touched a OctoBlu solution.


Starting scripts


(shutdownScript.ps1)



(StartupScript.ps1)



What we would like to change

First of, a PowerShell function should do one thing and do it well. My first goal was to split the function into two parts where we have one function that handles both the startup and the shutdown of the VM-guests. Secondly I would like to move the mail notification out of the function and either put it in a separate func…

Ignite 2016 summary – Innovate, optimize, manage and empower your business with IT

This years Microsoft Ignite conference was all about transforming your business with technology. Here is a techy summary for business-minds.


Going forward, IT-Pros must prepare to answer both tricky business questions, and leverage new tools to meet business demands. I imagine questions like these:

What are the needs of our business? How can we empower our users to apply the cloud to gain competitive advantages? How can we innovate with greater agility and optimize our IT resources? How can we migrate from the traditional model where IT is just a cost-center, to a lean/mean machine where IT is the engine that powers our business strategy with increased earnings?

A model of the traditional business case

We live in a traditional world with traditional problems. Simplified a business consists of a few silos:
Internal users Your customersYour suppliers and partnersThe remainder of the universe
All of these are connected directly and indirectly through processes, some of them manual and some ma…

Windows Server 2016 – DevOps tools and features

I needed to dedicate a full blog post about Windows Server 2016 and the way it will impact you going forward. At some point some of these features will apply to you too, as your infrastructure start to run the new server bits. Here are the highlights from MSignite.

> Highlights
Installation Development Packaging and deployment Configuration Containers Operation Validation and Pester Testing Operating security
> Installation
Server 2016 comes in three flavors. You have the “Desktop experience” server intended for management of other flavors of 2016 or as a terminal server. Next is Server Core which is just the same full server without the desktop and is headless, intended to be managed from Powershell or from a server using the desktop experience. Then there is the new kid on the block, Nano Server. It is the new Cloud OS, born in the cloud and the workhorse for everyone serious about creating modern, lean, super-fast and easy to manage applications. 

Installation of the Desktop Expe…

Microsoft Ignite 2016 – Announcements and features

I have now spent 3 days at Ignite and walked a total distance of about 22km hustling from sessions and the Expo area according to my Iphone. These are some of my thoughts about what might affect you going forward the next year.

HighlightsWindows server 2016 Azure MonitoringAzure FunctionsAzure Networking
Oh yeah, and System Center 2016 was launched. Why is it not on my list? Well to be perfectly honest, the feature list is almost identical to the latest rollup on 2012 R2. More on that later.
Windows Server 2016 GAThis release of Windows server is the chosen one that is going to power the Azure infrastructure and tenant workloads on Azure and AzureStack when it is released next year. From the Hyper-V perspective, things have changed quite a lot. You will have to forget all best practices and how you setup Hyper-V and Storage. 2016 is all about scaleout filesystem (reFS/NTFS) and storage direct.

You also want to check the OEM hardware list to make sure your servers are listed there. Pay e…

Making array lookups faster

This post is about making lookups in arrays as fast as possible. The array can have may properties or few, it really does not matter. The only thing required is something unique that identifies each row of data.
So from time to time I find the need to make lookups fast. Usually it is a result of importing a huge csv file or something.



Sample data First we have to create some dummy sample data which we can run some tests against. We will create an array of 10001 objects with a few properties. The unique property that identifies each row is called ID:


(sample data script)



How to test performance?
There are a couple of items that impact performance in Powershell. For instance running a Measure-Command expression will yield quite different results. Normally the first run is slower than the second one and then the standard deviation is quite large for consequent runs. To decreate the standard deviation, I use a static call to the .net GarbageCollector with [gc]::Collect(). I feel that th…

Creating Menus in Powershell

I have created another Powershell module. This time it is about Console Menus you can use to ease the usage for members of your oranization. It is available on GitHub and published to the PowershellGallery. It is called cliMenu.






Puppies
This is a Controller module. It uses Write-Host to create a Menu in the console. Some of you may recall that using Write-Host is bad practice. Controller scripts and modules are the exception to this rule. In addition with WMF5 Write-Host writes to the Information stream in Powershell, so it really does not matter anymore.



Design goal
I have seen to many crappy menus that is a mixture of controller script and business logic. It is in essence a wild west out there, hence my ultimate goal is to create something that makes it as easy as possible to create a menu and change the way it looks.
Make it easy to build Menus and change them Make it as "declarative" as possible
Menus
The module supports multiple Menus, however only one Main-Menu with as man…

Identity Manager and Powershell

It is year 2016 and Identity Manager looks like it did in 2010 when Forefront Identity Manager (FIM) was released. Who came up with the name and added it to the Forefront portfolio anyway, crazy stuff. As you probably know, looks can be deceiving. Even if MIM looks the same and run basically the same features, it is still a powerful state machine. I have been buzy collecting scripts and tools I have used the last couple of years and have started on 2 Powershell modules for MIM. This post is just a brief introduction to the module and the plans for the future.


Why create a moduleWait a minute. Does not Identity Manager come with a Powershell module? No, it comes with a Powershell snap-in from 2010. Back in those days Snap-ins where the cool kids on the block and everybody created snap-ins for things that should be created as a module. I blame Powershell version 1.0, however they fixed that in Powershell version 2.0, I think. I use the snap-in as a nested module and have created a Powers…

Pester Operational Tests

I have created yet another GitHub repro "PesterOperationTest". Feels like I do this every week, however that is not the case.

But why?The purpose of this repository is to collect Pester Unit tests for your infrastructure. Anything that is mission critical for you business deserves a tests that validates the correct configuration. It will make you sleep like a baby and stop worrying when you implement a change in your environment if you tests pass.

This will only become as good as the contribution you make to the repository. I would love to do all the work myself, however there is not enough time in the world. Think of it like you are helping yourself and at the same time a lot of other people could benefit from the test you create.

How?My original thought was to organize this in folders, one for each vendor and with subfolders for each products and/or feature. The scripts will be published to the Powershell Gallery for easy and convenient access for everyone. The tests should …