Welcome to Dirteam.com/ActiveDir.org Blogs Sign in | Join | Help

Matt Johnson's Technical Adventures

One server at a time.
Freaking Hilarious

The Simpsons still remain awesome to this day!

Random Collection of Links – 11/4/2008

I refuse to post anything regarding the election, so here are some interesting (or may not so interesting) links.

Microsoft Essential Business Server on Technet

Just logged into Technet today to get a ISO, and saw that EBS is now in Technet. Now only if I had enough machines to try it out with.

ebs-technet-view

Get PC Serial Number via PowerShell

This is a pretty cool one liner that is of tremendous help. You can get the serial number of most PCs via PowerShell remotely. This includes Dell service tags.

Command:
Get-WMIObject -Class "Win32_BIOS" -Computer computername | select SerialNumber
 
Example:
Get-WMIObject –Class “Win32_BIOS” –Computer MJDEV01 | Select SerialNumber
 
SerialNumber
------------
8888888

This works on both Dell and HP/Compaq PCs. I haven’t tested this on other vendors PCs.

Getting Mailbox Size for Multiple Users on Exchange 2007

Recently, while doing a migration between Exchange 2007 servers, I needed to find out the size of the mailboxes so I could distribute the transfer load to off hours. PowerShell to the rescue.

There is a lot to this one liner, but you can customize it for your use.

Get-Content "c:\data\users-to-move.txt" | ForEach-Object {Get-Mailbox $_ | Get-MailboxStatistics |  Select-Object DisplayName, {$_.TotalItemSize.Value.ToMB()}}
 
Lets go into the details.

First, I started by creating a text file for the people I know I had to move. You can use Quest’s tools or Get-Mailbox to filter only those who you need to move. The text file was already created so I decided to use that. I used the Get-Content command. I used a file that was local on my workstation, but you can use a UNC path as well.

Once I got the content in the pipeline, I sent it to the ForEach-Object command. This causes PowerShell to loop through each line of the text file and send the contents in the $_ variable to what is inside the brackets. From there I sent it to Get-Mailbox so I can get the user's alias so I would be able to get the mailbox’s statistics. I am guessing that I could have just used Get-MailboxStatistics and piped in the user’s alias, but I had the email addresses.

From there, I only needed the name and total size of the mailbox for the user. I ran the Select statement to get only the two properties that I needed. The problem is that the value TotalItemSize is stored in bytes not megabytes or gigabytes. That is where having PowerShell built on top of .NET comes in handy. I just added to the end of the property that I wanted .Value.ToMB(). You will need to enclose those in brackets to make sure that it works. Another you can change the number that the TotalItemSize is ToGB().

I know this is kind of wordy, but it was useful to me and displays the power of PowerShell.

Interesting Links – 8/21/2008
Windows 7 gets it’s first blog

Jon DeVann and Steven Sinofsky started the Engineering Windows 7 Blog.

http://blogs.msdn.com/e7/default.aspx

This is awesome! Except, I am still just getting completely used to Vista for everything. Oh well.

Interesting Links – 8/14/2008
Visual Studio 2008 SP1 and .NET 3.5 SP1 Available

Visual Studio 2008

.NET Framework 3.5 SP1

Windows SBS 2008 Technical Library

The Windows Small Business Server 2008 Technical Library is available on Technet.

http://technet.microsoft.com/en-us/library/cc527559.aspx

Enjoy!

Interesting Links – 8/8/2008
SQL Server 2008 Released to Technet

I was downloading another ISO today, and realized that SQL Server 2008 was among the items you can download.

  • SQL Server 2008 Developer
  • SQL Server 2008 Web
  • SQL Server 2008 Workgroup
  • SQL Server 2008 Standard
  • SQL Server 2008 Enterprise

Cool!

The Last Hope Talks Released

If you are like me and didn’t get the chance to go to The Last Hope (The conference put on by 2600 Magazine.), you can now download the talks in .MP3 format.

http://www.thelasthope.org/talks.html

I am a huge fan of 2600 and have been reading it for years. I hope to go to the conference next time it is offered.

Interesting Links – 7/31/2008

Random PowerShell Cmdlet Fun

I wanted to see what additional PowerShell cmdlet’s I had installed on my computer. I found out that get-pssnapin does the job!

Just run the following in your PowerShell window:

get-pssnapin –registered

You should get an out put like this:

PS C:\tools> get-pssnapin –registered

Name        : Quest.ActiveRoles.ADManagement
PSVersion   : 1.0
Description : Registers the CmdLets and Providers in this assembly

PS C:\tools>

Then all you do to load the snap in is type:

add-pssnapin Quest.ActiveRoles.ADManagement

If you wanted to load all available snap ins, just type:

get-pssnapin –registered | add-pssnapin

PowerShell gets better by the day.

More Posts Next page »