Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Get Hostname of my primary DNS without DOS-Boxes

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,61051
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Get Hostname of my primary DNS without DOS-Boxes
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Get Hostname of my primary DNS without DOS-Boxes - 6/4/2008 5:38:36 PM   
  BMeX

 

Posts: 6
Score: 0
Joined: 12/10/2007
Status: offline
Hello Together!

How can I get the primary Hostname of my DNS without DOS Boxes and without administrator permissions?

KR, BMeX
 
 
Post #: 1
 
 RE: Get Hostname of my primary DNS without DOS-Boxes - 6/5/2008 12:11:44 AM   
  ebgreen


Posts: 5041
Score: 31
Joined: 7/12/2005
Status: offline
What have you tried so far?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to BMeX)
 
 
Post #: 2
 
 RE: Get Hostname of my primary DNS without DOS-Boxes - 6/5/2008 2:52:57 AM   
  ginolard


Posts: 1053
Score: 21
Joined: 8/10/2005
Status: offline
WMI can probably tell you that.  Check the properies of the Win32_NetworkAdapterConfiguration namespace.

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: Get Hostname of my primary DNS without DOS-Boxes - 6/5/2008 5:52:01 PM   
  BMeX

 

Posts: 6
Score: 0
Joined: 12/10/2007
Status: offline
Hello Everybody.

I tried with WMI, but then it gives me only the ip address. so i have to make a nslookup, where a dos box appears :-(
I tried to do an nslookup with WMI but for that i needed administrator rights? i don't know..

I know, with the command "Run" in VBS i can hide the dos box, but i have to check the return value of the command, so i have to write a file to the harddisk (nslookup ip.ip.ip.ip >C:\returnvalue.txt) and then read out. That is not what i want, becuase this should be a part of a login script.

Thanks for your help.

BR, BMeX


(in reply to ginolard)
 
 
Post #: 4
 
 RE: Get Hostname of my primary DNS without DOS-Boxes - 6/6/2008 7:31:53 PM   
  DiGiTAL.SkReAM


Posts: 1184
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
do a run like this:
oShell.Run "%comspec% /c nslookup ip.ip.ip.ip > c:\output.txt",0,true

Then:
read that file's contents into a variable

sText = oFSO.OpenTextFile("c:\output.txt",1).ReadAll

delete the file
parse through the sText variable to find the hostname you want.

The entire process - assuming the dns lookup goes fast - should take less than a second, even on a slow machine.



_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to BMeX)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Get Hostname of my primary DNS without DOS-Boxes Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts