【发布时间】:2011-05-20 14:03:15
【问题描述】:
我有以下代码,因此用户可以在程序运行之前输入他们的域。 生成的文本文件不输出用户..只是单词 Schema...
编辑 1:更新以包含所有代码。我现在可以运行它,它会返回一个文本文件,其中列出 OU=_USERS OU=_GROUPS OU=_ETC ETC ETC
Sub PrintUserNames()
'Declare Command
Dim de As New DirectoryEntry()
'Nameint Place to Write file
Dim userFile As String = "C:\DomainUsers.txt"
Dim fileExists As Boolean = File.Exists(userFile)
'Use Input Box for domain entry
Dim message, Title, defaultValue As String
Dim myValue As Object
message = "Enter your Domain Name"
Title = "Domain Name Entry"
defaultValue = "Enter Domain Name"
myValue = InputBox(message, Title, defaultValue)
'Get List of all users on Domain using WinNT
'Replacement Command
Dim ReplaceCommand1 As String = de.Path.Replace("***", myValue) = "WinNT://""***"""
Using sw As New StreamWriter(File.Open(userFile, FileMode.OpenOrCreate))
For Each d As DirectoryEntry In de.Children()
sw.WriteLine(d.Name)
Next
End Using
【问题讨论】:
-
编辑以反映广告信息
标签: vb.net visual-studio-2010 active-directory