RC2 is out and we have a new type alias [ADSI] for dealing with DirectoryEntry objects in AD, but inexplicably (at least to me), we’ve lost all the methods associated with that class unless you change everything to use psbase.
So instead of saying something like
PS>$Entry = New-Object DirectoryServices.DirectoryEntry (“LDAP://dc=domain,dc=com”)
I can say
PS>$Entry = [ADSI] “LDAP://dc=domain,dc=com”
But instead of saying
I have to say
And a fair amount of working code no longer works.
I don’t pretend to understand the discussion on the newsgroup about “adapting” and why using psbase is better than before. So in the spirit of PowerShell, I’ve just extended the type definition for DirectoryEntry so that I can still use the previous code.
For each of the previous methods for DirectoryEntry, I’ve added a ScriptMethod. So for example,
allows me to continue to use
without the psbase “layer”.
This also allows previous code like MoW’s
to work again. I haven’t tested these definitions thoroughly so YMMV, but if you’d like to try them out, please help yourself to a copy of them. Comments are always welcome also.