2008年1月30日水曜日

[VBScript]FQDNを取得

'
' FQDNを取得
'

Option Explicit

Dim oWMIService
Dim oItems
Dim oItem

Dim sComputer

sComputer = "."
Set oWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & sComputer & "\root\cimv2")
Set oItems = oWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")

For Each oItem in oItems
If (oItem.DNSHostName <> "") Then
WScript.Echo oItem.DNSHostName & "." & oItem.DNSDomain
End If
Next

Set oItem = Nothing
Set oItems = Nothing
Set oWMIService = Nothing

0 件のコメント: