OWSUG.ca

Welcome to Ottawa's Windows Server User Group Community!
Welcome to OWSUG.ca Sign in | Join | Help
in Search

Canadian IT Pro Blog

Browse by Tags

All Tags » Guest Bloggers   (RSS)

  • Powershell on the Way to Work–Part 9

    Today is car pool day.   Only problem is somebody at work took that literally and I’m squished in the back seat of a Compact with a “Mr. Turtle” pool.

    So I promised to show you one of the cooler Cmdlets I ran into, EXPORT-CSV.

    Ok, so what if I told you I could give you a line in Powershell you could run on a staff member’s computer to show just HOW MANY Mp3 files were sitting on their personal folder?

    Let’s pick on fictional employee Mary Smith.  Mary’s boss has suspected (Due to the overheating LAN cable behind her computer) that she has been downloading a LOT of MP3’s and storing them on the company workstation.  He like to know just how bad.

    So you remember GET-CHILDITEM right?

    If we did something like this

    GET-CHILDITEM C:\USERS\MARYSMITH\ –recurse

    That would dump MarySmith’s entire folder to the screen.   That’s neat but useless.    So say we want to filter and only show MarySmith’s massive music collection?

    GET-CHILDITEM C:\USERS\MARYSMITH\ –recurse –include *.mp3

    As the screen scrolls on by for what seems hours (for you see, MarySmith had a VERY detailed music collection) you realize it would be nice to have report to hand off to her manager to show how detailed the collection is.

    Well with Windows Powershell, you can take the output that is going to the screen and pipe it (SEND IT) to another Cmdlet called EXPORT-CSV.   EXPORT-CSV just takes whatever is given to it and “EXPORTS” it to a “Comma Separated Value” file.  Nothing more than that.

    So to get all of MarySmith’s detailed collection into a nice sheet that the Boss could navigate in Excel you just run.

    GET-CHILDITEM C:\USERS\MARYSMITH\ –recurse –include *.mp3 | EXPORT-CSV C:\Report\MarySmithMp3Collection.CSV

    Moments later a nice CSV file perfect for the Spreadsheet of your choice is ready.   The neat thing is you can run just about ANYTHING that is on the screen into EXPORT-CSV.

    Of course this was completely fictional.  The real Mary Smith is law abiding citizen.  When you get into Active Directory and Windows Powershell, you could with a MINOR change pull down a userlist or Group Memberships and drop them in as a CSV file.

    But that is another story.  We’ll chat later as soon as I get “Mr. Turtle out of my ear”

    DSC_0158 (640x425)_thumb

    Sean Kearney
    Twitter: @energizedtech
    www.powershell.ca

  • Powershell on the Way to Work–Part 8

    Ok feeling better today.   Today we’re going to quickly touch on “Objects”.

    Now before all of you IT Pros go running into a corner screaming and casting oil slicks beyond you, we are NOT opening up Visual Studio.   But we are going to touch lightly on a topic that is important to be aware of when using Powershell. 

    No, you will not get tested on this.  Really it’s not that bad either.

    Let’s think in Dos terms first.

    In DOS we did this to set a variable

    SET THISTHING=A Whole pile of words I am staring at on the screen

    or

    SET THISOTHERTHING=55

    If you had to look at that and try to describe it, what would you say it was?  Really.

    I would say it would a bunch of letters.  But to describe it further it isn’t just a BUNCH of letters, it is a Number of letters. Or I might describe the other one as a number. Visually to ME it appears to be a number.

    If I was to have certain applications in Dos that could manipulate that data, I would have some Methods at my hand.

    Really that’s an Object.   The way we would look at that particular information as a WHOLE is an Object and what we can do to it.   (Ok all of you Developers peeking in, this is a REEEEEAALLY simplified explanation, so please stop laughing) Winking smile

    Is your brain spinning a bit?  Let’s look at this Powershell Variable I’m going to make.

    $BrainHurts=’Please Stop Talking About Objects.  Our brains are spinning.’

    In Windows Powershell anything that is stored in a variable is just an object.  That’s all.   To see what is attached to this object we pull out the almighty Powershell Canopener for viewing what’s attached to an Object called GET-MEMBER

    We ‘re going to “Pipe” that variable into GET-MEMBER.  Piping is a term you should be familiar with in Dos land.

    $BrainHurts | GET-MEMBER

    It will give us something like this

    image

    What is tell us looking up is that $BrainHurts is a String (System.String).   There’s a pile of methods (Think built in applications you can use to manipulate what $BrainHurts has) and maybe some extra information like “Length”.

    image

    Do you really care?  If you try to echo it on the screen it will still work.   But understanding that everything in Windows Powershell is an object is important.  It is so much of the Power it contains.   Later on when we touch on Active Directory and understand that each user is an Object, GET-MEMBER will be a way to see what “properties” that user has (IE: Group Membership, Account Expiry, Last Logged on Date)

    We’ll touch on Objects sometime later.   For now, I’ll put the Genie back into the bottle (GET IN THERE GENIE!  *WHAP!*) and we’ll turn to some basics.   I’ll show you the first Cmdlet I ran into that made working with Active Directory a breeze.   EXPORT-CSV.

    Chat soon everyone, time to get back on the road (which is a lousy place by the way for Ballroom dancing)

    DSC_0158 (640x425)_thumb

    Sean Kearney
    Twitter: @energizedtech
    www.powershell.ca

  • Powershell on the Way to Work–Part 7

    “Aaaaaachoo!”

    Sorry got as cold today.  But we can still chat right?

    Today we’re going to learn about Variables in Powershell.   Ok don’t run away.  I’m not going to get all Developer on you and starting speaking in Tongues and spout Functions and code.

    We’re going to use Variables for the moment the same way we did in Dos.   Dos was easy

    SET THIS=SomethingOrOther

    And if we wanted to see that we did

    ECHO %THIS%

    Looks familiar right?

    In Windows Powershell we don’t have to use SET and the Variable name always starts with “$”  (That’s to remind you of all the money you’re going to save with Windows Powershell Winking smile)

    In actual fact, I think they stole it from Python (no not Monty Python) but I could be wrong.  So here is the same Variable we did in Dos in Powershell

    $THIS=’SomethingOrOther’

    You’ll see another difference.   I put quotes around the text.   Powershell is Smart enough to know the difference between Text and numbers.  But it has to be told that.   To identify TEXT from a Number you put either a Single quote around either side or Double quotes.  There is a difference but don’t worry about that now.   Text is still text.   Double quotes just give us “extra Powers” later on.

    Now if want to Echo that back to the screen I can just type in

    $THIS

    or

    WRITE-HOST $THIS

    Here’s the neat part with Powershell variables.   They do all the hard work.   I can tell a Powershell variable that it’s a Number, Text or even the Date and IT will figure it out.  Like this

    $ABunchOfSillyWords=’Hi Diddly Dee, an IT Pro Life for me’

    $MostImportantNumberEVER=42

    $TheCurrentDay=(GET-DATE)

    I can see a few eyes popping open.  “What do you mean you ran a Cmdlet and stored it’s output away?”

    That’s because we’re working with Objects.  We’ll talk about that next time, Right now I have to go sneeze

    Cheers

    DSC_0158 (640x425)_thumb

    Sean Kearney
    Twitter: @energizedtech
    www.powershell.ca

  • Powershell on the Way to Work–Part 6

    Hello, back on the grid again.  literally.   It appears that “Somebody” decided that redirecting all the traffic down a one lane residential street was a good idea.  So I’m stuck for a bit.  We can talk.

    Being that I have Time on my hands I think today we’ll talk about time in Powershell.   It IS far cooler than the old CMD.EXE prompt and far more Powerful.   Let’s try something simple.  I’ll introduce you to GET-DATE

    GET-DATE

    Yep, that was awe inspiringly boring.  I get the date.   But that’s not all it can do.    It can tell me what Day that was.

    (GET-DATE).DayOfWeek

    Or better yet, maybe I just want to know how many days into the Year we are.

    (GET-DATE).DayOfYear

    I could even with a wave of my hand do this and step into the Future

    (GET-DATE).Adddays(24)

    Pretty neat eh?  There’s even built in formats you can choose from like a Short Date or just the Time.

    (GET-DATE).ToShortDateString()

    (GET-DATE).ToShortTimeString()

    I can even tell it to show me a date based upon Criteria I give it.

    GET-DATE –Month 9 –Day 13 –Year 1999

    (Ed….Hmmmm I see no “Space:1999” fans in the audience here.   Well THAT joke was lost. )  But as you can see, GET-DATE is incredibly powerful as I can even produce content from it.   In fact later on when we show you how easy it is to work with Dates and Times in Windows Powershell you’ll wonder why you never used it before.

    Well traffic is cleared up, I’ll be going now.  Don’t forget anytime you need examples of what a Cmdlet can do in Windows Powershell just key in GET-HELP NameOfCmdlet –examples

    GET-HELP GET-DATE –examples

    Touch base soon!

    DSC_0158 (640x425)_thumb

    Sean Kearney
    Twitter: @energizedtech
    www.powershell.ca

  • Powershell on the Way to Work–Part 5

    Oh hey.  Back again are you?  Good thing too.  Flat tire so I’m stuck on side while the Tow Truck driver changes my tire….

    So let me take a few minutes today and show you a pretty cool Cmdlet called GET-CHILDITEM.

    If you remember a bit back, I showed you how typing DIR executes a GET-CHILDITEM.

    So you might think “Ah! GET-CHILDITEM is Powershell’s version of DIR!”

    You might think that but it wouldn’t be accurate.  I could get into great descriptions about Objects and DotNet but then you would fall asleep and my head my explode.    So let me show you some things GET-CHILDITEM can do and YOU can decide just what it is.

    First off, it’s not only good for the File System.   It can access what the Powershell world refers to as “Providers”.   The File system is only one. 

    For example if I do

    GET-CHILDITEM C:\

    You see a file directory of C:\ but I can also do this

    GET-CHILDITEM HKCU:

    Which will dump all of the keys in the Root of HKEY_CURRENT_USER

    GET-CHILDITEM CERT:

    Which will give me the ability to access my certificates.  There are others it can do as well.   We can access the built in Environment variables in Windows (Remember all stuff we used to access in DOS?  Yep! Nothing lost!) or even Navigate and filter on a much higher level.

    So it IS a Directory Cmdlet in a sense.  It will much of the content that you want.   To call it directory is not precise but it does meet our needs as the IT Pro.   Now let’s show you something neat it can do.   Like the old DIR it can recurse

    GET-CHILDITEM C:\ –recurse

    But we can also filter and say “Only give me these file types”

    GET-CHILDITEM C:\ –recurse –include *.txt, *.ini

    Or this was a neat one I ran across.   Go through a structure and show me ONLY files or ONLY directories

    GET-CHILDITEM C:\ –directory

    GET-CHILDITEM C:\ –file

    You can even combine this bits together

    GET-CHILDITEM – C:\SomeFolder –recurse –directory

    By default hidden files like System are still hidden but you can view them with a –force added on

    GET-CHILDITEM –C:\ –Force

    GET-CHILDITEM is an incredibly Powerful Cmdlet.   I’m betting you’re seeing what I did as an ITPro.  That even if I didn’t learn to script, just knowing this means I COULD have a far more powerful search tool on me.   But it get’s better.    You could actually delete files in Powershell based upon Date Time in only two lines.   But we’ll get into that later.  

    For now, the tire is back on the car.  Back to work and we’ll chat soon.

    DSC_0158 (640x425)_thumb

    Sean Kearney
    Twitter: @energizedtech
    www.powershell.ca

  • Powershell on the Way to Work–Part 4

    Traffic was rotten today so I’m sitting in a coffee shop.  Don’t tell the boss ok?

    So last time I mumbled something or other about Aliases and did a Wave of my hands to make you look the other way.  No ? I didn’t do that?  Darn Jedi mind tricks.

    So we mentioned Aliases.    Those familiar with the Unix world will know what an Alias is.   It’s just another word or set of characters to represent something else.  Sometimes to ease typing, sometimes to give us a comfort zone.

    We showed you GET-CONTENT also worked if you did TYPE.  Again this was because an ALIAS already existed for this.

    If you’re curious… we’ll take a few minutes to look at Aliases.  They’re kinda neat.

    If you type in

    GET-ALIAS

    This will show you a list of the current Aliases active in your Powershell console.   But since very few people can read as fast as I can normally talk, I would recommend our friend MORE get’s tacked on.

    GET-ALIAS | MORE

    image

    We can see Aliases for most of the Cmdlets.   If you look near the bottom you’ll see a familiar one called ‘dir’ – When you type in ‘dir’ in Windows Powershell it’s ACTUALLY running ‘GET-CHILDITEM’.  Type it in and take a look at the results

    DIR

    You’ll see output that looks an AWFUL lot like the DIR command in CMD.EXE and DOS.  That’s because GET-CHILDITEM run against a folder will do exactly that.   So although GET-CHILDITEM is an unfamiliar command to you since you’ve just started in Windows Powershell, it DOES work very much (although not the SAME) as DIR.   Using the Aliases can help Powershell become more comfortable using familiar names.

    Now if you’re curious what is the Powershell Cmdlet for a particular Alias, just ask Powershell.  So let’s say we were using what we THOUGHT was the TYPE command and we needed to know what it really was in Powershell?  Just key in.

    GET-ALIAS type

    image

    Afterward you’ll see output on your screen showing you the Alias name “type” under the heading “Name” and the actual Powershell Cmdlet “Get-Content” under “Definition

    Now the flip side is what if you found a Powershell Cmdlet and were curious if there are any predefined Aliases for it?  That’s an easy one as well

    GET-ALIAS –Definition Get-Content

    Again how I figured most of that out was play with GET-HELP GET-Content –examples to see if there was an example of how to use this particular Cmdlet.  I found the third example provided in help had what I wanted but I had to edit the name of the Cmdlet.

    If you’re feeling curious I can take a few moments and show you how to make an Alias.  It’s actually very easy.  We use the “NEW-ALIAS” Cmdlet.

    So let’s say we’d like to make an extra alias for Get-Content called “showfile

    All we’d have to do is type in

    NEW-ALIAS –name showfile –value Get-Content

    Now you can type in showfile as well as type for Get-Content.   Take note, this is a temporary change and will go away. 

    Yes you can make it permanent but my Boss is now buzzing me.  I should actually get back on the road to work

    Until next time, Keep on Shellin’

    DSC_0158 (640x425)_thumb

    Sean Kearney
    Twitter: @energizedtech
    www.powershell.ca

  • Powershell on the Way to Work–Part 3

    Hey!  Glad to see you again.   I took the bus today.   Gives me a little more relaxing time to clear my brain.  It’s nice not to be stuck on the HIghway today.

    We were playing with getting some basic help on a Powershell Cmdlet.  As we said, most of them are pretty good as they provide examples.

    Let’s take a look at one of the simpler Cmdlets called “GET-CONTENT”. 

    So who here would like to place bets on what “GET-CONTENT” does?  Anybody?  Anybody?  Bueller?  Bueller?

    Let’s find out.

    GET-HELP GET-CONTENT –Examples

    image

    If you look at some of the presented examples you should be quick to pick up that “GET-CONTENT” will GET the CONTENT of a file.  It will Get the Content of any file you specify just like TYPE did.  For example if you were to key in

    GET-CONTENT C:\FOO\Somefile.txt

    It would output to the screen the content of “Somefile.txt” located in the C:\FOO folder (whether that content may contain legible data is another issue of course)

    Unlike TYPE in DOS we have newer features like “Tail” which can view the “Tail end” of the text file.    This line will show me the last 5 lines of a Text file called “Booga.txt” in C:\Stuff folder

    GET-CONTENT C:\Stuff\Booga.txt –tail 5

    Now here’s a neat trick, try using “TYPE” in Powershell

    TYPE C:\Stuff\Boogs.txt

    Isn’t that interesting?  It still seems to work.  That's because Powershell offers us a feature called “Aliases” to use other words or short forms to call up the same Cmdlets.

    We’ll talk about Aliases a little later on and how you can use them.  Right now my bus has just gotten to it’s stop.

    Chat soon!

    DSC_0158 (640x425)_thumb

    Sean Kearney
    Twitter: @energizedtech
    www.powershell.ca

  • Powershell on the Way to Work–Part 2

    Gimme a second here, just have to park the car for a moment and get out my coffee.   Rush hour is crazy today.

    If I remember correctly we introduced you to a new Console called Powershell.   Really.  Just that.  A Shell.  Yeah we’re pretty certain it may bring about World Peace someday but we’re going to stick to the basics.

    Last time we run a Cmdlet (CoMmanD-LET) called

    GET-COMMAND

    To give us a list of available Cmdlets in Powershell.  But then I changed the landscape on everybody and added something to it to only show me the available Cmdlets

    GET-COMMAND –CommandType Cmdlet

    So how did I know I could do that?

    Within Powershell is a Help system.  It works a bit like the DOS and CMD.EXE one did where you would say “HELP” and put the Console Command afterwards.  But in Windows Powershell it’s called

    GET-HELP

    I can type

    GET-HELP GET-COMMAND

    and it will show me the parameters of that Cmdlet.

    Keying in

    GET-HELP GET-COMMAND –detailed

    or

    GET-HELP GET-COMMAND –full

    Will give me far more detailed information on it or the Full wallop that particular Cmdlet.   Just like in DOS I can use MORE and start pausing all of those goodies on the screen.

    GET-HELP GET-COMMAND –full | MORE

    But most Powershell Cmdlets have the ONE thing the ITPro needs.   Real world examples of how they can be used.   For the GET-COMMAND Cmdlet if I type

    GET-HELP GET-COMMAND –examples

    Will give you samples of how GET-COMMAND can be used.  Play with GET-COMMAND with some of the examples.  Get comfortable.  Relax

    Did you blink?  Guess what.  You’re already using the basics of Windows Powershell and may not have realized it.   Nice eh?

    Next time we’ll try some of the other Cmdlets to see what they offer us as the IT PRo.

    Until next time, go ahead and play.  It looks like traffic is clearing up and I’m back on the highway.

    Go ahead get your hands dirty Smile

    DSC_0158 (640x425)_thumb

    Sean Kearney
    Twitter: @energizedtech
    www.powershell.ca

  • Powershell on the Way to Work–Part 1

    I’ve heard from many IT Pros who want to learn Powershell.   They want to because they need to.   All the new technology revolves about Powershell.  Many vendors are beginning to adopt Powershell as an automation solution.

    But just where do you start?

    Let’s start at the beginning.   An Introduction.   My friends, this is the Powershell Console

    image

    Powershell, please say Hello to everyone out there.

    image

    Ok yes… that was silly but that is your first introduction to Powershell.  It is a Shell just like CMD.EXE was a Shell.  It can accept simple commands.  Just like ECHO was a simple command.   That is the direction we’ll try to go with.

    You’ll hear a lot about how Powershell is a new Scripting Solution, it can manage Active Directory, it can (if you teach it apparently) tie your shoes.   But for the ITPro you don’t need to know ANY of that just to use Powershell.

    Key word in there… SHELL.  We used to do a lot in the Shell before we had the GUI, there was much we did in the Shell AFTER we had the GUI.   So what we have here is a new Shell.  For me personally I consider it a Management Shell.  I do many day to day tasks with Powershell.   Sometimes it makes more sense to leverage a tool in the GUI.

    But to use it, I didn’t really have to sit down for days and learn it.  I just picked up some simple Cmdlets I needed to aid me in my job as a Network Administrator when I started with Powershell.

    First off, what is available?

    There is a massive amount of Commands here referred to a Cmdlets (Pronounced CoMmanD-LETs) which all follow a simple VERB-NOUN structure.   You will have options like

    DISABLE-ADACCOUNT

    GET-CONTENT

    EXPORT-CSV

    Many of them are written to just make sense out of the box.  These are actual features that can be accessed from Powershell.  Imagine being able to easily UNLOCK a user account or DISABLE a computer?  Maybe even find files buried in the filesystem. This is what I use Powershell for. 

    To get a list of available Cmdlets in your Powershell console key in

    GET-COMMAND

    Of course your eyes will buzz out of your head with the rows pouring on the screen.   But just like in the world of CMD.EXE our friend “MORE” is still there to help

    GET-COMMAND | MORE

    That will let us step through and view the pages full of Content.  Just like in DOS and CMD.EXE.   You’ll three different types, Alias, Function and Cmdlet.   We’ll talk about the differences next time.  But for now We’ll change the GET-COMMAND to only show us Cmdlets.

    GET-COMMAND –type Cmdlet | MORE

    image

    Nice.   Only Cmdlets to see.   Less to confuse us with a smaller pile.   Where do you start?  Believe it not.  Just try typing in a Cmdlet to see what it does.   All of the Hotkeys you had in CMD.EXE still work too.  CTRL-C is still your best friend.

    But how did I find out how to work “GET-COMMAND” ? What if I want bigger letters?  What if I don’t like Blue?  What if I want to customize the console?

    All of this and more when we return.  Time for me to head out of the car and get to work.  I’ll see you soon.

    DSC_0158 (640x425)

    Sean Kearney
    Twitter:  @energizedtech
    www.powershell.ca

  • Canadian IT Folks–Dave Kawula–demystify’er of all things virtual

    (I know that word doesn’t exist – but I had a mental block and didn’t know what to use, so it stuck)

    As you may or may not know – I participate in the LinkedIn group called Canadian IT Folks – thought the name was a good fit for this series – one thing lead to another and bang – here ya go. Continuing in the series of Canadian IT Folks, I’d like to introduce you to my next Guest Blog post subject.  Who`s the subject matter expert? Dave Kawula from Tricon Technical Services in Calgary, Alberta. He and I collaborated on a screencast series called Demystifying the Microsoft Virtualization Stack earlier this year and it’s going to be posted this week here on the Canadian IT Pro Blog.  Dave also helped me out immensely being the main anchor for the Virtualization content area by shouldering the load of 3 sessions on Hyper-V, VMware and Virtualization Performance tuning. These will be available online at TechDays.ca in the not too distant future.

     Here’s Dave’s Bio and Post.

    Dave

    Dave Kawula is the CEO and Chief Architect of TriCon Technical Services Inc. based in Calgary.  Since 2004, Dave has been working with Microsoft’s internal technical SMSGR and GTR departments to create internal Microsoft training materials.  To date he has helped author over 40 courses for Microsoft.  Though Dave’s extensive virtualization expertise, TriCon has launched itself into the Hosted Solutions space with its TriCONNECT offering which features products such as Hosted Exchange, Virtual Desktops and Virtual Services On-Demand.

    Dave recently took on the role of Datacenter Virtual Technology Specialist at Microsoft – a recognition that he’s knows his stuff on all things virtual and helps out customers and partners where possible!

    You can follow Dave on twitter at @DaveKawula

    --- === --- === --- === ---

    Hello Hyper-V and System Center faithful. One of the jobs I took on over the summer was to do a screencast series on the Microsoft Virtualization Stack and how it compares to VMware. I am now done 4 parts of my Screen Cast Series.

    In the first Video you will get a great overview on how to start your Hyper-V Virtualization Project Properly. It’s all about the planning.

    Get your Trial Software to try this out yourself from www.microsoft.ca/evalcenter

    Check out www.microsoftvirtualacademy.com for free training on HyperV for VMware Administrators (among other things).

    Finally - Check out the video below…

  • Canadian IT Folks–Colin Smith - The Private Cloud in the Closet

    Something I’d like to start off with this Guest Blog post is the ability to get to know some of the fantastic speakers and partners in the technology space here in Canada. I created / participate in the LinkedIn group called Canadian IT Folks – thought the name was a good fit for this series – one thing lead to another and bang – here ya go.  Colin Smith was more then happy to help out with this post on the topic he`s rather passionate about.  If you didn’t have a chance to catch his sessions at TechDays – they will be available ONLINE at www.TechDays.ca once we flip the switch to the Online mode.

    headshot150x150Here’s Colin’s Bio and Post.

    Colin Smith is an IT professional with over 20 years of experience deploying Microsoft-based solutions for the private and public sector with a focus on desktop and data center management.

    Colin has been a consultant, solutions architect, and systems engineer with Microsoft, Statistics Canada, Configuresoft, and is currently the Manager of the Microsoft Consulting Practice at Cistel Technology Inc., a Microsoft Gold Partner in Ottawa, Canada.

    Public cloud providers have been touting the many financial, flexibility, and agility benefits of their offer for quite some time. Many organizations are salivating at the potential to reduce costs and increase efficiency but regulatory, security, and jurisdictional issues are preventing them from taking advantage of the public cloud offerings.

    Public clouds are the necessary first wave of cloud services. It is in these large scale environments with thousands of customers and stiff competition that consolidation and maturation will occur and standards (de facto and formal) will emerge. Additionally, toolsets that increase efficiency will be created to help create an edge in the competitive public marketplace. We are seeing the emergence of these tools and technologies right now and they can bring some of the benefits of the public cloud to on premise data centers.

    Benefits of Cloud Computing

    So what are some of the benefits of Cloud Computing? The following table outlines some of them.

    Benefit

    Description

    Reduced Cost

    Cloud technology is paid incrementally, saving organizations money and shifting Capital costs (CapEx) to operational costs (OpEx)

    Scalability

    IT departments that anticipate a change in load can add and subtract capacity as needed.

    Easy Implementation

    Without the need to purchase hardware, software licences, or implementation services, organizations can react quickly

    Flexibility

    Cloud computing offers increased flexibility because follows a utility model in which service costs are based on consumption.

    More Mobility

    Employees can access information wherever they are, rather than having to remain at their desks.

    Allows IT to Shift Focus

    No longer having to worry about constant server updates and other computing issues, IT organizations will be free to concentrate on innovation that drives business value

    Table 1 – Benefits of Cloud Computing

    In the rest of this post I will describe some of the technologies available from Microsoft[1] right now to help your organization realize some of the benefits of the cloud in your on-premise data center. You may even find that you already use many of these tools today and have a private cloud in the closet just waiting to emerge.

    Definition of Cloud Computing

    First of all, let’s review the five essential characteristics of cloud computing according to the NISTdefinition:

    Characteristic

    Definition

    On-demand self-service

    A consumer can unilaterally provision computing capabilities, such as server time and network storage, as needed automatically without requiring human interaction with each service provider.

    Broad network access

    Capabilities are available over the network and accessed through standard mechanisms that promote use by heterogeneous thin or thick client platforms (e.g., mobile phones, tablets, laptops, and workstations).

    Resource pooling

    The provider’s computing resources are pooled to serve multiple consumers using a multi-tenant model, with different physical and virtual resources dynamically assigned and reassigned according to consumer demand. There is a sense of location independence in that the customer generally has no control or knowledge over the exact location of the provided resources but may be able to specify location at a higher level of abstraction (e.g., country, state, or datacenter). Examples of resources include storage, processing, memory, and network bandwidth.

    Rapid elasticity

    Capabilities can be elastically provisioned and released, in some cases automatically, to scale rapidly outward and inward commensurate with demand. To the consumer, the capabilities available for provisioning often appear to be unlimited and can be appropriated in any quantity at any time.

    Measured service

    Cloud systems automatically control and optimize resource use by leveraging a metering capability at some level of abstraction appropriate to the type of service (e.g., storage, processing, bandwidth, and active user accounts). Resource usage can be monitored, controlled, and reported, providing transparency for both the provider and consumer of the utilized service.

    Table 2 – NIST Definition of Cloud Computing[2]

    So how do we provide these five essential characteristics in our on-premise data centers? The following sections illustrate how they can be achieved using existing off the shelf Microsoft products and technologies. In some cases, a product may address more than one characteristic while in other cases, more than one product or technology can be used to address the same issue while achieving slightly different results.

    Broad Network Access

    Broad network access has been available for a long time. Remote access to an application, platform or infrastructure can be accomplished in many ways including a web browser/server (http(s)) or a remote session using protocols that have been around for over a decade such as RDP, VNC, and RFB. The extension of these types of protocols to mobile devices and the build out of wireless networks has created a computing environment that can easily provide broad network access if it is desirable and appropriate. Microsoft has been providing web browser (IE), web server (IIS) and remote desktop protocols (RDP) for well over a decade.

    On-Demand Self Service

    System Center Virtual Machine Manager (SCVMM or VMM) has a self-service portal that can be used to provide system administrators and developers, (or anybody that has a need) a quick and easy way to request a virtual machine. It can be setup to use quotas based on resource or licence “points” to help manage the impact to infrastructure and can even have VMs that time out after a specified period of time. If templates are used, to configure VMs as they are provisioned (E.g. Windows Server 2008 R2, SP1 x64 with SQL 2008 R2), a fully working environment can be provisioned with no human intervention once a valid request from the self-service portal is received. In case you didn’t know, SCVMM can also be used to help manage VMware hosts.

    Resource Pooling

    Using SCVMM and clustered Hyper-V hosts, gives you the ability to dynamically move workloads between clustered hosts based on current resource requirements based on Performance and Resource Optimization (PRO) settings . Additionally, SCVMM provides the ability to manage the “fabric” that the VMs share. Although this is not a fabric in the sense that resource nodes can reside on physically separated hosts, this further decouples computing resources from the actual hardware and is move towards a true fabric.

    Rapid Elasticity

    In a similar fashion to how a VM created from the self-service portal, exceeding a threshold in System Center Operations Manager (SCOM - see the next section for more) or System Center Orchestrator (formerly Opalis) can trigger SCVMM to provision a VM. If the threshold is designed to be predictive, then a VM can be provisioned and left dormant until a second threshold is exceeded at which time the VM is brought online. Of course, a simpler option would be to always have a dormant VM on had but this is a less scalable solution, when dealing with many different server configurations. Additionally, the task sequence tools found in the Microsoft Deployment Toolkit (MDT) and System Center Configuration Manager (SCCM) can be used to automate the provisioning, updating and deployment tasks to the point where it takes less than 10 minutes to provision a server from start to finish.

    Measured Service

    The ability to measure the resource usage of systems has been around for a long time. There are dozens of products that have been around for decades that measure performance, availability and resource usage. Microsoft has had such a product for over a decade. System Center Operations Manager (SCOM previously known as Microsoft Operations Manager or MOM) can monitor workloads and provide both real-time and historical reports on how resources are consumed by specific users or workloads. While this is not a true bill-back solution, coupled with the SCVMM quota system, it is still a powerful way to measure and control service usage.

    Summary

    Using currently available products and technologies it is possible to build an on-premise data center solution that meets all of the definitional requirements to be called a cloud service. The table below summarizes the essential characteristics of a cloud from the NIST definition and the corresponding technology or product that can be used to provide it.

    Characteristic

    MS Technology / Product

    Broad Network Access

    RDSH/RDP/HTTP

    On-Demand Self-Service

    Self-service Portal/ SCVMM Templates

    Resource Pooling

    Hyper-V/SCVMM

    Rapid Elasticity

    MDT/SCCM/SCVMM Templates

    Measured Service

    SCOM/SCE

    Table 3 – Cloud enabling Technologies

    To take some of these ideas to the next level, you might find it interesting to look at the Dynamic Data Center Toolkit that is intended to help hosting providers build cloud solutions based on Windows Server and Hyper-V.

    If you are trying to build efficiencies into your data center using the Microsoft System Center suite of products, you may have already built a private cloud.


    [1] Microsoft is not the only vendor offering solutions in this space. I am limiting this post to examples of Microsoft technologies because their wide deployment and familiarity helps to illustrate the point that these technologies are already in place in many data centers and available from a single vendor

    [2] NIST Special Publication 800-145 The NIST Definition of Cloud Computing, Peter Mell & Timothy Grance, Computer Security Division, Information Technology Laboratory, National Institute of Standards and Technology, Gaithersburg, MD 20899-8930, September 2011, U.S. Department of Commerce

  • The Hammer of Thor, the Lightening of Zeus, None compares to Windows Powershell! It can CLOSE MY OPEN FILES!

    Hi, I’m Sean.

    I’m an ITPro and about three years ago (and you can’t tell my wife this) I began my affair with Windows Powershell.   As you can tell from my background (and forget all the silly letters) I really just consider myself a true blue, grease under my fingers, crimpers in my pocket, screwdriver in my mouth, TECH.

    A few months back somebody asked on TechNet Talk Radio if Powershell could close files.   It might be able to do this but somebody else already wrote a great utility that already does this.  It’s called HANDLE.EXE from Sysinternals 

    The STRENGTH of this application is that it works well and can’t accidentally close all the files on the server. The weakness is that I cannot easily (out of the box) automate it. Or can I?

    Within Powershell one of the biggest pieces you need to remember is that everything (And I mean EVERYTHING) is returned as an “Object”.

    Now the rest of you ItPros, quit hissing like Gollum.   An “Object” really isn’t scary or nasty.   You won’t turn into “Darth Vader” because you used one.

    So here we’ve downloaded HANDLE.EXE into a little folder called C:\HANDLE PROGRAM and we’re going to query for all the open Word documents on the local computer.  As per the instructions in HANDLE.EXE I have run the console as an Administrator to gain the rights needed to globally close files

    C:\Handle Program\HANDLE.EXE .DOCX

    And we’ll get some output on the screen like this

    Handle v3.45
    Copyright (C) 1997-2011 Mark Russinovich
    Sysinternals - www.sysinternals.com

    WINWORD.EXE        pid: 13352  type: File           15C: C:\TEC2011\Why does Sean always leave his files open.docx
    WINWORD.EXE        pid: 13352  type: File           1B0: C:\TEC2011\If Sean Keeps doing this we won.docx
    WINWORD.EXE        pid: 7496   type: File            1A8: C:\TEC2011\demodocbadsean.docx

    It appears “SOMEBODY” who shall remain nameless has been leaving their Word documents open (tap tap tap)

    Normally if I would like to close an open file in HANDLE.EXE I would execute

    C:\Handle Program\HANDLE.EXE -c 15c -p 13352 –y

    And we would get an output like this, which if it’s successful even outputs a line with the status at the end.

    Handle v3.45
    Copyright (C) 1997-2011 Mark Russinovich
    Sysinternals - www.sysinternals.com

      15C: File  (R--)   C:\TEC2011\Why does Sean always leave his files open.docx

    Handle closed.

    So I can do this in Windows Powershell as well with a minor difference.  I’m going to store all the output from HANDLE.EXE (Since the output to my screen is an Object) into a Variable.

    $RESULTS=(& 'C:\HANDLE PROGRAM\HANDLE.EXE' .docx)

    So the output that WOULD have gone to the console (which is an Object) is stored in $RESULTS.   If you type $RESULTS into the Powershell Console you’ll see the same output as before.

    But since it’s in a variable we can now access and manipulate that output in a way we couldn’t before.  If we look at the screen we’ll see that the output is consistent.   All the lines that have the information we need contain “pid:” just before the Process and “type: File” just before the File handle.

    So in Windows Powershell I can take the [String] object that is stored in $RESULTS (My Console output) and pull all of that out with a quick comparison, which I’ll store away in a variable I’ll call $HANDLEDATA

    $HANDLEDATA=$RESULTS –match “pid:”

    Which will output to the screen only that data.  At this point we can run each line through a SELECT-STRING to find where in the string the content sits.  I need to find the location of “pid:” and “type: file” in each line and pull the number following it out.  I’m going to work on the first entry in the [String] array as an example

    We’ll grab the ProcessID number first.  SELECT-STRING will find it’s position which we’ll store away as $StartPid

    $StartPid=($HandleData[0] | SELECT-STRING 'pid:').matches[0].Index

    Then we’ll access the content which is consistently starting at positions away (The length of ‘pid: ‘) and is never more than 7 bytes long (I counted Smile with tongue out).  We tack on the “trim()” to make sure if there are any blank spaces before or AFTER the Number they are “Trimmed” off

    $Processpid=$Handledata[0].substring($StartPid+5,7).trim()

    We’ll repeat the process for the File Handle in a similar method.  Find the String with SELECT-STRING, Grab it’s index and then pull out what we need with a little substring()

    $StartFileID=($HandleData[0] | SELECT-STRING 'type: File').matches[0].Index
    $Fileid=$HandleData[0].substring($StartFileID+10,14).trim()

    At this point we have a way of pulling out consistently the the necessary data to send it back to HANDLE.EXE and close it.  I can execute a line like this now after I pull the information on each line.

    (& 'C:\HANDLE PROGRAM\HANDLE.EXE' –p $ProcessId –c $FileId -y)

    Now this will work but looks messy on the screen.  We could just store the results away in a variable and grab that last line showing a success/failure

    $CLOSEFILESTATUS=(& 'C:\HANDLE PROGRAM\HANDLE.EXE' –p $ProcessId –c $FileId -y)[-1]

    Ok so there’s all the pieces.   So what does it look like as a script?

    Just look below

    -------------------------CLOSEWORDDOC.PS1-------------------------------------------------------------------------

    #
    # Script to close all open Word Documents on my File Server because Sean keeps forgetting
    # Requires HANDLE.EXE from Sysinternals on the system.  Free download
    #

    $RESULTS=(& 'C:\HANDLE PROGRAM\HANDLE.EXE' .docx)

    $HANDLEDATA=$RESULTS –match ‘pid: ‘

    Foreach ($File in $Handledata)
         {
         # Get the Handle ID of the Process for this file

         $StartPid=($File | SELECT-STRING 'pid:').matches[0].Index
         $Processpid=$File.substring($StartPid+5,7).trim()

         # Get the File ID of this open File

         $StartFileID=($File | SELECT-STRING 'type: File').matches[0].Index
         $Fileid=$File.substring($StartFileID+10,14).trim()

         # Close It

         $CLOSEFILESTATUS=(& 'C:\HANDLE PROGRAM\HANDLE.EXE' –p $ProcessId –c $FileId -y)[-1]

         }

    #

    -------------------------CLOSEWORDDOC.PS1-------------------------------------------------------------------------

    Now of course this is a pretty static solution.  We could improve this in so many ways like using a variable for the file name or extension, dropping in some error handling.  But this is to give you a taste of how you can automate systems that weren’t DESIGNED to automate.

    If you want to have some real fun, here is a script that within Windows Powershell I took that SAME application (HANDLE.EXE) and extended it’s features into New Cmdlets via Advanced Functions.  One to show the open files, one to obtain their Process ID’s and FILE ID’s and a third to close them.  If you’re interested on where this one has gone I’ve uploaded it to the Technet Script Repository so you can download it.  With this version you can execute Cmdlets like

    GET-openfile DOCX

    To get the list

    GET-openfile XLSX | Close-Openfile –whatif

    To CAUTIOUSLY do it

    GET-openfile DOCX | Close-Openfile

    This can easily be turned into module as well (how I’m running on the system right now) to extend the abilities of your shell as well.  

    If you’re interested more in playing with Powershell and some of your legacy applications, there is an entire series on “Hey Scripting Guy” which delves into this. 

    Ah Powershell.  Where were without you before Smile

    ---------------

    clip_image001

    Sean Kearney is an infrastructure support analyst and Microsoft MVP in Window PowerShell. He is absolutely passionate about automation technologies—especially Windows PowerShell. If you say, “Powershell,” he may just break into song. Sean considers himself “just a tech at heart,” but he can often be found dabbling with most Microsoft technologies at a moment’s notice. We have also been advised to keep him at arm’s length from any open Starbucks in Seattle. We have been advised that any rumors about him ever singing for Microsoft JobsBlog are completely unfounded. Complete rubbish. Let us just keep it between you and me, OK?

    Sean's contact information:
    Twitter: EnergizedTech
    Blog: Energized About Technology
    Website: Powershell: Releasing the Power of Shell to You

  • Creating HA VMs for Hyper-V with Failover Clustering using FREE Microsoft iSCSI Target 3.3

    In my last piece (Creating a Storage Area Network Using Microsoft iSCSI Software Target 3.3) I showed you how to create software Logical Unit Numbers (LUN). In this article we are going to take what we have learned to leverage the benefits of a SAN device to create redundancy for our Hyper-V environment. We will:

    1. Create a failover cluster between two servers (nodes);
    2. Enable Cluster Shared Volume (CSV);
    3. Ensure Hyper-V is properly configured on both nodes;
    4. Create a highly available virtual machine (HAVM); and
    5. Test both Live Migration and Failover between the nodes.

    The equipment I am using for these demos are matching HP EliteBook laptops with Intel Core2 Duo T7700 CPUs and 8 GB of RAM. They are both running Windows Server 2008 R2 Enterprise Edition Service Pack 1. For most clustering there is no requirement for identical machines. For Hyper-V Live Migration, the ultimate goal of the article, the CPUs of all nodes have to be of the same family (a limitation of live migration from any vendor). Enterprise Edition (or Datacenter Edition) is required as Failover Clustering is not a feature of Windows Server Standard Edition. Because we are also using Cluster Shared Volumes this must be performed on Server 2008 R2.

    Proper networking is of course a requirement… although I strongly recommend having a dedicated network for storage, in this case I am using a simple D-Link gigabit switch to connect my two portable nodes, and have ensured that proper networking has been configured between my hosts:

    • host1.alpineskihouse.com (172.16.10.10)
    • host2.alpineskihouse.com (172.16.10.11)

    Connecting your second server to the iSCSI Target

    In the previous article we configured our LUN to present to host1. Before we create our cluster we have to repeat these steps for host2, or there will be no shared storage.

    In the server where the iSCSI Software Target is configured:

    1. Open the iSCSI Target (Start – Administrative Tools – Microsoft iSCSI Software Target)
    2. Right-click on LUN1 and click Properties.
    3. In the iSCSI Initiators tab click Add…
    4. In the Add/Edit Identifier screen select IP Address as the Identifier Type. Enter the Value as the IP Address of your second server, and click OK.

    clip_image002

    A dialogue box should appear warning you that you are assigning multiple initiators to a single iSCSI target. Accept the warning by clicking Yes. Click OK in LUN1 Properties.

    In the second server (host2)

    1. Open the iSCSI Initiator (Start – Administrative Tools – iSCSI Initiator (If there is a notice to enable the iSCSI Initiator Service accept it)
    2. In the Targets tab enter the IP address of your iSCSI Software Target and click QuickConnect…
    3. In the Quick Connect window you should have confirmation that you have discovered a target, along with its IQN. Click Done.
    4. In the Volumes and Devices tab confirm that your two volumes are listed, and click OK.
    5. Open Disk Management, and bring both volumes on-line. Assign them the same drive letters you had assigned them in host1.
    6. Log off of host2.

    Create a failover cluster between two servers (nodes)

    The first step requires installing the Failover Clustering feature in Windows Server. As with any other feature this is fairly simple:

    1. In Server Manager click on Features, then click Add Features.
    2. Select Failover Clustering and click Next.
    3. On the Confirm Installation Selections screen click Install.
    4. When you have successfully installed the feature, repeat the process on all servers.
    5. In Host1 open Failover Cluster Manager (FCM) (Start – Administrative Tools – Failover Cluster Manager)
    6. In FCM click Validate a Configuration…
    7. In the Select Servers or a Cluster screen enter the names of the servers (in this case Host1 and Host2, which can be added individually or together separated by a semi-colon) and click Add; when the servers appear in the Selected Servers box click Next
      clip_image004
    8. In the Testing Options screen, make sure that radio button next to Run all tests (recommended) is selected.

      Note: It is an easy step to skip… and a potentially disastrous one. Running the Validation tests lets you see what might not work properly so that you can fix it. By not running the Validation tests you can not only set yourself up to fail, you can also pretty much guarantee that when your cluster does fail that nobody will be able to help you! 
    9. On the Confirmation screen click Next to begin the tests. This process will run for several minutes. Be patient!
    10. Once the Validation tests are complete you should receive a message in the Summary screen that looks like the one below, stating that your configuration appears suitable for clustering, despite some warnings. You can view the complete report if you’re curious. Once you are finished, click on the link to Create the cluster now using the validated nodes….
      clip_image005
      The Create Cluster Wizard will open. After reading the information click Next on the Before You Begin screen.
    11. In the Access Point for Administering the Cluster screen assign the cluster a name and an IP address in the appropriate subnet, and click Next.
    12. On the Confirmation screen confirm your settings are correct and click Next.

    The cluster will take a few minutes to create; be patient! You should get a Summary screen like the one below. Click Finish.

    clip_image007

    Enable Cluster Shared Volumes

    Cluster Shared Volumes (CSVs) is a feature of Failover Clustering in Server 2008 R2 for Hyper-V; it is a standard clustered NTFS volume that is available to all nodes that gives the HAVM (Highly Available Virtual Machines) complete mobility as any node can be an owner.

    To enable CSVs:

    1. On host1 open Failover Cluster Manager (Start – Administrative Tools – Failover Cluster Manager).
    2. If your cluster is not opened automatically, click Manage a Cluster and select your cluster from the drop-down list.
    3. In the main window under Configure click Enable Cluster Shared Volumes… You should receive the following warning in a pop-up window:

    “The Cluster Shared Volumes feature is only supported for use with Windows Server 2008 R2 Hyper-V role. Creation, reproduction and storage of files on Cluster Shared Volumes that were not created by the Hyper-V role, including any user or application data stored under the ClusterStorage directory of the system drive on every node, are not supported and may result in unpredictable behavior, including data corruption or data loss on these shared volumes.

    For information regarding support services, please see http://go.microsoft.com/fwlink/?LinkId=137158.”

    Click the check-box and click OK. Cluster Shared Volumes should now appear in the navigation pane under your cluster.

    clip_image008

    1. In the navigation pane click on Cluster Shared Volumes.
    2. In the Actions Pane click Add storage.
    3. The Add Storage window will appear; select the Cluster Disk 2. You can expand it to see your configuration is correct (as shown). Click OK.

    clip_image009

    Under Cluster Shared Storage you should now have your CSV configured. It is essentially a hard-link to your VHD that sits on the C drive on the host node under C:\ClusterStorage\Volume1.

    clip_image011

    Ensure Hyper-V is properly configured on both nodes

    Ensure the Hyper-V role is installed on all nodes in the cluster

    Hyper-V is an easy role to install. To ensure that it is installed, open Server Manager on each node, click on Roles, and ensure that Hyper-V is listed under Roles Summary. If it is not, add it now.

    clip_image013

    Ensure Virtual Networking is properly configured on all nodes in the cluster

    Under Virtual Networking you must ensure that each host has a virtual network that is identically configured. The name and connection type must match, else failing over will truly fail.

    clip_image015

    Create a Highly Available Virtual Machine (HAVM)

    There are two ways to create a highly available virtual machine.

    1. Configure an existing Virtual Machine (VM) as Highly Available; or
    2. Create a new Highly Available Virtual Machine (HAVM).

    For the purpose of this article we are going to create an HAVM.

    1. In host1 open Failover Cluster Manager (Start – Administrative Tools – Failover Cluster Manager).
    2. In the navigation pane navigate to Ski-Cluster – Services and applications.
    3. In the actions pane click Virtual Machines… click New virtual machine >. Select the node on which you wish to initially create it. For the sake of this article I will create it on host2.

    The New Virtual Machine Wizard will launch. Create the VM as you would any VM, ensuring that:

    • The Location of the VM is C:\ClusterStorage\Volume1\.
    • The Connection is connected to a virtual network that is identically configured on both (all) nodes.
    • The virtual hard drive is created in C:\ClusterStorage\Volume1\. If you are using a pre-created virtual hard disk, first move it to the shared storage.
    • Install an OS on the new VM.

    Note: You can install the OS on the VM on host2 from host1 in a number of ways; one way is to open Hyper-V Manager in host1, right-click on Hyper-V Manager in the navigation pane, and click Connect to Server… then type the host name (or IP Address) of host2. However you can also launch the Virtual Machine Connection from within the Services and Applications window in Failover Cluster Manager.

    Configuring HA and Testing Live Migration

    Once you have an HAVM created, we can configure it and then test it out.

    1. In host1, open Failover Cluster Manager and Hyper-V Manager. Connect to host2 and confirm that your highly available virtual machine is running.
      clip_image017
    2. In Failover Cluster Manager navigate to Services and applications. Right-click on your HAVM and click Properties.
    3. In the General tab select Host2 as the Preferred owner. Ensure the checkboxes for Enable persistent mode and auto start are selected.
    4. In the Failover tab select the radio button Allow failback. Click OK.
    5. In the Services and applications window right-click on your HAVM; hover on Live migrate virtual machine to another node and click (in the call-out) 1 – Live migrate to node Host1.

    clip_image019

    The HAVM should migrate relatively quickly to Host1. Verify in the Services and applications section that your HAVM is now owned by Host1. In Hyper-V Manager manage Host1 and verify that it is there.

    Following the same steps as above, Live Migrate your HAVM back to Host2.

    Testing HA Failover

    Now that we have performed an Active Live Migration, we have three tests left to go:

    • Perform a shutdown Live Migration
    • Verify Failback
    • Test Dead-hardware Failover.

    1. On Host1 make sure Failover Cluster Manager is open and that you can see that your HAVM is running on Host2.
    2. Log into Host2 and Restart it!

    clip_image021

    Notice in Failover Cluster Manager that the HAVM is restored on Host1 but in reality it is a Quick Migration, and the VM is not rebooted.

    Once Host2 is rebooted, after a few minutes your HAVM should fail back to its preferred owner. This may take a few minutes! Do not continue until the current owner for your HAVM is Host2.

    clip_image023

    Our last test is so simple that you can ask the least technical person in the room to do it. Turn off Host2. Do not perform a shutdown – this is supposed to simulate hardware failure. If it is a laptop unplug the power source and then remove the battery. If it is a server then just yank the power cord!clip_image025

    Within a second or two the HAVM should restart on Host1… it will be the equivalent of a dirty boot, but it will come up, alive and well. When you restart Host2 the HAVM will fail back to it just as it did before.

    Does it look and feel like black magic? Probably… but you’ll get used to it; you will get used to high availability without the high costs; you will get used to redundancy without excess hardware. Most of all you will be able to rest easy, knowing that your Hyper-V environment is truly highly available, and that you were able to do it all using a bunch of free tools from Microsoft.

    What’s next? Build it! Test it! Implement it! Love it! At long last we have true redundancy available for all.

    Mitch Garvis, MCT | Senior IT Consultant & Trainer | SWMI Consulting Group
    My blog | Twitter | Facebook | LinkedIn | MVP Profile

    I'm a PC

  • Creating a SAN using Microsoft iSCSI Software Target 3.3

    When Microsoft released their iSCSI Software Target to general download in April they opened up a world of possibilities for smaller companies (as well as IT Pros and hobbyists) who use servers, but cannot justify spending thousands of dollars on a Storage Area Network (SAN) device. In this article I will show you how to create a virtual SAN in your environment.

    Installing the iSCSI Software Target (available here: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=45105d7f-8c6c-4666-a305-c8189062a0d0) is a simple process. It comes as a self-extracting package which installs seamlessly on any Windows Server 2008 R2 operating system (RTM or SP1). Once installed it appears under Administrative Tools.

    clip_image002

    clip_image004Before we create our iSCSI Target we will create two VHD files: One as our Witness Disk and one for Shared Storage. Right-click on Devices and click Create Virtual Disk.

    In the Create Virtual Disk Wizard type the full name (including directory structure) of the VHD file you want to create. The Witness Disk does not have to be very big (8GB is my norm), but the Shared Storage Disk should be as large as you would need it to be… depending on what you will be storing it might need to be quite large.

    1. In the Welcome screen click Next.

    2. In the File screen type the name and location of the VHD file you want to create (c:\disks\Witness.vhd) and click Next.

    3. In the Size screen enter the size of the VHD in megabytes (for the Witness disk enter 8192) and click Next.

    4. In the Description screen enter a description (Witness Disk) and click Next.

    5. On the Access screen click leave the fields blank and click Next. We will configure this once we create our Target.

    6. On the Completing the Create Virtual Disk Wizard screen click Finish.

    clip_image006Make sure to repeat these steps for the Shared Storage disk, changing only the file name, description, and size appropriately.

    For each VHD two files will be created – the Virtual Hard Disk file which will be Fixed Disks, and a Microsoft iSCSI Software Target Change Tracking Bitmap file, which is a .cbm file that Microsoft uses for integrity checking.

    Now that our storage is allocated we will create our iSCSI Target. To begin we will right-click on iSCSI Targets in the navigation pane and click Create iSCSI Target.

    1. In the Welcome screen click Next.

    2. In the iSCSI Target Identification screen enter the name of your iSCSI target. This will be the name of your Logical Unit Number (LUN). You can also optionally enter a description. Click Next.

    NOTE: Although not a requirement, it is a best practice to exclude punctuation, especially periods and dashes, as they are used in the iSCSI Qualified Name (IQN) that will be created by both the target and initiator.

    3. In the iSCSI Initiators Identifiers screen we will select the Windows machines that will be able to access the iSCSI target. Click on Advanced… to enter the DNS domain name, IP address, MAC address, or multiple pre-determined IQNs. In most cases the iSCSI Initiators of your devices will not have been enabled yet, but by entering their IP address you can save extra steps later.

    clip_image008There are two components of an iSCSI SAN – the target, which is the LUN on the actual SAN device, and the initiator, which is the computer that will be accessing it. Because SANs are commonly used with clusters, it is possible to have several initiators configured to access a single target. However if the target is not configured for the initiator, it will be invisible to that system when it tries to access it.

    4. Click Next on the iSCSI Initiators Identifiers screen, then click Finish on the Completing the Create iSCSI Target Wizard screen.

    clip_image010At this point your iSCSI target has been created. We can look at the properties by right-clicking on the iSCSI Target we created and click Properties.

    The LUN properties box should have five tabs: General, iSCSI Initiators, Authentication, Virtual Disks, and Advanced.

    Under the General tab you will see (for the first time?) your IQN. In the example created for this article it is iqn.1991-05.com.microsoft:ski-storage-lun1-target. This convention may appear long and convoluted, but it can be broken down into two parts… the device manufacturer and the actual target.

    Because we are using the iSCSI Software Target, the manufacturer is Microsoft, and because their domain name (microsoft.com) was registered in May of 1991 the first part of our iqn is 1991-05.com.microsoft. (If you had an EMC device, you would have an IQN of iqn.1997-07.com.emcJ

    The first part of the IQN is separated from the second part by a colon. The actual target (LUN1) is on a server called Ski-Storage, hence ski-storage-lun1-target.

    Under the iSCSI Initiators tab you can see, add, edit, and remove initiators. This will be important if you plan to add new initiators to a cluster, for example.

    Under the Authentication tab you can set CHAP (Control Host Authentication Protocol). This is the only method of authentication supported by iSCSI.

    Under the Virtual Disks tab we will add our pre-created VHDs.

    1) Click Add…

    2) Select both disks and click OK.

    3) In the LUN Properties screen click OK.

    At this point our LUN is created and populated, and ready to go! Now it is a simple matter of pointing our initiators to the device.

    In Windows Server, click Start – Administrator Tools – iSCSI Initiator to launch the iSCSI Initiator. If this is the first time you are running it on your server you will be warned that in order to run the Initiator, the Microsoft iSCSI Initiator Service must be running, and that Windows will configure it to auto-start.

    In the iSCSI Initiators Properties box there are six tabs: Targets, Discovery, Favorite Targets, Volumes and Devices, RADIUS, and Configuration.

    clip_image012In the Targets tab type the IP address of the server on which you configured your software target, and click Quick-Connect… In the event of a successful connection a Quick Connect window will appear with the IQN of your iSCSI target and the status Connected in the Status column. Click Done to close the Quick Connect window.

    The IQN of your target will now appear in the Discovered Targets list on the Targets tab.

    Click on the Volumes and Devices tab of the iSCSI Initiator Properties window. The Volume List should be blank. Click Auto Configure to automatically configure all of the devices on the discovered target. Two devices should appear.

    clip_image014

    The rest of what we are doing should be pretty familiar to you.

    1) Open Server Manager.

    2) Navigate to Disk Management.

    There should be two new disks attached to your server.

    3) Right-click the 8.00 GB disk and click on-line. Right-click the 64.00 GB disk and click on-line.

    4) Right-click the 8.00 GB disk and click Initialize. The Initialize Disk screen should appear, allowing you to select both disks to be initialized. Click OK.

    5) Create a Simple Volume on each disk.

    a. On the 8.00 GB disk right-click on the unallocated space and click Create Simple Volume.

    b. In the New Simple Volume Wizard click Next.

    c. In the Specify Volume Size screen click Next.

    d. In the Assign Drive Letter or Path screen select Q and click Next.

    e. In the Format Partition screen change the Volume Label to Witness Disk and click Next.

    f. On the Completing the New Simple Volume Wizard screen click Finish.

    Repeat the same steps for the 64.00 GB disk, replacing the drive letter with M and the label to Shared Storage.

    At this point your LUN is created, formatted, and ready for data!

    In the next article we will use this LUN to create a cluster, and configure that cluster to make a Hyper-V Virtual Machine Highly Available.

     

     

    Mitch Garvis, MCT | Senior IT Consultant & Trainer | SWMI Consulting
    My blog | Twitter | Facebook | LinkedIn | MVP Profile

    I'm a PC

  • Scripter? Like Automation? Powershell Scripting Games are for YOU!

    clip_image002

    “…Sweat pours from your brow, your muscles tighten as you hammer away the Cmdlets into the Windows Powershell console.   A bead drips onto the keyboard revealing the smell of Ozone in the air. That last line poured out of your soul onto the page, and it felt so right.  One more task automated.  The systems bow down to the scripter…”

    Is this you?  Are you an ITPro with that rare untouched gift?  Automation?  Scripting?

    How about a chance to put those skills to the test and an opportunity to Script real world scenarios to test your mettle, improving your skills at the same time!  A rare chance to pit yourself against the best and build upon yourself at the same time!

    The 2011 Scripting Games are for Novices and Enthusiasts to with an opportunity for Fame and Prizes as well as EXPERIENCE in scripting against REAL Scenarios!

    THAT is what the 2011 Scripting Games are offering for FREE and they’re coming your way.  

    The Excitement starts April 4th 2011 and continues on through to April 15th 2011.   TEN (10) Events with both options for Beginners and Scripting Guru alike to pit their skills in Windows Powershell, it’s a rare chance to improve while improvising and have your code reviewed by a panel of judges comprised of Windows Powershell Celebrities and Experts!

    How can you lose? 

    You CAN’T!  Not only will your name possibly be in lights, but this is a chance to get critique on your scripting by Internationally recognized Windows Powershell experts and MVP’s as well as Daily Chances at Prizes!

    So why not give it a shot?  This could be YOUR chance to shine!  Why not take the chance?  You have nothing to lose and EVERYTHING to gain!

    The 2011 Scripting Games are no small event either.  Last year THOUSANDS of Scripts were launched and submitted from HUNDREDS of countries across the planet from people JUST LIKE YOU!   Which has got to be the coolest part.  Competing with people just like yourself!  

    So a chance to Grow and LEARN for FREE? Have Powershell Masters review your scripts?  Really? FREE?

    YES!  Spectators and Competitors pour on in to the Scripting Games and benefit each and every year benefiting from the camaraderie as well as the INTENSE competition!

    Interested?

    You too can participate!  Don’t fear on whether you’re a specialist or an enthusiast.  The 2011 Scripting Games are for everybody! It’s all about learning Powershell and having some fun at the same time…. And perhaps a chance to rub your friend’s nose in it if you one up them! clip_image002

    Need more information? Head directly here for all the information you’ll ever need or watch POSHCODE and “Hey Scripting Guy” for more details!

    Curious what the games were like?  Information from the Scripting Games from 2010 and Scripting Games from 2009 are still online for you to review! 

    Except one difference.  The future is here with 100% Fresh Pure poured Windows Powershell!

    So what are you waiting for?

    The 2011 Scripting Games are calling you!  STEP up and seize the day! 

    It’s yours to have O Mighty Scripter!

    -------------

    Note From Rick: Who better then our friend Sean Kearney, Powershell MVP to write up a blog post about The Scripting games, eh? Thanks Sean!

More Posts Next page »

This Blog

Syndication

Powered by Community Server, by Telligent Systems