List of Exchange 2003 Administrators

July 23, 2009

The following script lists all the groups or users that have been delegated as exchange admins at the organizational level. There are three types of administrative roles: Exchange Full Administrator Exchange Administrator Exchange View Only Administrator   $cnc = (Get-QADObject (Get-QADRootDSE).ConfigurationNamingContext).DN $DN = "CN=Microsoft Exchange,CN=Services,$cnc" Get-QADPermission $DN -Inherited -SchemaDefault | ` Where-Object...

Get your hands on Windows PowerShell v2

  Microsoft announced yesterday the release dates for RTM (Release to Manufacturing) version of  Windows 7 and Windows Server 2008 R2. As you probably know, these platforms are shipped with PowerShell v2 as a Windows component. Yes, it is now a part of the OS! A separate download will be available for Windows XP/Vista/2003 in the next few months, as tweeted by Jeffrey Snover.
no comments

How to audit AD groups in one line of PowerShell

July 20, 2009

I was tasked this morning with the following: Get all groups from Active Directory and produce a report that includes each group Name,distinguishedName, the type of the group, its scope, mail address, description and group membership count. Armed with Quest's AD cmdlets I wrote the following. It took 3 minutes to write the code and send it to my manager with PowerShell v2 Send-MailMessage cmdlet:   Get-QADGroup -SizeLimit 0 | Select-Object Name,DN,GroupType,GroupScope,@{Name="MemberCount";Expression={ @(Get-QADGroupMember -SizeLimit 0 -Identity $_).Count }},Mail,Description | Sort-Object MemberCount -Descending | Export-Csv .\ADGroupsReport.csv #This section requires PowerShell v2$PSEmailServer= "EmailServerName" Send-MailMessage -From "Me@domain.com" -To "Manager@domain.com" -Attachments .\ADGroupsReport.csv -Subject  "AD Groups...
2 comments

Bank Of Israel – Currency exchange rates

July 19, 2009

In this post (hebrew), Shlomo Goldberg, shows how we can receive currency exchange rates from Bank Of Israel website in C#. This is a great way to show how with a few lines of code we can get the rates with PowerShell. We create a webclient object, use its DownloadString method and cast the result to XML using PowerShell's XML type shortcut and then we format the results: $wc = New-Object System.Net.WebClient $rates = $wc.DownloadString("http://www.bankisrael.gov.il/currency.xml") $rates.CURRENCIES.CURRENCY | Format-Table -Auto Name,Country,CurrencyCode,Rate,Change,Unit  NAME COUNTRY CURRENCYCODE RATE CHANGE UNIT ---- ------- ...
2 comments

Mapping WMI mailbox object to its AD user account

July 16, 2009

Few days ago I got a request from a reader of my blog: "I found the WMI commands to get info from Exchange 2003 servers and the following gets me the displayname, servername, storagegroupname, and storename but am I able to get the SamAccountName?  Do you know any way?" Get-WmiObject -Class Exchange_Mailbox -NameSpace root\microsoftexchangev2 -ComputerName ExchangeServer | Sort-Object MailboxDisplayName | Format-Table MailboxDisplayName, ServerName, StorageGroupName, StoreName, Size -auto First, lets see how a sample mailbox output looks like when we issue the above WMI command (without piping to sort and format-table):(...) AssocContentCount : 159 Caption ...

Get all users that cannot change their password

July 6, 2009

Earlier today a colleague of mine asked me for a script solution: "I want to get all users that cannot change their password from Active Directory but I can't find any attribute on the user account with that info." Correct, there is no such attribute. When a user account is set with the 'User cannot change password' account option, two (Deny) Access Control Entries (ACEs) are added to the account in question: 1. Deny for the user account (SELF) 2. Deny for everyone else (Everyone built-in group)   To see the ACEs go to the 'Security' tab and then click the...
10 comments

PowerShell IRC channel chat from PowerShell Toolbar

July 5, 2009

A few days ago Alan Renouf asked me if there is a way to get access to the popular PowerShell IRC channel (from Freenode.net) via PowerShell Toolbar. Guess what? I'm happy to announce that this feature is Alive & Kicking directly from the toolbar. Thanks for a great idea Alan!! On the toolbar, click on the 'Chat' Icon (the old chat room is no longer available)   A floating dialog appears, choose your user name (Nickname) and press the 'Connect' button. Starting chatting!

PowerShell MVP for another year

July 1, 2009

This evening (18:12), after a lot of fingernails biting I got the email I was waiting for! And if you've ever wondered how the message looks like: Dear Shay Levy, Congratulations! We are pleased to present you with the 2009 Microsoft庐 MVP Award! This award is given to exceptional technical community leaders who actively share their high quality, real world expertise with others. We appreciate your outstanding contributions in PowerShell technical communities during the past year. I want to thank my Mom, Dad .... :) and also welcome two new guys to the PowerShell...
7 comments