[ADSI] getting COM properties .

7 views
Skip to first unread message

/\/\o\/\/ [MVP]

unread,
Sep 29, 2006, 12:36:56 PM9/29/06
to
An other example , getting AccountDisabled :

how can I do this using the new wrapper ?

(as I was thinking about getting this directly as a first thing that would
make it less bad, but again I was dissapointed, please show I did miss
something here !! .)

I discussed how I did like this, and I happy I was with it (best of Both
worlds) here :

http://mow001.blogspot.com/2006/07/powershell-and-active-directory-part-3.html

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 ofcourse :
PS C:\PowerShell>
PS C:\PowerShell>
([adsi]'LDAP://CN=FooMoved,DC=mow,DC=local').psbase.invokeget('AccountDisabled')
True

After this experiense I had good hope (Note I still like the first (RC1)
solution more as I have Tabcompletion on it),
and MoveHere does ofcourse not show up in tabcompletion, without that the
gain is minimal.

# 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')

Hence again I'm not convinced, this is good and the get() is more limeted
as the InvokeGet it seems, so admins coming from VbScript think they have to
use accountcontrol bits


Greetings /\/\o\/\/


Reply all
Reply to author
Forward
0 new messages