' ************************************************************** ' Функция nslookup для пакета VBS ' Используется для получения имени компьютера по его IP адресу ' Возвращает имя, если удалось его получить командой nslookup ' ************************************************************** Function nslookup(IP) On Error Resume Next With fso Do strTempFile = .BuildPath(.GetSpecialFolder(2), .GetTempName) Loop While .FileExists(strTempFile) strCmdLine = .BuildPath(.GetSpecialFolder(1), "nslookup.exe ") _ & IP & " > " & strTempFile End With shell.Run "%comspec% /c " & strCmdLine, 0, True Set objTS = fso.OpenTextFile(strTempFile, 1) With re .Pattern = "(Name:)(\s*)([\w\.\-]*)" .IgnoreCase = True .Global = False Set Matches = .Execute(objTS.ReadAll) End With If UBound(Matches) > 0 Then re.Pattern = "(Name:)(\s*)" nslookup = re.Replace(Matches(0).Value, "") End If objTS.Close fso.DeleteFile strTempFile End Function