Jacob’s Lifestream

Stranger things have happened... 
Filed under

PowerShell

 

Powershell V2 Launch Party #PowerShellLaunchParty

If you're into Powershell, show up. Some great people there :)


http://powerscripting.wordpress.com/2009/10/16/powershell-v2-virtual-launch-party/

Please help spread the news as we have our own Windows 7 Launch Party—just for the part we care about. :) There will be prizes given away to those that show up!

Please copy the below announcement into emails and blog posts, or share this link on Facebook or Twitter! Use the Twitter hashtag #PowerShellLaunchParty


Windows isn’t just about the GUI. Starting with Windows 7, you have built-in access to PowerShell version 2, an object-oriented scripting language and command shell. Please join PowerScripting Podcast hosts Jonathan Walz and PowerShell MVP Hal Rottenberg as they interview Distinguished Engineer Jeffrey Snover on launch day! Jeffrey is the chief architect responsible for PowerShell at Microsoft, and he’ll be covering what’s new with the tool and why every system administrator on the planet needs to be using it. If you’ve never attended PowerScripting Live, you are missing out on a great time. The show will be streamed live via Ustream, and viewers can chat with each other, as well as submit questions for the guest.

Loading mentions Retweet
Filed under  //   Powershell  

Comments [0]

Get a list of users’ email addresses « Dmitry’s PowerBlog: PowerShell and beyond

Here’s the oneliner (for PowerShell v2):

(Get-QADGroupMember MyGroupName -Type user -Indirect |
    Select -expand Email) -join ';'

PowerShell v1 version has a slightly different syntax for join:

[string]::join(';',
  (Get-QADGroupMember MyGroupName -Type user -Indirect |
    Select -expand Email))

Whoopass Dmitry !

Always was hugely annoyed by not being able to retrieve the e-mail addresses, once they, in total, became too long.

Will definitely be using this myself !

Loading mentions Retweet
Filed under  //   Active Directory   PowerShell  

Comments [0]

Get size of all PST files in a drive/folder

Did this the other day. It's very simple, and has room for lots of improvements. But it does the job for my purpose, and I'm posting it so you may use it as a base for doing your own script. Stuff I know could be improved (based on my own needs):

  • Formatting the output (Total size)
  • Streaming the results to screen
  • Output to file as CSV
  • Error handling

However, most of the PowerShell stuff I do, I don't have time to polish it (although I'd like to), plus it's a relatively inconsistent effort (for now...). So you'll have to live with this. You are, of course, more than welcome to contact me if you want to bounce ideas back and forth :)



# AUTHOR: Jacob Saaby Nielsen, jsy@systematic.com
# DATE  : 29-06-2009
# 
# COMMENT: Count the total size of .pst files in a folder and its subfolders
# 
# SYNTAX: Get-PSTsize.ps1 z:\

$FileCol = Get-ChildItem $Args[0] -recurse | where {!($_.psiscontainer) -and ($_.Extension -eq ".pst")}
$TotalPSTSize = 0

foreach ($File in $FileCol)
{
 $TotalPSTSize += $File.Length
}

Write-Host $TotalPSTSize

$FileCol | Out-File c:\pstfiles.txt
$TotalPSTSize | Out-File c:\pstfiles.txt -append

Loading mentions Retweet
Filed under  //   PowerShell  

Comments [0]

Exchange/AD: Finding users whose mail is forwarded

I was asked earlier by one of my colleagues, if there was a way to find out which users have their mail forwarded to other users. I answered no, cause I don't know of a way to do that. So, just now my colleague Thomas presented me with the answer:

get-qaduser -SizeLimit 0 -IncludedProperties altrecipient -ldapfilter '(&(mail=*)(altRecipient=*))' | Select-Object -property "name","description","altrecipient" | where {$_.altrecipient -like "*Put a name here*"}

Pretty cool :) Updated at 17:14, the powershell code was a bit too long ;)

Loading mentions Retweet
Filed under  //   Active Directory   Exchange   PowerShell  

Comments [0]

Exchange Course: Day 2 - Powershell gets you pole position

Day 2 of MS5047B was great too. More good info, learned a lot.

But I'll dwell on PowerShell for a moment.

We're 6 guys there for the course. Of those, I know PowerShell pretty well. Another guy was acquainted with PowerShell. 4 don't know it.

What's funny to see, is how hostile people are towards it. It's non-GUI, and it's new.

Now, as a a systems administrator, I would expect people to be able to script at some level. I would expect a systems administrator to see the value of scripting, since it's so very obvious how much time and aggravation it can save you.

And still, 85% of attendants haven't seen fit to learn the most powerful scripting technology released on a Windows platform (and most other platforms), EVER.

Result: I was done quickly, with my exercises. When I was done, the others turned to me for help. One of them in particular, got interested in PowerShell. I think he really got the point. I really hope that isn't the general picture out there in the big ol' world. Cause if 85% of all systems administrators don't keep up with basic technologies that will enable you to bring so much more value to their businesses, it is a grave situation out there.

Enough ranting.

Basic point: If you're a Windows systems administrator, learn PowerShell. You won't regret it, your business won't regret it, and when push comes to shove - you'll be the one keeping your job.

Loading mentions Retweet
Filed under  //   Exchange 2007   PowerShell  

Comments [0]

Exchange Course: Day 1 - good so far

I'm at the Exchange 2007 course (Installing and managing) MS5047.

Pretty good so far.

Had a bit of trouble finding the place, since my GPS (even with Q4/2008 maps) can't find Karlebovej 91. Only 90. Go figure.

When I arrived, they hadn't registered me. I was going to attend the course on 16th to 18th of March. But it moved forward a month, to the same dates, but in February. They had to copy some material for me, so I could still attend. Got to talk to our course broker about that. Otherwise great.

Very interesting, learning a lot :)

Things worth noting: I seem to be one of the only guys here, with Powershell skills. I'm a bit amazed how IT admins don't really know what they can use Powershell for, or how utterly important it is for them to get to know it.

If this was a real life scenario and not a course, I'd be miles ahead - just by knowing Powershell.

Loading mentions Retweet
Filed under  //   Exchange 2007   PowerShell  

Comments [0]

My first interview - like, ever ?!??!

Following my presentation at Århus .NET User Group on PowerShell, they did a follow up interview with me.

The article is here.

Direct download is here.

Oh, by the way - it's in Danish ;)

Loading mentions Retweet
Filed under  //   Århus .NET User Group   Podcast   PowerShell  

Comments [0]

PowerShell syntax highlightning in your blogposts

Just found WP-CodeBox - great plugin for Wordpress, which allow you to have codeboxes in your blogposts. It's based on GeSHi, which adds support for a LOT of languages. So if you need syntax colouring in your blogposts - give it a spin :) You can see an example of it, in my previous post.

Loading mentions Retweet
Filed under  //   PowerShell   Wordpress   WP-CodeBox  

Comments [0]

How many users in a group hierarchy ?

Was doing some statistics for our knowledge networks today. Our KN Facilitator said the other day, she'd really like to know how many unique members we had in our knowledge networks. Now, normally, that'd be a really timeconsuming task, however simple it was. Fortunately, I have PowerShell and the Quest AD commandlets. So it's actually this simple.

Get-QADGroupMember "Group Name Here" -Indirect | where {$_.Type -eq "User"} | sort

Get-QADGroupMember is the commandlet of choice, if you want to get members of a group.

However, if you don't just want a list of groups in that group, you should add the "-Indirect" parameter, which tells it to traverse the group hierarchy.

Since that would also get me all of the subgroups and public folders that are members of that main group, I need to search for users only. Hence, the added where clause.

And the final touch: Sorting the output.

In the future: I'll add a bit of statistics showing how many knowledge networks the members are part of, and if I can find a suitable graphical way of doing it, a map of the relations between the knowledge networks, based on member participation.

Loading mentions Retweet
Filed under  //   Active Directory   PowerShell  

Comments [0]