Monthly Archive

PowerShell 5.1

Want to see what PowerShell 5.1 looks like?

 

Install Windows Server 2016 TP 5 or get on the fast ring for Windows 10 Insider Previews. The latest build – 14352 shows a PowerShell version of  5.1.14352.1002 with Powershell 1.0 through 5.0 as compatible versions

 

The WSMAN stack is still version 3.0 so no issues with remoting or CIM sessions between PowerShell 3.0, 4.0, 5.0 and 5.1

 

PowerShell 2.0 will have the CIM session issue as it uses WSMAN stack 2.0 and PowerShell 1.0 didn’t have remoting

Slides and Code from my WinOps 2016 talk

The slides and code from my WinOps 2016 talk can be found here:

https://onedrive.live.com/redir?resid=43CFA46A74CF3E96!79154&authkey=!AKIt7btEZsahTf8&ithint=file%2czip

DHCP scope

After rebuilding my test machine for Server 2016 (with mixed results) I needed to add a DHCP scope to the environment. I blogged about the DHCP PowerShell module several years ago.

 

To quickly add a DHCP scope to the current server

Add-DhcpServerv4Scope -Name 'Manticore Scope'  `
-StartRange 10.10.54.2 -EndRange 10.10.54.30 `
-Description 'Scope for Manticore domain' `
-Type DHCP -State Active -SubnetMask 255.255.255.0 `
-LeaseDuration (New-TimeSpan -Days 2)

 

Set-DhcpServerv4OptionValue  -ScopeId 10.10.54.0 -DnsServer 10.10.54.201

 

I’ll save this as I’ll have to rebuild the machine when Windows 2016 RTM’s and possibly again if I can’t get the wireless adapter to work then.

Windows server 2016 TP 5 activation

Having finished the current round of conference speaking I needed to upgrade my system to Windows 2016 TP5. I’m using a 6 year old Lenovo W510 system.

 

First problem is that I couldn’t get the wireless adapter working – after a lot of searching I saw a post with a similar issue due to the Wireless LAN Service which you need doesn’t install correctly. Server Manager and Get-WindowsFeature both show it as installed but the wlansvc service isn’t available – doesn’t show in in the services GUI or through Get-Service.

 

Telephone activation is a pain but works BUT if an internet activation fails you don’t get the telephone option.

 

This post http://www.urtech.ca/2016/02/solved-how-to-activate-windows-10-server-2016-through-command-line/

saved the day.

 

Basically type SLUI 4 in the run dialog to open the manual activation  dialog.

 

Hope this is fixed for RTM otherwise I’ll need a new machine.

Y shaped people

During the WinOps conference - http://winops.org/ – I attended a session on DevOps culture. At one point the discussion got on to skill sets.

 

I introduced the concept of the Y shaped skillset.

 

You should have a deep understanding on at least one area – C# development, Active Directory, web development, Exchange management – whatever it is you should a ‘go to’ person for that area. That’s represented by the down stroke of the Y

 

In addition in a devops world you ideally need a bunch of skills that span the devops range. At the top you should have a broad understanding across the range of skills – at least enough to have sensible conversations with other practitioners. Those skills can be backed up with a few areas that complement your main skill as you drop deeper into the Y.

 

Over time you may see your main skill set change and what was your primary skill migrate into a secondary area to be replaced by something else.

 

Next time you’re wondering what to learn - think of this model and think about what skills you need to add to complement and build on your current skill set

Windows container providers

Containers are a new feature in Windows 2016. I was preparing for my talk at the WinOps conference next week - http://winops.org/ – and realised I needed the container OS image for nano server

 

I discovered that there are 2 container image providers available through the PowerShell gallery.

 

In TP4 I used the ContainerProvider provider. That still exists BUT only supplies the TP4 images

PS>  ContainerProvider\Find-ContainerImage | ft -a

Name              Version      Source Description
----              -------      ------ -----------
NanoServer        10.0.10586.0        Container OS Image of Windows Server 2016 Technical Preview 4 : Nano Server Installation
WindowsServerCore 10.0.10586.0        Container OS Image of Windows Server 2016 Technical Preview : Windows Server Core Installation

 

If you want the TP5 images you have to use the ContainerImage provider

PS>  ContainerImage\Find-ContainerImage | ft -a

Name              Version         Source                Summary
----              -------         ------                -------
NanoServer        10.0.14300.1010 ContainerImageGallery Container OS Image of Windows Server 2016 Technical Preview 5 : Nano Server I...
WindowsServerCore 10.0.14300.1000 ContainerImageGallery Container OS Image of Windows Server 2016 Technical Preview 5 : Windows Serve...

 

This isn’t very satisfactory and will cause lots of confusion in the long term. I just hope we’re not getting a new provider with every new version of Windows 2016

Cloud Native Applications

Cloud Native Applications is a collection of hand-picked chapters presenting five topics that will give you insights into the world of cloud computing.  The link is here: http://bit.ly/1T46wP7

 

This is excellent value – its FREE.

 

You’ll find chapters on:

Amazon Web Services

Docker

Mesos

RabbitMQ

Netty

Enjoy

PowerShell and Nano server

Nano server is the new install option introduced with Windows 2016. It has a really tiny footprint compared to a server core machine.

 

Of course it has PowerShell but its not a complete port of the PowerShell you’re used to. The features that aren’t present are detailed here:

https://technet.microsoft.com/en-us/library/mt671124%28v=ws.12%29.aspx

 

What you get is PowerShell re-written for .NET core

 

If you want to develop your own cmdlets try this article to get you started:

https://blogs.msdn.microsoft.com/powershell/feed/

Loading assemblies

PowerShell is .NET based but doesn’t load all available .NET assemblies when it starts.

 

Many people still use something  like

[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')

 

to load additional assemblies.  This is a hang over from PowerShell v1 when there wasn’t another way to perform the load.

The LoadWithPartialName method has been deprecated - https://msdn.microsoft.com/en-us/library/12xc5368(v=vs.110).aspx – and shouldn’t be used.

 

Your alternatives are:

Add-Type -AssemblyName System.Windows.Forms

 

or in PowerShell v5

using assembly System.Windows.Forms

using namespace System.Windows.Forms

 

can be used

Free ebook: IoT

A free ebook from Manning: Using the Web to Build the IoT is a collection of six hand-picked chapters that introduce the key technologies and concepts for building the application layer of the IoT.  The page is here: http://bit.ly/1SUJW0P