Windows 7 – Seventh One is a Seventh WON

Windows-7-Logo

This is dedicated to the entire Team at Microsoft behind the Development, Marketing, Production of Windows 7 including the Eight Million People worldwide across various countries who downloaded, used the Betas and RC’s providing Feedback to make the product what it came to be on Launch day yesterday.

You the Community made this product what it is

You can Sing this (Believe it or Not) to “Iron Maiden” and “Seventh Son of a Seventh Son”

But even without words, I think it’s fun to read.

"Seventh One is a Seventh Won"

Hear the tale from Binary minds
Of a code that had shaped
Right down the lines
The bits and the bytes following through
The Beta, the RC’s RTM’s too

See them all, the many download
The perfect, the shaping, unbroken code
United as one, a goal in their eyes
8 million strong to strengthen the prize

[Chorus:]
Seventh One is a Seventh WON
Seventh One is a Seventh WON
Seventh One is a Seventh WON
Seventh One is a Seventh WON

Redmond stands back, listening well
The comments, the feedback, no one shall quell
Adjusting and shaping, they work through the night
A thing of pure beauty, it shines it their sight

[Chorus:]

Seventh One is a Seventh WON
Seventh One is a Seventh WON
Seventh One is a Seventh WON
Seventh One is a Seventh WON

Today is launched the Seventh One
An O/S pure the Seventh One
And we who helped the Seventh One
It has the Power to Create
It has the Power of Shell to Unite
It is our choice O/S
Let it be compiled
Let it not be undone

Ode to Windows 7

Windows-7-Logo

O Windows 7, how do I love thee? Let me count the ways

I love thee for thy cleaner core; lending speed to my flight,
Booting faster, launching quickly,
rocketing through the night.

I love thee for thy WinRE
to save me in the day

I love thee for the for thy Windows Shake,
tosseth my problems all away.

I love thee for thy compatability, extending to the past
Launching away whatever that I cast

I love thee for thy security, protecting all that is mine
Keepeth out troublemaking, rotten little swine

I love thee for thy Gui, an interface to behold
Dancing quickly, revealing all, in colors oh so bold

But mostly I love thee Windows 7, as the day it carries on
For being simply the nicest, one to come along

Using Powershell to gather MAC Addresses of Network cards EASILY – Part 2

 PowershellBIG

 

So last time we left you with a partially useful Powershell line.  The ability to type in a computer name into a variable and have it list all the Physical network cards attached to the System via WMI (Windows Management Instrumentation).

The end result of this desired operation would be to have a list of all the MAC addresses on your PC’s.   For what purpose?  Possibly setting up SCCM 2007 or maybe even to aid in securing DHCP by having a list of MAC addresses in use and only only handing out IP’s to registered network cards.

Or maybe you just like collecting MAC Addresses 🙂

But to make this truly useful, we need a list of computers.  Now if I (or you) have to go to each computer to GET it’s name, that completely defeats the purpose.  But if you have Active Directory on your site this really gets easy.   Any version will do for Powershell.

 

So our first piece involves having the FREE Quest Active Roles Management Shell for Active Directory for Powershell.  We’re going to use the “GET-QADCOMPUTER” to get a list of systems in Active Directory, because well, that’s GET-QADCOMPUTER DOES and does very well and simply.

 

GET-QADCOMPUTER

 

That of course will dump a list from 3 to 300 lines of computer names depending on the size of your network.  But we don’t want to see the pretty list.  We need that list to work for us.  So we’re going to store that information away in a Powershell variable.

 

$COMPUTERLIST=GET-QADCOMPUTER

 

Once we have this list we can select and pipe each item from this list into the Powershell commandlet from before

—— PRINTMACLIST.PS1 ——

$COMPUTERLIST=GET-QADCOMPUTER

FOREACH ($PC IN $COMPUTERLIST)
{

Get-WmiObject WIN32-NETWORKADAPTER -computer $PC.NAME | where { $-.PhysicalAdapter.CompareTo($FALSE) } | Format-table @{Label="ComputerName"; Expression={$PC.NAME}}, NAME, MACADDRESS,

}

——– END OF SCRIPT ———–

 

Now this is all fine and dandy.  A printed report on the screen.   But the whole point of Powershell and Computers and Life in general is try and SAVE work, like avoiding typing in that silly list.   So instead of using “FORMAT-TABLE” we’re going to “SELECT” from the OBJECT the PROPERTIES we want so we can EXPORT it to a CSV (Anybody see where I’m going with this?  Yeah I’m that obvious eh?)

 

So the same script but swap out “FORMAT-TABLE” with “SELECT-OBJECT” which allows out to pick out what we want.  Then we’ll use EXPORT-CSV to pipe all that output into a nice file which should at LEAST save on typing

 

—— EXPORTMACLIST.PS1 ——

$COMPUTERLIST=GET-QADCOMPUTER

FOREACH ($PC IN $COMPUTERLIST)

{

Get-WmiObject WIN32-NETWORKADAPTER -computer $PC.NAME | where { $-.PhysicalAdapter.CompareTo($FALSE) } | select-object NAME, MACADDRESS, @{Label="ComputerName"; Expression={$PC.NAME}} | Export-csv C:MACADDRS.CSV

}

——– END OF SCRIPT ———–

 

And now what you’ll have is an easy way to pull out the MacAddresses, list of Physical network cards INCLUDING the Computer name on each line.   The interesting part is because this is mostly based on WMI you could easily add on Filters to only show computers which are Workstations.  And With GET-QADCOMPUTER you can even filter specific OU’s containing computers.

 

Enjoy the Power

It’s Easy and It’s Free

 

Sean

The Energized Tech