Diese kleine Funktion ermittelt den PDC
Function GetPDCInfo() As String
Dim objNTSysInfo As Object
Dim str As New System.Text.StringBuilder
Try
objNTSysInfo = CreateObject("WinNTSystemInfo")
With objNTSysInfo
str.AppendLine("Computername:" & vbTab & .ComputerName)
str.AppendLine("Domain-Name:" & vbTab & .DomainName)
str.AppendLine("User-Name:" & vbTab & .UserName)
str.AppendLine("PDC:" & vbTab & vbTab & .PDC)
End With
Catch ex As Exception
str.AppendLine("Kein PDC verfügbar, System vermutl. kein Domänenmitglied")
End Try
Return str.ToString
End Function
1 Kommentare zum Snippet