Archive for September 28th, 2007

We need namespaces!

OK, time for another PowerShell v2 feature request: we need namespaces.

Right now, if we call AD cmdlets getting user objects Get-User and this snapin gets installed on the box which already has Exchange 2007 management tools which also have Get-User – my scripts stop working.

What I would like to have (please) is some kind of using construct which would make the snapin name I supply default for subsequent name resolution. And of course at any time I should be able to use the full name to disambiguate. This is the PowerShell code I would like to supply in v2 era:

#the statement below makes the specified snapin default for name resolution
using Quest.ActiveRoles.ADManagement

Get-User "Dmitry Sotnikov" | Set-User -city “St. Petersburg” #AD snapin is used
new-group qdl.powershell #AD snapin used

#the command below is explicitly using Exchange 2007 new-mailbox
Microsoft.Exchange.Management.PowerShell.Admin\new-mailbox conf234 | ForEach-Object {

#This is using AD again
set-user –Description “Created by Exchange”

}

This will remove the necessity to prefix each noun (which Kirk opposes and for a good reason), and does not require everyone to create custom namespace management functions (like Antonio is doing) which don’t work for all scenarios and are not present on each workstation out there anyway so the scripts you publish in the internet don’t necessarily work, people have to copy-paste 2-line function just to run your one-liner, etc.

I think this kind of namespace support is something PowerShell team absolutely needs to provide in v2 or things will start getting really confusing very soon: even just at Microsoft how many products have some kind of notion of users, sites, computers, etc. We are on a collision course here.

I’ve submitted this to Microsoft Connect: https://connect.microsoft.com/feedback/ViewFeedback.aspx?FeedbackID=301052&SiteID=99 – feel free to vote for the CR over there.

Tags: , , , ,

Advertisement

Legal

The posts on this blog are provided “as is” with no warranties and confer no rights. The opinions expressed on this site are mine and mine alone, and do not necessarily represent those of my employer - WSO2 or anyone else for that matter. All trademarks acknowledged.

© 2007-2014 Dmitry Sotnikov

September 2007
M T W T F S S
 12
3456789
10111213141516
17181920212223
24252627282930

%d bloggers like this: