Patching Server Core

I’ve been rebuilding my test lab after installing a SSD into the machine running it in place of the SATA drive.  Huge improvement in load speed of virtual machines – well worth the cost.

I usually have a number of server core machines in the lab and use WSUS for patching.  One issue I’d never really resolved was patching those server core machines  – the control panel fro Windows Update isn’t available!

Finally found a solution in the Windows Update PowerShell module from

http://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc

Install the module and then you can install your patches using

Get-WUInstall –AcceptAll

I’m running Windows 2012 R2 on all my servers so the modules auto load

Posted in Powershell, Windows Server 2012 R2 | Leave a comment

European Summit deadline approaching

There are just over two weeks left for you to register for the European PowerShell Summit. At the moment we are still short of the number that would enable us to repeat a European Summit in 2015.  We had a lot of comments from people stating they wanted a Summit in Europe.  Now is the time to step up and support that idea.

Hope to see you there

Posted in Powershell, Summit | Leave a comment

DSC Resource Kit–wave 6

The next wave of the DSC resource kit is available with some new resources and updates to old favourites.

Details from:

http://blogs.msdn.com/b/powershell/archive/2014/08/20/dsc-resource-kit-wave-6-is-here.aspx

Posted in Powershell | Leave a comment

Learning, always learning

PowerShell is going mainstream amongst the administrator community – it may seem slow but the last couple of years has definitely seen a sustained upswing in adoption in my experience. As more people are demonstrating the benefits we see more people asking how they can learn PowerShell.

 

Two good ways come to mind. First is go on a course delivered by a recognised expert – if you’re thinking of attending a PowerShell course find out who is delivering it and look them up. If they don’t seem like an expert look for another course. There is s lot of bad practice being communicated and you rally want to cut through that and learn from a master of the subject.

 

if you don’t like, or can’t attend, a course then your best bet is Don Jones’ book – Learn PowerShell in a Month of Lunches – http://www.manning.com/jones3/

 

That completes the first part of your action. The second part is learning how to use PowerShell to administer the technology, or technologies, you work with.  Assuming you understand how to administer the underlying technology you need something to help you learn how to apply PowerShell to that technology. These are books I’d recommend:

For Active Directory

Learn Active Directory in a Month of Lunches – http://www.manning.com/siddaway3/

 

For IIS

Learn IIS in a Month of Lunches  – http://www.manning.com/helmick/

 

For more general administration

PowerShell in Practice – http://www.manning.com/siddaway/

PowerShell and WMI – http://www.manning.com/siddaway2/

 

For VMware

VMware vSphere PowerCLI Reference: Automating vSphere Administration

Managing VMware Infrastructure with Windows PowerShell

 

These are books that I’ve used or worked on in one form or another and that I’m prepared to recommend. There are books on other administration through PowerShell topics but not having read them I can’t recommend for or against

 

I’ll update this post periodically as I work through more technologies.

Posted in Books, Powershell | Leave a comment

Count property

Its frequently said that PowerShell is so big that no one can know everything about it.  I proved that today when I “discovered” a change in PowerShell of which I wasn’t aware.

 

If you create an array:

£> $a = 1,2,3

You can then get the number of members of that array i.e. its length

 

£> $a.count
3

 

£> $a[0]
1

 

In PowerShell 1.0 and 2.0 if you tried that on a variable that only held a single value you would get an error when you tried to access the first value:

£> $b = 1

£> $b.count

The count property returns nothing

 

£> $b[0]
Unable to index into an object of type System.Int32.
At line:1 char:4
+ $b[ <<<< 0]
    + CategoryInfo          : InvalidOperation: (0:Int32) [], RuntimeException
    + FullyQualifiedErrorId : CannotIndex

 

This changed in PowerShell 3.0 and later

£> $b = 1
£> $b.count
1

£> $b[0]
1

 

You can even try other indices
£> $b[1]
£>

 

And just get nothing back rather than an error.

 

This is really useful as you can now safely test on the Count property and if the value is greater than 1 to determine if its a collection.  Alternatively always treat it as a collection and iterate over the number of elements.  I can see this simplifying things for me in quite a few situations

Posted in Powershell Basics | Leave a comment

Split-Path serendipity

I’ve used Split-Path and its associated cmdlet Join-Path a lot when working with file system paths. Something I read today started me asking if it would work with URLs

 

It does:

 

£> Split-Path -Path ‘http://powershell.org/wp/forums/forum/windows-powershell-qa/’ -Leaf
windows-powershell-qa

£> Split-Path -Path ‘http://powershell.org/wp/forums/forum/windows-powershell-qa/’ -Parent
http:\\powershell.org\wp\forums\forum

 

£> Split-Path -Path ‘http://powershell.org/wp/forums/forum/windows-powershell-qa/’ -NoQualifier
//powershell.org/wp/forums/forum/windows-powershell-qa/

£> Split-Path -Path ‘http://powershell.org/wp/forums/forum/windows-powershell-qa/’ -Qualifier
http:

 

The –Resolve parameter won’t work because its not a file system path but if you need to play with URLs then could be useful.

 

Just for completeness Join-Path won’t work with URLs because its attempting to resolve the file path

Posted in Powershell | Leave a comment

European Summit countdown #1

There are four weeks left to register for the Summit if you are going to attend. Our numbers are moving in the right direction but we still need more registrations to make a 2015 Summit feasible.

Posted in Powershell, Summit | Leave a comment