Monthly Archive

Categories

Monthly Archives: January 2011

Architecture and Design

When we are talking about IT infrastructure the terms architecture and design seem to be used with identical meaning – even by practising architects who should know better.

The two concepts are quite different.

A architecture is how we want deliver – the concept if you like.  I have seen this level labelled as conceptual design which in many ways is a better label than architecture. As an example we will consider the Windows server estate of an organization. It has been decided that architecturally the roadmap is to virtualise. Our architecture looks like this

  • Server farm  - hosts for virtualisation
  • hyper-visor and management system for virtual machines
  • SAN based storage for virtual machines

For simplicity I’ll leave out backup, networks etc etc. They are assumed to be present.

Notice that I haven’t mentioned a single product. Architectures are product agnostic.

A design is what we will actually implement.

There are a number of designs we could create to satisfy this architecture.

For instance:

  • 5 IBM based servers
  • VMware + vcenter
  • IBM SAN

or

  • 5 HP servers
  • Microsoft Hyper-V + SC Virtual Machine Manager
  • EMC SAN

we could continue building options. In many cases buying policy and/or existing infrastructure dictate the solution.

In any case these designs have the same architecture but they have different designs and implementations.

Architecture is product independent – Design is when we decide on the components we are using and pick the products.

First time sighting

I received an unsolicited job spec today – first time I’ve seen one with PowerShell listed as the essential skill

Now is definitely the time to start learning PowerShell if you haven’t already

Location stacks

We saw that push-location stores the current location and changes the location to the specified folder.  The location is stored on a stack. A stack is exactly what it sounds like. Think of a stack of plates. Each plate represents a location. The first location (plate) goes on the bottom and all subsequent locations (plates) pushed on to the stack and piled on top in order so that last stored location is on top.

We can see this by trying a number of push-locations.

Push-Location c:\test
Push-Location hklm:
Push-Location software\microsoft
Push-Location c:\teszzt2
Push-Location c:\scripts

 

We can then see the locations on the stack

PS> Get-Location -Stack

Path
----
C:\teszzt2
HKLM:\software\microsoft
HKLM:\
C:\test
C:\scripts

 

Stacks are unloaded from the top

PS> 1..5 | foreach {pop-location; get-location}

Path
----
C:\teszzt2
HKLM:\software\microsoft
HKLM:\
C:\test
C:\scripts

 

and now the stack is empty.

PS> Get-Location -Stack

 

it is possible to use the StackName parameter with push- & pop- location but that could get complicated and difficult to keep track of

get-scripting PowerShell Podcast

I recently recorded an episode of the get-scripting podcast which is produced by fellow PowerShell MVP Jonathan Medd.  The podcast is available from

http://get-scripting.blogspot.com/2011/01/get-scripting-podcast-episode-21.html

 

During the session we discuss:

 

I enjoyed recording the podcast and hope you will support Jonathan’s efforts by continuing to listen to future episodes

UK User Group–February Live Meeting


When: Tuesday, Feb 8, 2011 7:30 PM (GMT)


Where: Live Meeting

*~*~*~*~*~*~*~*~*~*

An introductory session showing how to get the most out of PowerShell’s utility cmdlets. These are
Compare-Object
ForEach-Object
Group-Object
Measure-Object
New-Object
Select-Object
Sort-Object
Tee-Object
Where-Object
Suitable for beginners and the odd possible surprise for experts

Notes


Richard Siddaway has invited you to attend an online meeting using Live Meeting.
Join the meeting.
Audio Information
Computer Audio
To use computer audio, you need speakers and microphone, or a headset.
First Time Users:
To save time before the meeting, check your system to make sure it is ready to use Microsoft Office Live Meeting.
Troubleshooting
Unable to join the meeting? Follow these steps:

  1. Copy this address and paste it into your web browser:
    https://www.livemeeting.com/cc/usergroups/join
  2. Copy and paste the required information:
    Meeting ID: 5D2B4R
    Entry Code: h_>SF*D9q
    Location: https://www.livemeeting.com/cc/usergroups

If you still cannot enter the meeting, contact support

Notice
Microsoft Office Live Meeting can be used to record meetings. By participating in this meeting, you agree that your communications may be monitored or recorded at any time during the meeting.

Location, location

The location cmdlets don’t seem to get used very much from the scripts I have seen. There are four cmdlets dealing with location:

Get-Location
Pop-Location
Push-Location
Set-Location

In its simplest use Get-Location supplies the path to the current folder

PS> Get-Location

Path
----
C:\scripts

 

Set-Location can be used to change folders.  It is aliased to

cd
chdir
sl

PS> Set-Location -Path dns
PS> Get-Location

Path
----
C:\scripts\dns

 

Push and pop are a bit more interesting

 

Push-location can be used to store the current location and jump to another location

PS> Push-Location -Path hklm:\software
PS> Get-Location

Path
----
HKLM:\software

 

Pop-location can be used to return us to our starting point

PS> Pop-Location
PS> Get-Location

Path
----
C:\scripts\dns

 

thats the basics covered but there is a bit more we do with locations as we will see

UK PowerShell User Group Meetings

Please note the following dates for your diaries:

 

8 February – PowerShell utility cmdlets

An introductory session showing how to get the most out of PowerShell’s utility cmdlets.  These are

Compare-Object
ForEach-Object
Group-Object
Measure-Object
New-Object
Select-Object
Sort-Object
Tee-Object
Where-Object

 

22 March – Regular Expressions

PowerShell MVP Tome Tanasovski will present on Regular Expressions.  This is an opportunity to learn more about an under used part of PowerShell.

Tome is a Windows engineer for a market-leading global financial services firm in New York City. He is a recipient of the PowerShell MVP award, the founder and leader of the New York City PowerShell User group, a blogger, and a regular contributor to Microsoft's Windows PowerShell forum. He has been featured four times on Hey Scripting Guy, and he is currently working on the PowerShell Bible, which is due out in 2011 from Wiley.

http://powertoe.wordpress.com

http://twitter.com/toenuff

 

12 April – PowerShell and COM

PowerShell has great support for WMI and .NET but don’t forget that many applications still only have a COM interface. This session will also cover accessing the Windows Scripting Host functionality. 

All sessions start at 7.30pm UK time unless stated otherwise.  (Note that UK goes to daylight saving time on 20 March)

PowerShell colours

The background and text colours for a PowerShell instance (not ISE) can be set through the properties of the window. There are a set of colours for the background and text of:

  • Error messages
  • Warning Messages
  • Debug info
  • Verbose output
  • Progress bars

that cannot be set in this manner.

There is a PowerShell 2.0 automatic variable called $host that will display information about the current instance of PowerShell.

These two facts are related how?

$host has a property called privatedata. This isn’t some super secret hidey hole to tuck away the bits of information you don’t want anyone else to read. It actually contains the colour settings we discussed above. On a default PowerShell install you will get:

PS> $host.privatedata

ErrorForegroundColor    : Red
ErrorBackgroundColor    : Black
WarningForegroundColor  : Yellow
WarningBackgroundColor  : Black
DebugForegroundColor    : Yellow
DebugBackgroundColor    : Black
VerboseForegroundColor  : Yellow
VerboseBackgroundColor  : Black
ProgressForegroundColor : Yellow
ProgressBackgroundColor : DarkCyan

 

These settings can be changed by simply put a line such as

$host.privatedata.ErrorBackgroundColor = "White"

into your profile.  If you only want a temporary change simply type it at the prompt.   The allowed colours are:

Black            White 
DarkBlue         Blue 
DarkGreen        Green 
DarkCyan         Cyan
DarkRed          Red 
DarkMagenta      Magenta  
DarkYellow       Yellow 
DarkGray         Gray

PowerShell and WMI – Chapter 4

Chapter 4 has been released for PowerShell and WMI. It is available through the Manning Early Access Program (MEAP) at http://www.manning.com/siddaway2/

The first 4 chapters cover:

  1. Solving Administrative Challenges
  2. Using PowerShell
  3. WMI in Depth
  4. Best Practices

Chapters 5 and 6 covering System Configuration Information and Disk Systems respectively are in the pipeline.  I’m currently working on chapter 7 on the registry. Chapters 5 onwards include lots of lovely scripts.

PowerShell Best practices

Ed Wilson – Microsoft Scripting Guy – gave a superb presentation to the UK PowerShell group tonight.  If you missed it the recording will be available for the next 365 days

You have been invited you to view a Microsoft Office Live Meeting recording.
View Recording
Recording Details
    Subject: Windows PowerShell Best Practice
    Recording URL:
https://www.livemeeting.com/cc/usergroups/view
    Recording ID: PPS9QQ
    Attendee Key: M5<|wdK;8

I would recommend this to everyone interested in using PowerShell.  You need to listen to the end if you want to find out Ed’s number one, must do, best practice