Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old December 15th, 2005, 08:29 AM
PhilCollins99's Avatar
PhilCollins99 PhilCollins99 is offline
The Constant Student
ASP Free Novice (500 - 999 posts)
 
Join Date: Aug 2004
Location: England
Posts: 914 PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level)PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level)PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level)PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level)PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level)PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 5 h 42 m 36 sec
Reputation Power: 28
Finding Hostname Through VBScript

Hi,

I think this is a simple one.

I'm using a WSHShell and I would like to know what command I can put into my .vbs file to find the hostname of the computer I am working on.

Please can anyone help?

Thank you.

Phil.
__________________
- Post your code
- Post your errors
- Be clear
- Be courteous
PLEASE...Finalise your thread with a solution or confirmation that the last advice worked or failed (We are here to help each other).

Reply With Quote
  #2  
Old December 17th, 2005, 08:54 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 29 m 58 sec
Reputation Power: 181
I know you can do this but sorry, I don't know how.
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #3  
Old December 18th, 2005, 05:00 AM
PhilCollins99's Avatar
PhilCollins99 PhilCollins99 is offline
The Constant Student
ASP Free Novice (500 - 999 posts)
 
Join Date: Aug 2004
Location: England
Posts: 914 PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level)PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level)PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level)PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level)PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level)PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 5 h 42 m 36 sec
Reputation Power: 28
Thanks Doug.

I've searched Google high and low and can't find it. I reckon if I leave it a week or so and try again I'll be a little more prosperous.

I'm thinking it might not be as simple as a single line and that I might have to use ping -a localhost and use the output or something like that. If of course that is possible.

Thanks for the reply Doug. I hope you have great Christmas and New Year.

Phil.

Reply With Quote
  #4  
Old December 18th, 2005, 09:07 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 29 m 58 sec
Reputation Power: 181
Try looking for using windows automation, wmi, adsi, stuff like that. I know you can refer to Active Directory information from asp code. For example, the Snitz asp forums support using the windows login user information directly for a user.
Comments on this post
PhilCollins99 agrees: Got me going in the right direction. Thank you.

Reply With Quote
  #5  
Old January 6th, 2006, 08:23 AM
PhilCollins99's Avatar
PhilCollins99 PhilCollins99 is offline
The Constant Student
ASP Free Novice (500 - 999 posts)
 
Join Date: Aug 2004
Location: England
Posts: 914 PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level)PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level)PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level)PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level)PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level)PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 5 h 42 m 36 sec
Reputation Power: 28
Code:
<%

Dim objNTInfo
Set objNTInfo = CreateObject("WinNTSystemInfo")

GetComputerName = lcase(objNTInfo.ComputerName)
Response.Write "Hostname = " & GetComputerName

%>

Thanks for your help Doug!  :) 

Reply With Quote
  #6  
Old January 6th, 2006, 10:08 AM
PhilCollins99's Avatar
PhilCollins99 PhilCollins99 is offline
The Constant Student
ASP Free Novice (500 - 999 posts)
 
Join Date: Aug 2004
Location: England
Posts: 914 PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level)PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level)PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level)PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level)PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level)PhilCollins99 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 5 h 42 m 36 sec
Reputation Power: 28
The whole script! (I forgot I was looking at .vbs and not .asp)
Code:
	Option Explicit

	Dim WSHShell
	Dim objNTInfo
	Dim GetComputerName

	Set objNTInfo = CreateObject("WinNTSystemInfo")
	GetComputerName = lcase(objNTInfo.ComputerName)

	Set WSHShell = WScript.CreateObject("WScript.Shell")
	WSHShell.Popup(GetComputerName)
	
	WScript.Quit

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Finding Hostname Through VBScript


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT