Uncategorized

VMworld Labs: Hands-On

First off, Happy VMworld everyone! It’s finally here, so let the socialization, learning and exhaustion begin.

I had a bit of free time this morning so I decided to do a lab. I didn’t arrive early enough to get in on the preview like some others, however even after seeing their posts about it the labs floor is quite impressive. From the seats arranged so that everyone can see the projectors, to the apparent “control center” in the middle, it’s an impressive setup.

I chose lab 20…logging in was painless and provisioning of the virtual machines was extremely quick. Access was also very good, initially anyway…more on that in a bit. Progress through the lab was quick, directions were good, screen shots were accurate and quickly identified the key fields that needed to have data entry done.

Overall, I really enjoyed the lab. In the last couple of years I haven’t done very many of them simply because most of the inability to get in. This year I had zero wait, and there were a few free seats around me. The dual monitor thin clients work well and PCoIP is amazing…

On that not so subtle transition, apparently the section I was in was running off the DC cloud. For the first 75% of the lab, I couldn’t tell…in fact, if the WAN (I assume it was the WAN) hadn’t of had some issues, I would have never known. Even when things started to go south and I could tell that latency was through the roof, the session was still usable, slow, but usable. At one point the client lost connectivity, however it quickly regained and started the session exactly where I left off.

I’m incredibly impressed with the labs…it’s my first real work done on a thin client, over PCoIP using a “cloud” infrastructure. If the provisioning of virtual machines works in the private cloud like it did for me today on VMware’s lab cloud, then we have a lot to look forward to in the future!

Outstanding work as always Labs Team, thank you!

Uncategorized

Comments (0)

Permalink

PowerCLI: Speed boost, Find VM Snapshots by Name.

I use NetApp SnapManager for Virtual Infrastructure(SMVI) to back up 95% of my environment. SMVI isn’t perfect, and it’s kinda a pain, but it gives me the ability to back up 100-250 vm’s in less than 10min! Well the actual NetApp snapshot takes seconds. The rest of the time is spent waiting on ESX snapshots. The only real downside here is from time to time SMVI will fail to delete the ESX snapshots. I have been using PowerCLI to find and delete these snapshot, but the cmdlets are just too slow, for what I’m trying to do. I’ll post my Finalized SMVI cleanup script later. Until then, I give you finding snapshots really fast!

Continue Reading »

NetApp
PowerCLI
Powershell
Scripting
Uncategorized
VMware

Comments (4)

Permalink

Dearth: an inadequate supply; scarcity; lack.

I suppose that’s how you could describe the amount of posting that we’ve been doing around here the last couple of weeks. You’ll have to forgive us…work’s been crazy, to put it mildly…but things should get much more calm very soon.

Since today’s a “lazy Sunday”, I decided to go back and update the perl script that changes vSwitch security policies to use a better, more intelligent, method to update the spec for the switch(es). This shortened the script by about 20 lines and simplified the code significantly.

Hopefully soon I’ll be posting some information about doing kickstarts, to include setting up a PXE server using CentOS/RHEL, kickstarting using NFS, and kickstarting using a custom ESX iso. I’m also working on how to configure a host (networking, storage, ntp, users, vMotion, add to vCenter etc.) using rCLI/SDK scripts.

Uncategorized

Comments (0)

Permalink

Converting a string to an array in PowerShell (why it works)

Blue_fish posted a question over on powershellcommunity.org. The source of the question was a mysterious blank entry. This anomaly appeared when he tried to convert a string into an array of individual words. Without his actual code on hand I tried to guess what could cause that. Along the way I typed up the following… thinking out loud with my fingers. Afterwards I realized that this was the kind of information I was looking for when I started out. With that in mind enjoy…

Convert ” abcd efg hi j ” into an array…

(” abcd efg hi j “).split(” “) #done… now remove the blank entries…

(” abcd efg hi j “).split(” “) | where-object {$_ -ne ” “}

 

Why did that work?  Powershells access to the .net framework doesn’t require one to be a .net dev.  Far from it instead it brings an incredible amount of power to a usable surface. So how did .split() come to be and why does where work. I think I can explain it… let’s see…

In PowerShell “” refers to a string, obviously, but it’s more than that.  A string in PowerShell is a .net object with a type of string,  99.99% of the time that doesn’t matter, but in this case it’s quite pertinent.  As a first class object string carries with it many powerful methods free of charge

Parenthesis () have several responsibilities within POSH, but mainly it’s just execution order i.e. (THIRD((FIRST)SECOND(FIRST))).  Part of that execution is PowerShell normalizing your data. For example 15 will be cast as an int, asdf as a string, and @(1,2,3,4,5) is an array or integers. As that cast is of objects, this is where all the free posh goodness comes from.  Therefore we need to enclose our string in () to perform that cast and have those methods available. 

Believe it or not that’s the hard part…

.split(” “) = splits our string into an array of strings using one whitespace as the delimiter.

And that’s how:

” abcd efg hI j “ 

Transforms into:
@”

abcd

efg



hI


j
“@

Now that you have an array of words all that is left is to remove the false positives.  Enter Where-Object, think of where-object (aka where, and ?) as an extremely streamlined if then else filter.  {} in PowerShell represent a script block. 

A script block is a chunk of code that is executed to its completion before the engine moves on.  In other words {} will overrule ().  where-object is a bool operator, if the script block evaluates to true then pass the object down the pipeline, else drop the object. 

Before where {}

[0] ” ” = False
[1] “abcd” = True
[2] ” “     = False
[3] “efg” = True
[4] ” “     = False
[5] ” “     = False
[6] ” “     = False
[7] “hi”     = True
[8] ” “     = False
[9] ” “     = False
[10] “j”     = True

After where {}

[0] “abcd”
[2] “efg”
[3] “hi”
[4] “j”

*Only objects that evaluate to $TRUE in the where-object script block are passed down the pipeline. As you can see their really aren’t any “smoke and mirrors” in PowerShell. Instead the team provided a kick ass engine that does 90% of the work for us in a predictable and comprehendible fashion!

~Glenn

I started to post all of this in my response to blue_fish’s post over on powershellcommunity.org, but it occurred to me that I went way to in depth.  Sometimes I like to talk myself through the nth degree to prove I know it ;)

Don’t be shy if I screwed something up please let me know.  That’s the other part of laying it out to the nth degree if I’m mistaken, you’ll correct me, and we all improve from that exercise!

Powershell
Uncategorized

Comments (0)

Permalink

Using –SupportsShouldProcess in Powershell V2 ScriptCmdlets

Okay so I’m a bit of an early adopter. My main admin rig at work has been running V2 for the past year. In the last six months I’ve fallen in love with scriptcmdlets. One thing that constantly reminded me that this was still a CTP, and not a shipped product was –SupportsShouldProcess. The included about docs are misleading at best. The hidden user guide in %windir%\System32\WindowsPowerShell\v1.0\en-US had nothing, and perhaps the biggest shock of all. There was nothing on the web. The only thing I could find was this PDF from a Server 2k8 launch event. I started to think I was the only one who wanted this functionality. Well all I needed was handed to me on a golden platter this morning when Mr. Snover posted this. At last, a working example!

To keep this as easy as possible take the following V1 function:

Now let make it a V2 scriptCmdlet:

Finally let’s give this little guy some kick!

Why should you care? Well simple I added three lines of code and one parameter. Look at all the functionality the PowerShell Team provided me with that small amount of code!

There you have it script cmdlets ShouldProcess support. Hope that helps anyone who’s been trying to figure that out.

~Glenn

Powershell
Scripting
Uncategorized

Comments (0)

Permalink

PowerShell Usability: Cmdlet design

So I basically haven’t slept in two weeks. I thought it would be a good idea to pick up the torch, and contribute on the NetApp Ontap SDK to PowerShell. I’m sure you’ve seen the Codeplex project by now if not here. I have a couple of personal issues with this first swing, and initially I set out to help. Two weeks later I have completely rewrote the whole cha-bang. I’m not a dev, and I don’t pretend to know as much as Adam. I am however an Administrator who uses PowerShell and NetApp’s every day. From that perspective I’m writing what I need the cmdlets to do. Very quickly I ran into a style issue… My question to the mob is simple of the three examples below, what would be your preference?

[1]PS > Get-NaDisk –disk v0.20| Fail-NaDisk –force

[2]PS > (Get-NaDisk –disk v0.20).FailDisk()

[3]PS > Get-NaDisk –disk v0.20 | set-NaDisk –Fail -confirm:$false

What do you think? One is the most intuitive, but will lead to over 500 cmdlets! Option two is the least intuitive, but would produce the tightest code. Finally option 3 per the PowerShell team documentation option 3 is the “correct way of doing it”…  I wan’t to use option 1 but It requires the use of an illegal unaproved verb “Fail”.

Help…

~Glenn

UPDATE: My basis for not using Fail-NaDisk. Although, I believe that Fail-NaDisk is more in line with the spirit of powershell.

NetApp
Powershell
Uncategorized

Comments (2)

Permalink

BRAVO COMCASTIC!

As you all know comcast is at it again… This will not be popular, but i’m okay with the announcement they made today!

IMO this is the first step towards making the Internet an utility.  Think about it everything else you pay via a rated line.  Your heaviest customers pay the lion share of the bill.  if your just sipping the Internet one email at a time, your bill could be negligible.

The whole concept of paying for speed is ridiculous.  It cost comcast the same $ amount to run there network regardless of the load… right up until the network is saturated, and at the point Everyone suffers.  The backbone doesn’t know nor care that your paying for “Premium”.  All it knows is there are more incoming packets then it is capable of transmitting, and it’s buffer is full.

Therefor take that next step how can you control cost. If there is no method to more evenly distribute the load.  This is not new, if everyone in America picked up there phone right… NOW… only half of us would get a dial tone.  The difference is when it comes to your phone.  You still have the right to talk till your blue in the face, but it’ll cost ya.  Use the network as much as you like… Go ahead fill up that 4TB’s of internal storage, but it’s going to cost ya!

didn’t mean to carry on like that… but I see this as a potentially good thing…. Then again it is comcast and they do have a track record of screwing over there customers

Uncategorized

Comments (1)

Permalink

Punctuality is Important

Time keeping is especially important for Active Directory and Kerberos. I encountered an error when I was attempting to ssh into one of my AD enabled ESX hosts. The SSH error was “Permission Denied”, however after inspecting the logs (/var/log/messages) I discovered that pam_krb5 was throwing “Clock skew too great” errors.

This was odd to me, as I know every one of the ESX servers has NTP configured. Apparently ntpd died at some point, which caused the clock to begin losing time. Once the time difference between the domain controller and the ESX host exceeded 300 seconds (5 minutes), ESX no longer allowed me to login using AD credentials.

The fix was somewhat easy…reset the clock. Since I was able to login to the console, I did so as root, and executed ntpdate name.of.domain.controller, which forced it to sync the clock with the DC. After that was taken care of (which confirmed that it was ntp that broke), I went back to Virtual Infrastructure Client and reset the NTP settings for the host (it’s on the Configuration tab).

ESX
Uncategorized

Comments (0)

Permalink

Powershell Quote of the day!

There I was hanging out on the #powershell irc channel when sepeck said the following.

PowerShell is just fun to use, something vbScript never was

There is nothing I can add to that…

~Glenn

Powershell
Uncategorized

Comments (0)

Permalink

Podcast Junky

Hi, my name is Glenn and I am a Podcast junky.  My addiction reached the point that my wife gave me an IPOD Shuffle specifically for my podcast’s.  I consume between 15 – 20 hours of content a week!  Sounds like a lot I know, but here’s my secret…

I have kids whom I love dearly, but the little buggers took all my study time.  About a year ago I found a couple of techcast and started subscribing… I listen to them whenever I’m in my car, or doing chores around the house.  That my friend is how I stay up to date.  Today I got the latest scoop on ThinApp while I did the dishes.  If you haven’t discovered these little gems check them out who knows you might learn something.

Some of my current subscriptions: 
http://www.cstechcast.com/
http://www.mindofroot.com/
http://powerscripting.net
http://www.runasradio.com/
http://www.grc.com/securitynow.htm

And this little gem I just found TODAY!
http://blogs.vmware.com/vmtn/podcasts/index.html

~Glenn

Uncategorized

Comments (0)

Permalink