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: , , , ,

8 Responses to “We need namespaces!”


  1. 1 kirkamunro September 28, 2007 at 5:26 pm

    Hi Dmitry,

    Don’t forget to vote for your own suggestion on Microsoft Connect by giving it 5 stars!

    Kirk out.
    http://poshoholic.com

  2. 2 dmitrysotnikov September 28, 2007 at 5:32 pm

    Will they know it’s me?😉

  3. 3 kirkamunro September 29, 2007 at 1:03 am

    I honestly don’t know. I just noticed that I could give myself a star rating once per post, so naturally my posts always start out with a 5 star rating! h)

  4. 4 Andrei October 1, 2007 at 10:59 am

    I’m receiving Page Not Found when following the link to Microsoft Connect (after logging in with my Live Passport account):

    Page Not Found

    The content that you requested cannot be found or you do not have permission to view it.

    If you believe you have reached this page in error, click the Contact Us link at the bottom of the page to report the issue and include this ID in your e-mail: 91210b01-d538-477f-9851-f86580d017b3

    Microsoft Connect welcome page.

  5. 5 dmitrysotnikov October 1, 2007 at 11:24 am

    Please try again: I’ve just followed the link and could get to the page with no problem.

    It did make me log in though so I am guessing that it might have not let you in because you were not on the PowerShell program (tough new rules so Kirk can no longer cheat on his CRs? ;))

    Could you go to My Participation and ensure that Windows PowerShell is in the list?

    If it is not, please go to Available Connections and sign-up for PowerShell.

    Once you get onto the PowerShell program please try again to go and vote for the CR. The more votes we get the bigger are the chances to get this one through.

  6. 6 kirkamunro October 1, 2007 at 1:18 pm

    Cheat on my CRs? I’m not cheating. I’m just positively reinforcing the need to fix the issues…😉

  7. 7 Per Østergaard October 21, 2007 at 7:20 am

    Hi

    Actually, I’m against the idea of using namespaces – I think the right direction is to use a provider. In this way, only a very few cmdlets needs to exists and this would speed up user’s work. Why should I have a Get-Mailbox when I already know how to get an object with Get-Item – just give me a location of e.g. Exchange:\Mailboxes.


  1. 1 Citrix’s inconsistent cmdlets naming « Dmitry’s PowerBlog: PowerShell and beyond Trackback on March 16, 2009 at 12:45 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




My Recent Tweets

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
« Aug   Oct »
 12
3456789
10111213141516
17181920212223
24252627282930

%d bloggers like this: