July 2010 Archives

I’m both impressed AND disgusted at the key manufacturers of Photocopiers in the present day world.

Why?

They’ve come up with a great technique (All of them for the most part) called “Cloning” which is a fancy word to “Backup the Photocopier Config and Restore it somewhere else”

That’s great.  I’ve successfully gotten it to work to.

Now where I am disgusted is not ONE of them has pulled their HEADS OUT OF THE GROUND and looked about to realize that MANY of these units are in an ENTERPRISE class environment.

What does that mean to Administrators?

It means they give you a stupid web interface that’s not designed to link into any system directly to allow importing of data into their internal Accounting systems.   I know for a fact of one key manufacturer that has their entire system based upon .NET but has no clue about Powershell (EASY ENTERPRISE INTERFACE!)

So rather than being Smart, and say spending a few minutes setting up a system that could be managed by an Administrator via script, they build a big glorified overkill Web interface without the LEAST little thought that these systems might need to be managed not only REMOTELY but EFFICIENTLY.

Note I didn’t mention any names, but all the big guys are to blame.

Get a clue. 

Administrators of these devices HATE wasting time (mostly our time) and prefer consistency.  Invest a little R&D into Powershell, VBscript to link into your system.  Whoever does it first will be causing their competition to cry pools of tears.

One of the more inspiring talks I have seen.   Bill Gates on making that dramatic needed change to bring the climate under control.

Take special note of the fact that Nuclear Power Plants could now be built to use the WASTE fuel as Energy and burning more slowly producing MORE energy.

This is something, today, that should be implemented regardless of the cost.

But it is inspirational to realize we all have one common problem and that WE the people who live on this planet, WE can solve it.

…we will… somehow… for our children and our children’s children

This is not a joke.  I aught a tweet from @miguelcarrasco this morning about a “Headset that reads Brainwaves” and clicked on it.

What I encountered was an amazing NON THEORETICAL talk on “TED”.  A company called Emotiv has developed a device that costs $299 per unit that does actually map out brain wave functions.

This is not “Read your thoughts and steal your mind” but something far more practical.   Utilizing your brain to interface directly with the computer (or electronics).  They showed some interesting game applications, Smarthome ideas but the one that floored me was using it to control a Wheelchair.

Stop right now.   A device to allow somebody to control a wheel chair with their mind.   So you’re paralized and have minimal use of your body, perhaps movement in your arms or legs is incredibly painful.

Control from your mind.

Here’s the Video from TED – and yes you can buy them now

I had a friend look at me and say “No it doesn’t work”

Seemed to be a reasonable statement.  Windows XP Mode normally requires Hardware Acceleration to be available… or at least it did!

You see a while back Microsoft removed the need run Windows XP Mode only on machines with this ability.

So I can (and have) run Windows XP mode on a Pentium 4 Mobile chip (1.6).  To make it work you just download the THIRD option for Windows XP Mode.  This update disables the requirement for Hardware Acceleration.

image

So why not on a Virtual Machine in Hyper-V?

……Come to think of it WHY would I do this in the first place?

One word,  demo environment.   There are situations where I’ll need to present and show Windows XP mode and various setups from a Virtual machine.   A file that won’t care about the hardware base.

True, Windows XP Mode will run slower on a non Accelerated machine, but it will work.

So in my Virtual Windows 7 computer in Hyper-v, I ran the three updates to enable Windows XP mode.  The Virtual machine was a 32 bit Windows 7 child in Hyper-V.

Guess what?  It’s running Windows XP Mode (A Virtual Machine) in a Child in Hyper-V (Another Virtual Machine).  I could get stupid geeky and install Virtual PC inside of THAT machine, but well no.  

I don’t think so (Except to maybe demonstrate an application that won’t install in Windows 7 but will in Windows XP)

The only real drawback I have seen is you have to run Windows XP Mode in Full screen to get a resolution beyond 640x480.

But then again, it’s meant to run applications and you normally don’t access the Windows XP Desktop except to add applications to Windows XP mode.

But there you have it.  For the truly nerdy.  You CAN have Windows XP Mode in a Virtual Machine.

That is, if you have to ;)

Sean
The Energized Tech

Here’s one for you.  If you have a “Cisco IP Phone” that says “Ethernet Disconnected” don’t worry.

It’s just a wiring problem.   Don’t be stumped and confused thinking “But the phone is on via POE so the wire SHOULD be good”

No.  That just means the “P” (Power) in the POE is good.  Those wires ARE connected.

It’s the other 4 (You know, Orange pair and Green pair?  Transmit / Receive) one or more of those is bad.   Even swapped (Cross your fingers that isn’t the case!)

Just plug on your test equipment and verify all the cables are correct and wiring tapped off right.

Here’s one more to be on the watch for.  Sometimes (But very rarely) a cheap patch panel is wired incorrectly on the inside.

Not common but I’ve seen it.  Was banging my head against a LAN for 15 minutes and reterminated THREE times until I stopped and realized one of the ends was wired wrong.

Hard to do, but it happens.    Just swap out the end with a good end (the wall) but if you’re stuck? Although it’s not up to 568a or 568b, physically swap the wires to make it work and log/note that jack is not wired quite right.

Surprisingly however, it may actually hit Gigabit and work ok (Depending on Distance to Demark)

Don’t worry about the weird stuff, sometimes just accept it and chuckle on

Sean
The Energized Tech

`Powershell

Hanging out with good friends, a Tweetup with @cbrooker , listening to CCR.  A great night with friends (who were former Competition!)

Life is good

Sung to CCR and “Unfortunate Son”

Sing Loud.

Sing Proud.

And sing it to no matter what you work with.

Powershell – My Fortunate One

Some folks are born to use Python code
Some like to use the Bourne shell too
And when they unleash, the script on the LAN
They launch and scream out Woo woo woo

Powershell Powershell
It calls and screams out to you you you
Powershell Powershell
Dot Net empowered I'm unglued glued glued

Some folks they use old batch files
They work with vbscript to automate the new New NEW
They Encode and they type it away
Launchin' it free to you You YOU

Powershell Powershell
It calls and screams out to you you you
Powershell Powershell
Dot Net empowered I'm unglued glued glued

Some folks they type, and use the GUI
I work in a box that is Blue blue blue
Typin' away in CmdLets you see
in a Power so True True TRUE

Powershell Powershell
It calls and screams out to you you you
Powershell Powershell
Dot Net empowered I'm unglued glued glued

Powershell Powershell
It calls and screams out to you you you
Powershell Powershell
Dot Net empowered I'm unglued glued glued

I would use “The Case of the UnExplained” but I think somebody who’s name holds more lofty and far more earned credentials than I uses that.

So let’s just call this “Puzzles in the Wild” or “Shared Confusion” or “Oh I was banging my head against the wall for THAT?!”

But I’ll CC: this “Guy” at Microsoft and see if he found it interesting.

Here was my problem

Cisco VPN client.  Yes I’ll name it because others might be encountering this (or maybe not, maybe I lost my mind again)

I have found lately that installing the Cisco VPN client onto Windows 7 or Vista on FAST machines is really freaking slow painful mind numbingly “bite my foot off now and make Dance the Macarena” install.

Yes that bad.

It’s not a big install.  But for some stupid reason, it just takes FOREVER.  My last install?  Are you ready? (*wait for this and a drum roll*)

TWENTY FOUR HOURS (24) < ------ SEEEEEEEE THAT NUMBER?!

24! and it DIDN’T INSTALL!

I checked online and even found a reference to Manually installing the “Deterministic Networks” component from Citrix that Cisco uses.  I did that fix.  NOPE.  That didn’t work. So Next step.

I uttered some “special Magic Words” and “Incantations” which I’m certain will ruin my Karma down the road.

Yes, obviously I’m pretty patient.  At this point I pulled out ProcessExplorer.exe and ProcessMonitor.exe and few magic beads I found in New Orleans and that “Intel Bunny Guy” I got at BestByte.

I looked and for some stupid reason it was trying to talk to a DC and until it got the response it desired…… Well it was saying “duuuuuuuuhhhhhh!!!!!”"

Oh.  I see.  So what happens if unplug the LAN and disable the WIFI ( no, no, no the WIFE! ) and see what it does.

10 seconds later …. *Voooooom!* done

Yes I uttered a magic word after that.  But it was working, so the “Magic Word” gets no credit here.   Persistence, Creativity and Sysinternals DO.

I’ll figure out the “WHY” later on BUT

A) the Problem is solvable
B) Sysinternals should get an award for saving so many Administrators from Killing Developers
C) I Hate “Murphy’s Law

Cheers and don’t stress, It hits all of us everyday of the week.  We’re in this boat together!

Sean
The Energized Tech

I was playing.  I’ll completely admit to that.

I had the Dual boot between Windows 7 and Server 2008R2 running beautifully.  Then I did a dumb thing.

I decided to clean things up.

“All my Data is on D” is what my mind said “All my Data is on D”

Then I started deleting and moving old stuff, cleaning up stuff that was garbage.  I was careful, I was meticulous…

I was mixing up my drive letters.

So I inadvertently deleted my “Exchange 2007 Console” on my own laptop.  Yes.  I was an idiot. 

But normally NOT a problem to fix, whack out the entry in HKLM\Software\Microsoft\Windows\CurrentVersion\UNINSTALLS usually does the trick for most stuff based on the Windows installer.  Maybe a registry key or so and dropped in the disk

And it wouldn’t install.  In fact it failed BEFORE running the installer.  Examine the registry, purge every spot Exchange Management Console ever used.

Still the same result

“Error…Error…Error…” I felt like it was a bad Star Trek episode.

Until I deleted the Shortcut (The SHORTCUT of all things) to the Exchange Console.

Then the blinking thing installed.

Sometimes it really IS the dumbest things.

In this case one leftover shortcut and one EnergizedTech with his foot in his mouth

 

Remember, we all make dumb mistakes

Cheers
Sean
The Energized Tech

Powershell

Here’s a tool many of us hear about, but a few just starting into Powershell may not quite grasp what it’s for.

It’s called “PowerGui” from Quest Software.   Up until a month I didn’t even really use it, only because I completely missed out on what it is.

It is a GUI interface for Powershell.   A Management console with 98% of the functions you normally perform fabricated into a single GUI.   If you have the Exchange Snapins or Active Directory?  It will leverage them.

So why PowerGui?  For it’s built in Editor (That by itself is worth the reason to start)

It is a full GUI interface allowing you to Point and Click to build functions and scripts you might find you need to use.

But more importantly for those just STARTING into Powershell (as well as seasoned users), it provides actual Powershell code for whatever you just did. 

 

image 

 

It does it as simple as viewing the Properties for the module.

 

 

 

image

 

 

 

Revealing the Code contained within that produced that output

 

 

 

 

 

image

 

Or by simply clicking on the “Powershell” tab

 

 

image

 

 

 

 

You get a running log of all the Powershell code you have been generating for everything you have done.

 

 

 

 

 

It also contains the PowerGui script Editor which has features very similiar to the Visual Studio Intellisense which autoprompts and autocompletes CmdLets you are keying in.

Will it make you a Powershell Guru?  Will it teach you Powershell? 

Of course not.  But it will bridge that gap giving you the sample code you need that sometimes is not provided by third Party vendors or other Management consoles.

There is also PowerGui PRO which kicks things up a notch as well as “MobileShell” which is the coolest feature ever! It puts Powershell behind a Web interface so you can manage your Network from almost any web Enabled Device! (Except unfortunately Blackberry which the team at Quest is working on we hope for later release)

But don’t be like me, download and Try Powergui now at www.quest.com or powergui.org and See what I was missing all this time!

The Power of Shell is in YOU

Sean
The Energized Tech

Powershell

Here’s a quick but important one.

One of the advantages (or disadvantages if you’re the half cup empty type) is that the Active Directory Cmdlets (unlike their Quest counterparts) seem to pull down LESS information.

This is of course “poppycock”.   They both have the ability to pull the same information down (Active Directory doesn’t change between Cmdlets) but by DEFAULT for speed the Active Directory modules only pull down very key information.

But the rest is available to you with an easy command.

GET-ADUSER –identity ‘John.Smith’

Will give you the Information for ‘John.Smith’ but only a limited set.   The reason for this is you’re asking Active Directory for information.   The more info you pull (Especially non indexed) the slower the query is.

GET-ADUSER –identity ‘John.Smith’ –properties *

Will pull down ALL the properties for ‘John.Smith’, but it’s still not useful, you need names and Examples of the properties.

GET-ADUSER –identity ‘John.Smith’ –properties * | GET-MEMBER | FORMAT-LIST

Will display all those available properties and their examples on the screen.  But personally I like having a easy to view reference point.

GET-ADUSER –identity ‘John.Smith’ –properties * | GET-MEMBER | EXPORT-CSV C:\Powershell\ADSample.CSV

Will create a CSV file called “ADSample.CSV” which you can load into any Spreadsheet to view the content.   Here’s the easy part.   Top row is your NAMES of your PROPERTIES in Active Directory.   Bottom row is live data.   

Knowing what you can pull down is sometimes half the battle to knowing what you can change.

So once you know WHAT you want to pull out of Active Directory, the Command  is easy

GET-ADUSER –identity ‘John.Smith’ –Properties Property1, Property2

See?  Piece of Cake.  Your work is done.

Now that you’re done work without trying, sit back and enjoy some cold Iced Tea.  IT’s HOT today!

The Power of Shell is in YOU

Sean
The Energized Tech

Here’s a small but handy feature to know about.

I’ve had a few situations where I had to enable a network stack without a Physical live adapter running.

It’s not a common practice but some smaller business, doctor’s offices etc, still only run off one PC.  There are even some hosting scenarios where you need a network running “internally” but can’t tie it to a physical adapter.

Although Hyper-V resolves many of these issues, there are still environments where this is the case and you need what is known as a “loopback” adapter.

It is EXACTLY as it’s name implies.  It is a Network Adapter that  exists in the SOFTWARE world but not the Real World Neo.  You can assign it an IP address, Bind Hyper-V or any piece of software to it.   It’s especially handy on Coloated SBS servers where you can’t expose the “Real network” to the internet but need internal communication between your “Virtual networks” and servers.

Anyhow, here’s how ya create a Loopback adapter.

imageEnter the Device Manager, right click at the top of the
Machine name and choose “Add Legacy Hardware”

 

 

 

 

image

 

This would now bring up that old familiar
”Add New Hardware” Wizard we used to remember.

Click “Next” to continue on…

 

 

image

 


Select the next option as “Install the Hardware that I
manually select from a list (Advanced)”


Yes… click “Next” again…

 

 

image

 

 

Choose “Network Adapters” from the next list and
Well yes, click “Next” another time…

 

 

image

 

 

Under “Manufacturer” choose “Microsoft”, then under the
provided “Network Adapter" list chose “Microsoft Loopback Adapter”

Oh yes, and do feel free to click “NEXT” yet one more time.

 

image

 

 

You’ll get a confirmation of what’s it going to add in,

….and yet one more “NEXT” which can happily click on

 

 

image

 

 

and now it’s installed! 

 

 

 

Going into your “Network and Sharing Center” and clicking on “Change adapter settings” will reveal an extra “Network Card” identified as the “Microsoft Loopback Adapter”

image

image

 

 

This adapter can be disabled or enabled like any other,can take an IP address and will be a valid stack.

Here’s a scenario where I use it daily.  When I run demos off of a laptop I cannot always be guaranteed Wifi or Physical access or even a working network.   So to ensure my environment CAN’T change (when I don’t require internet access) I bind my Virtual network to a loopback adapter which is ALWAYS there.

Gives me a greater chance for stability against he unknown.

Anyhow, another piece of Digital Hardware that’s free to add in to your Arsenal of ability

Sean
The Energized Tech

This is something for every single IT guy, Developer, future CIO or just “Geek on the Street”.

A pause of realization.   A chance to look up and say “That can be me.”

A article of mine went online this week at the “Hey Scripting Guy!” blog at Microsoft.  I thought this was cooler than singing Karaoke with Steve Ballmer.

Really.  I think that would be damned cool.  

Then I glanced at the names of other authors on the same series.   I just about sh*…..  Well I err….. I had to pause and well… I HAD TO PAUSE

William R. Stanek, John Ferringer, Andy Schneider and THE Ed Wilson.  My little posting sat amongst these greats.  Authors of literature.  POWERSHELL gurus who came before me and who *I* aspired to be like.   The Great Masters.  My little words sat with theirs.

*sigh*

This blog post is for every single person that ever thought “I’m not sure” or “I don’t compare to them” or the worst phrase of all “I’m not sure in myself”

Let me tell you know.  BE sure, YOU DO compare and I AM SURE in YOU!

Holding back on our dreams is a denial to ourselves and who we can be.   It is the ultimate Sin.  Don’t commit it.

Take the chance.

Seize the Day.

Believe in YOU and it will happen.

Sean
The Energized (and today very humbled) Tech

Powershell

Here’s an uncommon one for your day.  Ever have to set the “Processor Affinity” for an application?

First I heard the term my draw dropped.  More so because it came from our CoOp student who was a heavy online gamer.    He knew how to tweak and tune his PC like a Master.

Processor Affinity (to keep it simple, because that’s how I think) is the ability to delegate a SPECIFIC core to an application.

You see by default, if an application in Windows supports multiple cores, it will try to share and work with all of them.  Which is fine 80% of them.

The other 20% that application is a resource monster (Like a Virtualized Machine on a laptop) and you need to cap it’s power without killing it.   

Enter Processor Affinity.  On a Multi Core Server or Workstation I can allocate just ONE core (or more) to an application.   Usually it’ll be the case that I’m taking away cores.

Finding out the present Affinity of an application is very easy.  Just use GET-PROCESS

GET-PROCESS VirtualBox | Select-Object ProcessorAffinity

What this will do is show me the Affinity of my application VirtualBox (Sun Virtual Box) on my Windows 7 laptop.  But the number that comes back is well… vague.

I got a 15, which sounds a bit like Charlie Brown saying “I got a Rock”

The affinity is returned as the Decimal version of a binary number.  That’s all.  So depending on how many Cores you have will show you the default number.  IE:

Four Cores?

1111 in Binary or 15 in Decimal

Two Cores?

11 in Binary or 3 in Decimal

1111111111111111 in Binary means you have a really nice boss who’s letting you deal with a honking high End server :)

So if I need to restrict the ProcessorAffinity to a single core for an application we just need to set that Property on the application.  But since there is no “SET-PROCESS” cmdlet, I guess I’m up the creek without a paddle.

Or Am I?

It turns out the Property “ProcessorAffinity” has both a GET and a SET.  “SET” means I can change it.

So if I do a GET-PROCESS on Powershell and Store it results away in say, Oh $RESULTS

$RESULTS=GET-PROCESS Powershell

I can access the value of ProcessorAffinity by doing this

$RESULTS.ProcessorAffinity

Ready for the easy part?  I just assign the value TO $RESULTS.ProcessorAffinity and it’s done!

$RESULTS.ProcessorAffinity=1

Will assign only the first core to the Application in Question.  Remember it’s a Binary value you’re computing so to figure out the Binary number to use, you must add it in your head or draw it out

0001 = 1 ( CPU 1)

0010 = 2 ( CPU 2)

0100 = 4 ( CPU 3 )

1000 = 8 ( CPU 4 )

Therefore if I want to assign Core 1 and 4 to the Application, Add up the Binary numbers ( 1000 (8d) ) and ( 0001) (1d) ) to get 9

$RESULTS.ProcessorsAffinity=9

 

I concur this is not a COMMON need but if you needed to be able to script your Accounting application or more IMPORTANTLY control a system remotely and limit it’s action on the cores, So the production web server doesn’t get dragged down?

You can.  And all from Powershell.

 

The Power of Shell is in YOU

Sean
The Energized Tech

I saw the “Case of the Unexplained” at Teched 2010 in New Orleans.  I was more than informed, I was entertained.

In the back of my head I kept thinking “I run into this kind of stuff, I should document the next one”

Well I had one.  I real head scratcher.

My Brand New Windows 7 Enterprise x64 laptop install was running out of memory!

4 gb is more than enough for Windows 7 and I’d been running 64 bit Enterprise for the past while since the RTM was available.  Office 2010 Beta to boot.

Never did I encounter this problem, never did I run out of memory.  But sure enough, I was losing my mind as the laptop lost it’s memory.

So did I panic?  Nope.  Panic is not a solution.  (Plus I had my towel with me)

I Uninstalled a few “suspect” apps I was questioning but still, no solution.

So pulled out my handy key with Process Explorer from Sysinternals and looked.   After all SOMETHING had to be eating the ram.  My task manager showed 3.9 of the physical 4 gigs in use.   But under Task Manager no single application stuck out.

Even under Process Explorer all seemed quiet.  A glance at the new “Resource Monitor” option in the Task Manager in Windows 7 showed that ram was being eaten big time.

image

But by who?

image

I was watching away at the Commit.  With no applications really opened up, my Commit was already climbing past the 2 gigabyte marker and the laptop was quickly becoming unstable.

 

image

Adding some additional memory columns in Process Explorer yielded somebody truly misbehaving in Page Faults.   His name was BCMWLTRY.EXE .  Try as I might I couldn’t pull anything up on the process.   It wouldn’t even terminate or pause

 

image image

But being this was a recently installed laptop, I guessed at a driver.   Either a driver or I’d been hitting some strange websites on the Corporate laptop, I knew THAT wasn’t the case.

(No really, it wasn’t! I swear!)

Running Powershell as Adminitrator (yes you knew I had to) I ran a

GET-CHILDITEM C:\ –recurse –include BCM*.*

I found several references to BCMWL files in my temp and drivers folder including a LOG file from the install.  But I just couldn’t find the stupid .EXE file.

Reading the BCMWL.LOG file revealed it was probably part of the Dell Wireless Lan Driver set.  There were only 150 other files starting with BCMWL, so logically it was probably that.  Wondering.

BCMWLTRY? Perhaps “Broadcom WireLess Tray”

I couldn’t see it in the tray but perhaps a badly released driver from the manufacturer?

No? That Never happens?

Enter Programs and Features, Uninstall the Present Dell Wireless Lan driver suite.

One reboot later and I’m happy to say my memory problems in my laptop are gone By manually adding only the DRIVER file for the Wireless (vs. the entire piggy suite) life returned to normality (Or as close to that as it ever gets for a Tech)

Now to back to enjoying the good life, and playing with a honking big Dell server.

Sometimes the greatest issue is caused by the smallest thing.

Sean
The Energized Tech

I saw the “Case of the Unexplained” at Teched 2010 in New Orleans.  I was more than informed, I was entertained.

In the back of my head I kept thinking “I run into this kind of stuff, I should document the next one”

Well I had one.  I real head scratcher.

My Brand New Windows 7 Enterprise x64 laptop install was running out of memory!

4 gb is more than enough for Windows 7 and I’d been running 64 bit Enterprise for the past while since the RTM was available.  Office 2010 Beta to boot.

Never did I encounter this problem, never did I run out of memory.  But sure enough, I was losing my mind as the laptop lost it’s memory.

So did I panic?  Nope.  Panic is not a solution.  (Plus I had my towel with me)

I Uninstalled a few “suspect” apps I was questioning but still, no solution.

So pulled out my handy key with Process Explorer from Sysinternals and looked.   After all SOMETHING had to be eating the ram.  My task manager showed 3.9 of the physical 4 gigs in use.   But under Task Manager no single application stuck out.

Even under Process Explorer all seemed quiet.  A glance at the new “Resource Monitor” option in the Task Manager in Windows 7 showed that ram was being eaten big time.

image

But by who?

image

I was watching away at the Commit.  With no applications really opened up, my Commit was already climbing past the 2 gigabyte marker and the laptop was quickly becoming unstable.

 

image

Adding some additional memory columns in Process Explorer yielded somebody truly misbehaving in Page Faults.   His name was BCMWLTRY.EXE .  Try as I might I couldn’t pull anything up on the process.   It wouldn’t even terminate or pause

 

image image

But being this was a recently installed laptop, I guessed at a driver.   Either a driver or I’d been hitting some strange websites on the Corporate laptop, I knew THAT wasn’t the case.

(No really, it wasn’t! I swear!)

Running Powershell as Adminitrator (yes you knew I had to) I ran a

GET-CHILDITEM C:\ –recurse –include BCM*.*

I found several references to BCMWL files in my temp and drivers folder including a LOG file from the install.  But I just couldn’t find the stupid .EXE file.

Reading the BCMWL.LOG file revealed it was probably part of the Dell Wireless Lan Driver set.  There were only 150 other files starting with BCMWL, so logically it was probably that.  Wondering.

BCMWLTRY? Perhaps “Broadcom WireLess Tray”

I couldn’t see it in the tray but perhaps a badly released driver from the manufacturer?

No? That Never happens?

Enter Programs and Features, Uninstall the Present Dell Wireless Lan driver suite.

One reboot later and I’m happy to say my memory problems in my laptop are gone By manually adding only the DRIVER file for the Wireless (vs. the entire piggy suite) life returned to normality (Or as close to that as it ever gets for a Tech)

Now to back to enjoying the good life, and playing with a honking big Dell server.

Sometimes the greatest issue is caused by the smallest thing.

Sean
The Energized Tech

If you’re looking into a low cost method of deploying software in Windows and migrating to Windows 7 in particular?

Look no further.

The Microsoft Deployment Toolkit 2010 Update 1 is HUGE change for ONE key reason

A clean install of the operating system and applications, no loss of data WITHOUT the need for an external backup source of any type.

*** WHAT?! ***

Yes the first time I heard it, I  DOUBTED it.   In fact my first time doing an upgrade of a Corporate laptop to Windows 7 Enterprise, I did a backup JUST BECAUSE!

But it’s not needed.

You see you can create a Deployment image that does a “REFRESH” of the hardware.  Using a really simple yet amazing technique, the data is marked so it can’t be erased by a format.

I did a full wipe of a laptop with MDT 2010, Clean install of the operating system, The entire Office 2010 suite (Yes every last bit) and all needed applications including some addons for the internet.

Time?  Fourty Minutes.

Keep in mind.  This is a mostly automated install (LTI) of Windows 7, Applications, blanked out drive for the O/S, ALL DATA PROTECTED AND RETAINED.

A proper and RECOMMENDED and backed by the manufacturer install.  MY actual time involved for the install for about 2 minutes to click the mouse.

The beautiful part is this Image can be deployed to ANY piece of hardware in our environment.   It could also carry onto a brand new site by just changing the product keys in an XML file.

The cost of this software is Zero.

That’s right NOTHING.

It’s cost’s NOTHING and give’s you everything you would ever want.  

It’s yours for the download right now.  MDT 2010 Update 1.   As perfect for Small Business and it is for the Enterprise.

Sean
The Energized Tech

Powershell

First off, I didn’t figure this out.  Somebody told me.  But this is priceless.

Do you know how EASY it is to make a module in Powershell?

In your “Documents\Windows Powershell\” Folder there is most likely a folder called “Modules”

image

Go into that folder, make another folder and call it something useful like “FruityJello”.

At this point, I fully recognize that NO ITPRO worth his SALT would seriously make an important module for his office called “FruityJello” but I’m just having a bit of a blank spot for some good “Names for Folders” today.

So within our “FruityJello” folder were going to place a text file in it and call it (Wait….. pause…. ACTION!) FruityJello.PSM1

So now you have the BASE of a module.  It won’t actually do a thing.  It’s empty.  But it is the Base of “Script Module”.   So what do you put in there?

Well pretty much everything from your Profile in the way of Functions can sit in here for a start.

Let’s “ASSume” you have a blank $Profile and just want to Try something in a module and all you have are scripts.   There’s really VERY little difference between a script and a Function in Powershell 2.0.   I’ll show you a simple script.  Really simple.   Just so you can see the pieces that change.

-------------------- DUMBSCRIPT.PS1 -------------------

$ARGS[0]
WRITE-HOST $ARGS [0]
$ARGS[0] | Get-Member
WRITE-HOST "Wasn't That IMPRESSIVE?!"

-------------------- DUMBSCRIPT.PS1 -------------------

So as you can guess, you call up this script and tack on a bunch of arguments and all this does is echo them off and do something completely unimpressive

Now this script as a function?  WATCH

---------------- DUMBER Function ------------------

Function Global:Write-Silly( $AnArgument ){
     $AnArgument
     WRITE-HOST $ArArgument
     $AnArgument | Get-Member
     WRITE-HOST "Wasn't That IMPRESSIVE?!"

}

---------------- DUMBER Function ------------------

So now we have a function identical to the script called “WRITE-SILLY”.  All we had to do was prepend the original Script Block with a

Function Global:NameOfFunction( $parametera $parameterb $parameterc ) {

Swap out the variables for wherever there are (Or are not) needed in the original script block and top it off with a Parentheses on the end

--- > } < ---

So now that you have a function in your hands, paste that code into the “FruityJello.PSM1” file (Use Notepad or whatever you’re most comfortable with) and save the file

Now fire up Powershell and execute

IMPORT-MODULE FruityJello

You’ll get very little (actually no fanfare) but when you key in WRITE- and start tapping away on tab you’ll soon see your new function (Badly written too!) called WRITE-SILLY filling out with the AutoComplete.  

image

It even works like other Commandlets including when you execute “HELP” against it

image

If you check earlier an Earlier Blog post about “Comment Based Help” you can actually fill out the Function so it has full help and examples if you’re distributing it to staff or clients.

But there you have it, a basic (if not very silly) module for you to learn from.

Remember.  The Power of Shell is in YOU

Sean
The Energized Tech

Powershell

Ok last time I made a password generator, it was fun.  Really it was.

No REALLY! I’m not lying!

Then a buddy Joel "Jaykul” Bennett showed me really cool Password generator in Powershell on Poshcode.org . It would generate semi pronouncable passwords using a series of Arrays contains the sets of characters and the ‘Switch’ Statement

It was incredible, but I looked at it and thought “I’d like to improve upon it”

So I tried

Then end result Has all of the arrays combined into one Dynamic Array, a more universal function to eliminate much of the code, and the ability to pop the new password to the Clipboard, Straight text and SecureString.

I think it could still be improved upon.  I’d like to go the next level sometime and have a giant source dictionary, having the system optionally generate quasi “l33t sp34k” passwords.

But for now? I’m happy. 

Here’s the function and you’re happy to take IT to the next level.

--------------------------- Script --------------------------------

Function global:GET-NEWpassword( $Length, $Complexity) {

# $Length variable serves a dual Purpose
# It assumes nobody wants a tiny password less than
# 8 characters so anything less than than it used
# to pull up one of 8 predined password templates

    If ($Length -eq $NULL) { $Length = 0 }

# If you're going "100%" random you can provide a second
# value which is complexity.
#
# 1 - just random lowercase letter3
# 3 - is pretty decent (upper/lower/numbers)
# 9 - is "Muah hahaahahahahah!!!"

    If ($Complexity -eq $NULL) { $Complexity = 3 }

# If password Length provided is less than eight
# Function will use one of 8 predefined templates

# Default Settings 8 Character SemiPronouncable Password from a previous
# password generator on Poshcode.org
#
# These are predinable password sets, as long as you like, max *8*
# C = Upper Case Consanant
# c = Lower Case Consanant
# L = Upper Case Alphabet
# l = Lower Case Alphabet
# D = Decimal numbers
# h = Hexidecimal series with Lowercase a-f
# H = Hexidecimal series with Uppercase A-F
# * = Any defined character in the sets

    $passwordTemplateList=,"Cvcvcdd."
    $passwordTemplateList+=,"CvCddvVc"
    $passwordTemplateList+=,"********"
    $passwordTemplateList+=,"CccddVvv"
    $passwordTemplateList+=,"HHHHHHHH"
    $passwordTemplateList+=,"d.d.d.d."
    $passwordTemplateList+=,"dddddddd"
    $passwordTemplateList+=,"0V0cC.0C"

    $PasswordTemplate=$NULL

# All character sets are part of a single Dynamic Array which you
# can easily add to

#Lowercase
    $AsciiArray=,("l","abcdefghijklmnopqrstuvwxyz")
#Uppercase
    $AsciiArray+=,("L","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#Decimal Numbers
    $AsciiArray+=,("d","0123456789")
#Punctuation
    $AsciiArray+=,(".","!#$%'()*+,-./:;=>?@[]^_")
#Lowercase Vowels
    $AsciiArray+=,("v","aeiou")
#Uppercase Vowels
    $AsciiArray+=,("V","AEIOU")
#HexadecimalNumbers (lowercase on the a-f)
    $AsciiArray+=,("h","0123456789abcdef")
#HexadecimalNumbers (UPPERCASE on the A-F)
    $AsciiArray+=,("H","0123456789ABCDEF")
#Lowercase Consonants
    $AsciiArray+=,("c","abcdfghjklmnpqrstvwxyz")
#Uppercase Consonants
    $AsciiArray+=,("C","ABCDFGHJKLMNPQRSTVWXYZ")

# This variable is important.  If you ADD to the Array
# It checks the size for all of the calculations below
# First Character in the Array such as l,L,d,v etc
# identifies the contents of that row of the array
# such as lowercaseletter, UPPERCASELETTER, Decimalnumber
# vowel

    $Arraysize=($AsciiArray.Length)-1

# Here is part of the magic
#
# If we have a password length less than 8 supplied
# from the parameter, we will call up one of 8
# predefined templates and use THAT format for
# the password.
#

    If ($Length -lt 8)
    {
        $PasswordTemplate = $PasswordTemplateList[$Length];
        $Complexity = $Arraysize
    }
#
# Otherwise it is a large password and we will build
# A Pseudo template where each character is our "*"
# wildcard

    Else
    {
        Foreach ($count in 1..$Length)
        { $PasswordTemplate+="*" }
    }

# Blank out the new Password for good measure, JUST CUZ!

    $NewPassword=$NULL
# First loop.  Look at and ACT upon each character in the template
# to produce the appropriate content for that position in the
# password

Foreach ( $item in 0..(($passwordTemplate.Length)-1) ) {
    $Asciiset = $passwordtemplate[$item]

# Here is our second loop.  We're going to match the Type of
# Character being used against the master list in the array
# When found, we use that set

# Special scenario.  If we're doing a "Wildcard" "*" then we have to pick
# a random set from the Array to be able to pick a random character

    If ($AsciiSet -eq "*"){ $Asciiset=$AsciiArray[(GET-RANDOM $Complexity)][0]}

    $Arraypos=0
# While the two don't match, keep checking the sets.

    while ([byte][char]$AsciiSet -ne [byte][char]($AsciiArray[$Arraypos][0])){$Arraypos++}

# $Arraypos holds the correct set.  Pull out the String of Characters
# Get the length of the array, and use GET-RANDOM to pick a byte

    $String=$AsciiArray[$ArrayPos][1]
    $StringLength=$String.Length

# Now add that to the password

    $NewPassword+=$String.substring((GET-RANDOM $StringLength),1)

# End of loop - this goes on until the password is built

    }

    # this line doesn't work in Windows XP natively, but you can download a utility
    # called "ToClip" that does the same thing.  REplace "Clip" with "ToClip"
    # http://www.fullspan.com/proj/toclip/index.html
    #
    # Send the password to the Clipboard

    $NewPassword | clip

    # Return the password in Plaintext and as Secure-String

    Return $NewPassword, (CONVERTTO-Securestring $NewPassword -asplaintext -force)

}

--------------------------- Script --------------------------------

Powershell

I’m certain others knew this before me, but this is just too cool.

All these years, I didn’t realize there was a little program called “CLIP.EXE” sitting in Windows with one simple task.  All you to send data to the clipboard.

Isn’t that just NICE?

So I was playing with my GET-NEWPassword function and added in two extra lines near the bottom and changed

Return $NewPassword

to

$NewPassword | CLIP

Return $NewPassword, (CONVERTTO-SECURESTRING $NewPassword -asplaintext -force)

 

What this means is I now have a function that can Generate new random passwords and have it in a form that I could immediately document them somewhere or even just paste into a Non Powershell enabled program

Gotta love it when it’s this easy

the Power of Shell is in YOU

Sean
The Energized Tech

Powershell

Here’s a task every Network Administrator or Technician has to deal with.  Generating passwords.

There’s a few websites I traditionally use for this task.  But wait?  Isn’t it just “Random Letters”?

At least the temporary one is.  What the users choose after that is their choice but I like having something random pulled out for the users.  Would ya know it?  Powershell has a “GET-RANDOM” cmdlet.

Now there are various ways I could have done this but I started simple.   Pick one of the 26 letters in the alphabet and pull them together as a password.  Getting ASCII characters in Powershell is very easy.  Just Plug in the ASCII Number into [char]

[CHAR]65

Will produce an uppercase “A”

Not too difficult then to do something like

[CHAR]((GET-RANDOM 26)+65)

To pick a random letter from A to Z in uppercase!

So a simple loop like this

$Newpassword=$NULL; FOREACH ($Counter in 1..8) { $Newpassword=$Newpassword+([CHAR]((GET-RANDOM 26)+65)) }

Will generate a Random password of just Uppercase letters.

So then I though, “I can take this up a notch”.  I decided to make an array containing all the numeric starting points in ASCII and the amount of Characters in each set.

[int32[]]$ArrayofAscii=26,97,26,65,10,48,15,33

This array is organized by the number of characters in the sequence followed by the Starting point in Ascii.  IE: 26 Letters, Lowercase starts at 97, 26 Letters, Uppercase starts at 65

Pretty simple idea.   Now my first idea was to just go completely random and pick from the four sets.  It worked but You always got passwords like this

3jH(B(zA

Which is fine, but I want some control.  For me?  I’d love to use that daily.  But I need this to be useful for everybody.    So I decided to control how many sets you would pick from (1-4) deciding that lowercase letters were the simplest, followed by a mix of Upper/Lower, then adding in Numbers, then Punctuation for passwords.

The end result is a function called GET-NEWPassword that will generate an 8 Character password and reasonably complexity for your use.   If you want to play with the Function, one of the things you COULD pass into it would be the length and complexity.  For simplicity, I presumed most Administrators have a standard they work with and you can edit that in the function yourself to make it simpler.

Cool part is you can take this password and make it a Secure string using the following sequence

$NewUsePassword=ConvertTo-SecureString (GET-NewPassword) -AsPlainText –force

Pretty cool eh?  But there you have it.  Something you can take home and use daily.

Remember, the Power of Shell is in YOU

Sean
The Energized Tech

############### Script Begin ##################

function global:GET-NewPassword() {

# Delare an array holding what I need.  Here is the format
# The first number is a the number of characters (Ie 26 for the alphabet)
# The Second Number is WHERE it resides in the Ascii Character set
# So 26,97 will pick a random number representing a letter in Asciii
# and add it to 97 to produce the ASCII Character
#
[int32[]]$ArrayofAscii=26,97,26,65,10,48,15,33

# Complexity can be from 1 - 4 with the results being
# 1 - Pure lowercase Ascii
# 2 - Mix Uppercase and Lowercase Ascii
# 3 - Ascii Upper/Lower with Numbers
# 4 - Ascii Upper/Lower with Numbers and Punctuation
$Complexity=3

# Password Length can be from 1 to as Crazy as you want
# 
$PasswordLength=8

# Nullify the Variable holding the password
$NewPassword=$NULL


# Here is our loop
Foreach ($counter in 1..$PasswordLength) {

# What we do here is pick a random pair (4 possible)
# in the array to generate out random letters / numbers

$pickSet=(GET-Random $complexity)*2

# Pick an Ascii Character and add it to the Password
# Here is the original line I was testing with 
# [char] (GET-RANDOM 26) +97 Which generates
# Random Lowercase ASCII Characters
# [char] (GET-RANDOM 26) +65 Which generates
# Random Uppercase ASCII Characters
# [char] (GET-RANDOM 10) +48 Which generates
# Random Numeric ASCII Characters
# [char] (GET-RANDOM 15) +33 Which generates
# Random Punctuation ASCII Characters

$NewPassword=$NewPassword+[char]((get-random $ArrayOfAscii[$pickset])+$ArrayOfAscii[$pickset+1])
}

# When we're done we Return the $NewPassword 
# BACK to the calling Party
Return $NewPassword

}
############### Script Ending ##################

 

Powershell

Ok this is written because my good friend Ragnar Harper said “Sean!  We have to a ‘Powershell Blues!’”

Well Ragnar man, take this to Norway and BLOW them away !

Here’s the lyrics.  If anybody would like to grab a little Blues Riff and sing it out, GO FOR IT! :)

“Powershell Blues”

Loadin' up the GUI
Starin' at the Screen
Clickin' like a madman
Fingers turnin' green

Oh I've got the
GUI overdone madness
Yeah
Gimme Powershell Blue

GET-QADUSER
and EXPORT-CSV
Those Verb Noun Cmdlet
Yeah they set us all free

Oh I've got the
GUI overdone madness
Yeah
Gimme Powershell Blue

Gimme all my Snapins
Functions and modules as well
No more the mousy clickin'
Send that straight right to Hell

Oh I've got the
GUI overdone madness
Yeah
Gimme Powershell Blue

I bow to Craig and Eddie
and before that Snover guy too
Automation is my power
Stickin' to me like glue

Oh I've got the
GUI overdone madness
Yeah
Gimme Powershell Blue

If you see in a corner
A cryin' away 'til three
It's cuz I'm usin' a GUI
GPO locked it from me

Oh I've got the
GUI overdone madness
Yeah
Gimme Powershell Blue

Yeah baby, I've got that
Dot Net empowered
AD enabled
Powershell Blue