ExtensionAttribute15 [英] ExtensionAttribute15

查看:159
本文介绍了ExtensionAttribute15的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以解释一下如何从AD中的计算机帐户中提取extensionattribute15 的值.

我的代码看起来像这样:

Can someone please explain how I can extract the value of extensionattribute15 from a computer account in AD.

My code looks a bit like this:

Public Function funGetWorkstation(ByVal strWorkstationID As String)
    
Dim dirEntry As New DirectoryEntry("LDAP://RootDSE")
    
Dim strRoot As String = "LDAP://(My Network);
    
dirEntry = New DirectoryEntry(strRoot)

    Dim mySearch As DirectorySearcher = New DirectorySearcher(dirEntry)

    mySearch.Filter = "(&(ObjectClass=computer)(CN=" & strWorkstationID & "))"

    Try
        For Each workstation As SearchResult In mySearch.FindAll()

            Dim strWSObject = workstation.GetDirectoryEntry

            Dim strOU = strWSObject.Parent.Parent.Name.ToString

            Dim strOffice = strWSObject.Parent.Parent.Parent.Name.ToString

            TextBox2.Text = Microsoft.VisualBasic.Mid(strOU, 4)

            TextBox4.Text = Microsoft.VisualBasic.Mid(strOffice, 4)
        Next

    Catch ex As Exception

        MsgBox("It didnt work")

    End Try

    Return True

End Function



所有这些工作正常,我无法管理的是在strWSObject 中找到ExtensionAttributes ,或者如果默认情况下不提取它们,我该如何去提取它们.

谢谢.



All this bit works, what I can''t manage to do is find the ExtensionAttributes within strWSObject or how I can go about extracting them if they''re not by default.

Thanks.

推荐答案

没关系,我已经弄清楚了,只需要添加这一行即可.

It''s ok, I''ve figured it out, just needed to add this line.

Dim ext1 = strWSObject.Properties("extensionattribute15").Value 




感谢您的关注.




Thanks for looking.


这篇关于ExtensionAttribute15的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆