Thursday, January 31, 2008

Table/Collection lookup with PowerShell

If you have to lookup data in a collection repeatedly, that can be quite slow.

Let us say you have two collections and want to update one collection based on some criteria from the other. You can do it like this -

$collA | % { $itemA=$_; $collB | ? { $_.key -eq $itemA.key} | % { $_.value=$itemA.value } } 


But in this scenario, you have to iterate $collB for each of the value in $collA. This is not efficient, especially not when you have plus 50.000 elements in both collections.



As a way to speed things up, you can build a lookup table. Note that this only works, if the key is unique in $collB. The best choice for this is an hash table. You create it like this -



$collB | % {$hashB=@{}} {$key=$_.key; $hashB.$key=$_}


Now you can use the hash in your code  -



$collA | % { $itemA=$_; $key=$itemA.key; $objB=$hashB.$key; $objB.value=$itemA.value }


The traversal of $collB is replaced by a much faster hash table lookup.



If you only need to know whether the value is in $collB, just do like this -





$collA | % { $itemA=$_; $key=$itemA.key; if ($hashB.$key) { "found" } }




I did a performance comparison (with only 500 items) so you can see the difference -



# Build two collections


1..500 | % { $collA=@(); $collB=@() } {
$c=$_
$collA+="" | select @{n="Key";e={$c}},@{n="Blah";e={$c+100000}};
$collB+="" | select @{n="Key";e={$c}},@{n="Blah2";e={$c+200000}};
}


# Run 'normal' lookup


measure-command {
$collA | % { $itemA=$_; $collB | ? { $_.key -eq $itemA.key} | % { $_.blah2=$itemA.blah+100000 } }
}
# It took 27,3 seconds

# Build hash and run hash lookup


measure-command {
$collB | % { $hashB=@{} } { $key=$_.key; $hashB.$key=$_ }
$collA | % { $itemA=$_; $key=$itemA.key; $objB=$hashB.$key; $objB.blah2=$itemA.blah+200000 }
}

# It took 0,1 seconds


Do I need to say more?

Problems Running the Certificate Wizard on the OCS Edge Role

when requesting certificates from an online authority (E.g. your own PKI server like smbex01.nwtraders.com\certsrv) ?

If you end up receiving this failure -

image

Then it may be because you didn't install the Root CA certificate \ Subordinate CA certificates - try this and try again - then it just might work (But anyway not always is my experience ;-)

Wednesday, January 30, 2008

"One Gateway equals one Medation Server"

This has been the mantra since the early betas of OCS . But now there seems to be a solution using SER made by the same author who also released the LCS / SER / Asterisk solution.

This is the current functionality -

  • One OCS Mediation routing to Many SIP Gateways - Yes
  • Outbound from OCS Call Completion - Yes
  • Inbound into OCS Call Completion - Yes - Does not route through SER
  • Far End/Telephone Disconnect/Hangup - Yes - Does not route through SER
  • Near End/OCS Disconnect/Hangup - Yes - Does route through SER

And this is the author's own visual representation of the call flow-






















Find the full description and ser.cfg configuration file here.

Troubleshooting Update Server for Tanjay devices a.k.a. Office Communicator Phone Experience ;-)

So I'm catching up on my RSS feeds after a hectic 2007 occupied with delivering boot camps all over Europe and supporting the attendees either directly or via our UC Boot camp forum.

Chad Lacy has a good post on Troubleshooting the Update Server that you can find here - it does answer some of the questions I've received, so even though it is from November I thought I would refer to it.

Also if you are interested in Tanjay's then remember to follow Jens Triers' blog.

Office Communicator/Call Button Integration Support Kit for LifeCam / LifeChat

Here's a nice little tool for Microsoft LifeCam's. It solves the problem we have in our UC boot camp labs, where pressing the hardware button on the webcam will cause Live Messenger to launch -

Microsoft headsets and webcams are optimized for Windows Live Messenger through the Call Button. Until now, there has not been a simple means to configure the Call Button to start Office Communicator. The goal of the Call Button Integration Support kit (the kit) is to change that.

Find the kit here. Seen here on Aaron Tiensivu's blog.

Monday, January 28, 2008

New Office Communications Server Blogs to watch

There are a few relatively new Microsoft blogs out there to watch that I wanted to point you to -

Jens Trier Rasmussen - Jens is an old seasoned Microsoft consultant (Also from Denmark) that has worked a lot with Exchange and OCS and lately have been supporting the Voice Partners during the beta's. He already has some good posts on OCS in his blog so go check it out here.

Flight Deck / Chad Lacy - Chad is a Microsoft engineer from Charlotte, North Carolina (Where some of my other good contacts are placed). His description says "Discussions about Unified Communication, LCS/OCS, VoIP, and more" and he is the first person, besides me, that I have seen holding both MCSE certification and a MBA degree ;-) Find his blog here.

Karsten Palmvig - Karsten is another Danish Microsoft consultant who used to be primarily a Exchange expert (Like Jens and I actually). His description says "Notes from the field on Exchange, OCS, UC and DPM..." find his blog here.

Sunday, January 27, 2008

Windows Home Server Transport Service problem

Suddenly I started receiving the following error message from my WHS "Windows Home Server Transport Service encountered a problem" when logging in to the machine and I get the option to Send an error report. This would happen 5-6 times before stopping.

Google didn't find any solutions (Neither did connect - I was also beta tester of WHS) so I thought that I very quickly would summarize it here. Looking in eventvwr revealed several problems but this one quickly got my attention -

Event Source: DCOM
Event ID: 10016
User: NT AUTHORITY\NETWORK SERVICE
Description: The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID {BA126AD1-2166-11D1-B1D0-00805FC1270E} to the user NT AUTHORITY\NETWORK SERVICE SID (S-1-5-20). This security permission can be modified using the Component Services administrative tool.

Follow the help link for detailed explanations on how to change DCOM security.

Finding the CLSID in registry revealed it was the "Network Connection Manager Class" but I couldn't find it in DCOMCNFG. I then Googled again and found that it is listed as "netman" and I gave the Network Service Local Activation rights and rebooted. Problem fixed ;-)

It looks like this is also a known SBS 2003 problem and if you didn't know WHS is partly based on SBS 2003 (Which you can see in the Help and Support Center as it states it is running "Microsoft Small Business Server 2003"

Enable Power Management on WHS (and thereby also Windows Server 2003)

I am playing with my newest toy, Windows Home Server (WHS), and I must say that this is by far the niftiest "little" piece of home software I have had my hands on (I may review it later - but if you don't know it then download the trial version and install, find your add-ins here and especially look at the Webguide for Windows Home Server and the Avast Professional Family Pack, which includes a WHS add-in).

To save power and space I have setup a portable computer with an external harddrive and now I was surfing around to find out how power management works with WHS.

There where different more or less clever solutions from shutting down at midnight and then using a timer device to turn it on again to more advanced solutions, but by far the best solution I found is using the built-in features of Windows Server 2003 together with a portable computer (In my Case a Dell D830 with 3 GB RAM, Core 2 Duo and 160 GB 7200 RPM disks). 

These built-in features are explained and detailed in the whitepaper How to Enable Processor Power Management in Windows Server 2003 and applies of course to all server versions (I have used it before on my Shuttle that I use for Virtual Server labs with standard Windows Server 2003).

Another add-in I used was Marcel Nouwens free AutoExit 2008 for Windows Home Server that can do Wake-On-Lan (Perfect for my Shuttle) and handle remote shutdown, reboots, send messages or even open a Remote Desktop session) - so now I almost have my perfect home network / WHS solution running (I'm still awaiting a few add-ins so I can remotely stream MCE recorded TV (Should release in late January) and a add-in for total Desktop Management, I need my 802.11n to run better and the list continues endlessly ;-)

Friday, January 25, 2008

OCS 2007 Security Overview Whitepaper

Microsoft has released a introduction to security in Office Communications Server 2007 and its related clients (Actually back in August 2007 - but I forgot to mention it).

Instead of re-writing the introduction here is a snippet from the whitepaper "Office Communications Server 2007 – Security Overview" published by Microsoft in Augusth 2007 -

"The use of the Internet for instant messaging (IM) technologies, audio/video, and Web conferencing has been evolving since the first widely used Internet and GUI-based product, ICQ, first entered the market in November 1996 (quickly followed by AOL, MSN, and Yahoo! as the largest competitors)....

The responsible IT or security administrator has in many cases sought to fight the infiltration of the consumer products, because many shortcomings exist in the use of these technologies in a business environment. Besides the security risks and disclosure of sensitive business information that we will discuss later, these technologies have associated shortcomings in central management, in compliance management and records retention, and as a target for thieves who use them to gain sensitive business information.

This whitepaper will discuss the security features in Microsoft® Office Communications Server 2007 (OCS 2007) as it relates to the Microsoft unified communications platform and how OCS 2007 handles these security challenges in a connected world, while still delivering on the promise of presence, IM, VoIP, audio/video conferencing, and Web conferencing capabilities."

The whitepaper then continues to discuss concerns around privacy, methods of traversing firewalls in Public Instant Messaging Products etc. For OCS it discusses security in different types of users/clients, security in autoconfiguration, Network and Data Security and lastly compliance and archiving.

IMHO it's worth a read if you are new to OCS and Security, but then again who am I to judge that ;-)

Find the whitepaper here.

Btw. If you wan't to find some Easter eggs in the whitepaper then take a look at the country code for phone numbers and the text part in the last screenshot (Remember I'm from Denmark and work in a company called Inceptio ;-)

Monday, January 21, 2008

Advanced Topologies for Microsoft Office Communications Server 2007 Networks

AudioCodes is conducting a interesting Web Seminar on the following topics -

Discover advanced topologies for integrating AudioCodes VoIP Gateways into OCS environments, enabling smooth and cost effective migration of existing TDM-based enterprise networks, including:

  • Simultaneous Connection to both OCS & Exchange Server 2007
  • Drop & Insert configuration for simple and cost-effective PBX connection
  • Implementing Fax adapters with OCS
  • Enabling connectivity to non-certified IP-PBX and Cisco Call Manager
  • And more..

Probably also some marketing related stuff is included, but thats how it is ;-)

Find the links for registration here

Thursday, Jan 31st, 2008, 10:00AM-11:00AM CET (Central European Time)
Thursday, Jan 31st, 2008, 05:00PM-06:00PM SGT (Singapore/Hong Kong Time)
Click to register or copy the following url:
https://audiocodes-training.webex.com/audiocodes-training/k2/j.php?ED=2252547&UID=995195367&FM=1

Or


Thursday, Jan 31st, 2008, 10:00AM-11:00AM PST (Pacific Standard Time)
Thursday, Jan 31st, 2008, 1:00PM-2:00PM EST (Eastern Standard Time)
Click to register or copy the following url:
https://audiocodes-training.webex.com/audiocodes-training/k2/j.php?ED=2253242&UID=995196892&FM=1

cu there !

Office Communications Server 2007 Resource Kit

This must have and long-awaited book by Jeremy Buch, Rui Maximo and Jochen Kunert has now published. I know two of the authors and have seen some of the chapters including the OCS 2007 Resource Kit Sample Chapters published back in August and they are certainly worth reading for anyone who wants to go deeper than the wizards in OCS (Personally I learn best by reading, so I love these deep-dive resource kits).

There is one gotcha though that I saw some time ago. If you follow the Amazon link from MSPress on then you will end here -

image

It has a SRP of $59.99 and is already discounted to $35.99, which is not bad at all. But as you see in the top there's a small link to shopping at Amazon.co.uk (Which is interesting to save shipping costs), resulting in the following -

image

the SRP is only discounted with 5% instead of 40% resulting in a total pricing that is doubled to approx $71,00 (With the normal overpricing we always pay on US books that have pricing in €/£/$) - Not good enough Amazon !

Anyway I have been promised a free copy of the book, but if you are out to buy one then watch out (And do consider shipping from US as a viable option).

Thursday, January 17, 2008

Group Policy Diagnostic Best Practice Analyzer

A new kid is in down: GPDBPA. Give it a spin and see if your Group Policies and associated infrastructure are in shape. Find it at MS Downloads using this search.

Thursday, January 03, 2008

A simple and clever way to create a custom object

In BS on Posh I found a simple and clever way to creating a custom object. Personally, I have been using one of these method -

$obj=New-Object object

Add-Member -InputObject $obj NoteProperty Column1 $null

Add-Member -InputObject $obj NoteProperty Column2 $null

Add-Member -InputObject $obj NoteProperty Column3 $null

$obj.Column1="Value1"

$obj.Column2="Value2"

$obj.Column3="Value3"

or -

$obj=1 | Select-Object @{Name="Column1";Expression={$null}},`

@{Name="Column2";Expression={$null}},`

@{Name="Column3";Expression={$null}}

$obj.Column1="Value1"

$obj.Column2="Value2"

$obj.Column3="Value3"

As BS shows in Using Switch -RegEx to create Custom Object (Getting HBA Info), you can do it much simpler -

$obj="" | Select-Object Column1,Column2,Column3

$obj.Column1="Value1"

$obj.Column2="Value2"

$obj.Column3="Value3"

I am aware that you can assign a value to the columns in the first two methods directly and thus make that code shorter. But typically, this construct is used in a loop and you often do not have the column values directly available. In these cases, the elegant Select-Object Column1,Colum2,Column3 is preferable.

A warning

Do not get trapped by using this construct/pattern -

function DoubleNumbersTest {

    $obj="" | Select-Object Number,DoubleNumber

    1..10 | % {

        $obj.Number=$_

        $obj.DoubleNumber=$_*2

        $obj

    }

}

When you look at the output, it may seem fine, but if you use the output objects for something, you will realize, that you in fact only have a single object. An object must be created for each output. Try it yourself -

DoubleNumbersTest # seems fine

$numbers=DoubleNumbersTest

$numbers # what a strange output ;)

6 tips for reducing e-mail overload

New Year - a happy one I hope for all of you reading this - is often a time of year used to consider whether old habits should be changed.

I found this article very inspiring and I hope you will as well. Spent the few minutes it takes to read it and let us all help in using email as the productivity tool it is.

 

Lately, more people are declaring bankruptcy. No, they’re not financially insolvent. They just can’t keep up with e-mail. They empty their inbox, announce e-mail bankruptcy, and start over from scratch.

Don’t let it happen to you. Get a grip on the problem before it is too late.

Continue...