/\/\o\/\/ PowerShelled

This blog has moved to http://ThePowerShellGuy.com Greetings /\/\o\/\/
$AtomFeed = ("Atom.xml")
$PreviousItems = (" PowerShell : Hosting IronPython "," PowerShell RC2 and Active Directory "," PowerShell : Using IronPython to Connect to AD and... "," PowerShell Session video of Bruce Payette "," PowerShell : Active Directory Part 11 - moving - R... "," PowerShell : Learn about the HashTable Object and ... "," PowerShell : Setting SendAs permission in Exchange... "," PowerShell : Active Directory Part 10 (AD Browser) "," PowerShell "," PowerShell : How Do I randomize a list, and remove... "," ")

Friday, September 29, 2006

 


PowerShell RC2 and Active Directory Part 2



As Active Directory management from PowerShell is very important to me in my daily work as I do all AD, SMS and MOM management from PowerShell as well as some of the others in my department allready  ;-) , 

As you could see here : PowerShell RC2 and Active Directory  I do not like the Wapper added in RC2.

I have a lot if discussions about it ,

in the NewsGroup (Yes Finaly Google has Indexed the PowerShell NG )

AD access change/break in RC2

Syntax ([ADSI] removed by google)

getting COM properties . ([ADSI] removed by google)

ADSI - AD access changes/issues in RC2

and on IRC , there I got this remark :,

<dreeschkind> guys, you need to vote if you want to achieve anything
<dreeschkind> https://connect.microsoft.com/feedback/ViewFeedback.aspx?FeedbackID=213764&SiteID=99

  And ofcourse did add a 5 ;-)

 

In the Newsgroup Threads Aruk Kumaravel explains a bit more about the wrapper and about the methods added (hidden),

Create
Put
Set
PutEx
SetEx
GetInfo
SetInfo

and he has also some examples on his blog using the new wrapper :

http://blogs.msdn.com/arulk/archive/2006/07/25/678137.aspx

 http://blogs.msdn.com/arulk/archive/2006/07/28/682289.aspx

 http://blogs.msdn.com/arulk/archive/2006/08/24/719241.aspx

 

Most people I did hear so far that are using PoSH for AD do not like it,  and the questions on the NGm

also  ofcourse I did,some more comparing and testing  also, here you see some examples of the differences added by the wrapper :

Note that PsBase has no Tabcompletion.

 

# Old

$user.rename('cn=mow')

$root.invoke('MoveHere','LDAP://CN=mow,OU=MowOu,DC=mow,DC=local','cn=mowMoved')

# New

$user.psbase.rename('cn=mow')

$root.movehere('LDAP://CN=FooBar,DC=mow,DC=local','cn=FooMoved')

# New (not working )

([adsi]'LDAP://CN=FooMoved,DC=mow,DC=local').'AccountDisabled'
([adsi]'LDAP://CN=FooMoved,DC=mow,DC=local').get('AccountDisabled')

# Old way ( works ) :

([adsi]'LDAP://CN=FooMoved,DC=mow,DC=local').psbase.invokeget('AccountDisabled')

 

 

as you could see here  :  PowerShell and Active Directory Part 3 (UserProperties) , (last part of post) the ADSI COM Object has some added Method Properties, for a list see : Interface Property Methods. on MSDN

I do not know how to do it yet using the wrapper, (see last NG thread [ADSI]  getting COM properties . )

 

PS C:\PowerShell> ([adsi]'LDAP://CN=FooMoved,DC=mow,DC=local').'AccountDisabled'
PS C:\PowerShell> ([adsi]'LDAP://CN=FooMoved,DC=mow,DC=local').get('AccountDisabled')
Exception calling "get" with "1" argument(s): "The directory property cannot be found in the cache.
"
At line:1 char:49
+ ([adsi]'LDAP://CN=FooMoved,DC=mow,DC=local').get( <<<< 'AccountDisabled')

PS C:\PowerShell>
PS C:\PowerShell> # Old way (works):
PS C:\PowerShell>
PS C:\PowerShell> ([adsi]'LDAP://CN=FooMoved,DC=mow,DC=local').psbase.invokeget('AccountDisabled')
True

As I have almost 1500 readers of the first post of the series PowerShel and Active Directory Part 1  , and 626 that came to  PowerShell and Active Directory Part 3 (UserProperties) ,  so if you have done that start (and did read the NG threads), you have experince with the process and can give valuable feedback,   

Do you think is more easy to get started with Active Directory in PowerShell  in RC1 or RC2 ?

As that was the main goal of this change I think.

 please Vote : https://connect.microsoft.com/feedback/ViewFeedback.aspx?FeedbackID=213764&SiteID=99

or join the discussion in the microsoft.public.windows.powershell NewsGroup 

Let know what you think !,

(OK sorry one more complaint ;-) )

I still think that for this little value  that.emulating VbScript  this wrapper does add for someone starting with PowerShell (when he is coming from VbScript, and knowing all the  Methods by Head  ;-) ) ,

This wrapper does to much concessions to the usability of PowerShell  for more advanced administrator tasks, for using /converting all examples in other .NET languages (C#,IronPyhon,VB.NET,PowerShell), Developers to use PowerShell as a Tool , or to glide to a making a CmdLet , and it is very confusing, making exploring and Learning harder.

I think  the way forward, using the Framework, is the best way , see also all changes in .NET2.0 for managing AD infrastructure : /\/\o\/\/ PowerShelled: AD Infrastructure exploring with MSH  (AD is managed by admin's, not by end-users )  , as you could see in the Part 3of the series, and the example in this post, it is already easy enough to get to those Hidden Methods added by the wrapper, and we have best of both worlds. 

Also Get-Member is one of the most used and important commands in PowerShell , and in exploring Objects , and we have to be able to trust it to be consistent and complete, as it is one of our eyes into the PowerShell World. 

So I think that hiding important information from it, for some also hidden added methods is the wrong way to go on the glidepath, and I see almost nothing for it in return, as for typing PSBase.

End of campain !

 

Enjoy,

Greetings, /\/\o\/\/

Tags : Monad  PowerShell




Comments:
Anonymous Anonymous
I have to wonder now about what form the MMC generated code is going to take, and if this is the philosophy they're going to follow what does that mean for the promised AD Provider in V2.
 
Blogger /\/\o\/\/
Yep,
I did add a Vote to your Connect item.
As I like the new WMI support, but hate the ADSI one I realy have a dillema ;-)

Greetings /\/\o\/\/
 
Anonymous Anonymous
I reported it as a bug before I found out this was "by design". The explanation that this made it more "vbscript-like" didn't make much sense to me. Why would that be an advantage, or even be in line with the Powershell "philosophy"? Beyond that it seems to add an additional abstraction layer on top of .NET. If this is what they're going to use for the MMC generated code then it seems counter productive to the stated objective having the MMC generated code as a tool to "teach you the .NET framework".
 
Post a Comment



<< Home

Archives

October 2005   November 2005   December 2005   January 2006   February 2006   March 2006   April 2006   May 2006   June 2006   July 2006   August 2006   September 2006   October 2006   November 2006   December 2006  

$Links = ("PowerShell RC1 Docs"," PowerShell RC1 X86"," PowerShell RC1 X64"," Monad GettingStarted guide"," Monad Progamming Guide"," Monad SDK"," Monad videos on Channel 9"," MSH Community Workspace"," scripts.readify.net "," MonadSource"," www.reskit.net"," PowerShell Blog"," Under The Stairs"," computerperformance powershell Home"," proudlyserving"," MSH on wikipedia"," MSHWiki Channel 9"," Keith Hill's Blog"," Precision Computing"," PowerShell for fun"," MSH Memo (Japanese)"," monadblog")

find-blog -about "PowerShell","Monad" | out-Technorati.
find-blog -contains "","" | out-Technorati.
Google
 
Web mow001.blogspot.com

This page is powered by Blogger. Isn't yours?