Active directory VBS to VB



嗨,我需要将VBS脚本重写为VB文件,但我在以下方面遇到了问题。

在VBS中有这样一个:

Set OU = GetObject(LDAP_Path)
OU.Filter = Array("OrganizationalUnit")
For Each Item In OU
Description_OU = CStr(Item.Get("Description")) //Here is problem
...

在VB(2010)中,我使用"System.DirectoryServices",因为我需要使用Active Directory

我的问题:

Description_OU有时是空的,我如何在VB中测试它,其中Item是:

Dim Item = System.DirectoryServices.DirectoryEntry

换句话说:我在.DirectoryEntry中找不到类似"Description"的内容

感谢

Item.Property("Description")(0).tostring

"Description"=键

最新更新