Try/Except for ADSI GetObject

Roger Upole rupole at hotmail.com
Wed May 31 23:35:50 EDT 2006


"LittlePython" <LittlePython at lost.com> wrote in message news:al5fg.9877$ho6.1459 at trnddc07...
>I am a little confused on why I can not detect an object that does not exist
> with a try and except. If I understand ADSI correctly from what I have read
> you do not create these objects but rather get them. They already exist. I
> believe if I do the equivalent in VB I would generate an error when I try to
> get an object that does not exist (can not find).

I don't get an error when doing a GetObject in VBS
for a nonexistent domain.


What have I done wrong?
> I have included the function below that works in ever respect but detecting
> incorrect NT Domain Names (objects that do not exist) . Any tips, insight or
> comments would be welcome by this newbie.


You should be able to use win32net.NetValidateName to
verify that the domain exists before doing any more operations.

           hth
             Roger 




----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---



More information about the Python-list mailing list