|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
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).
|
|
#2
|
|||
|
|||
|
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 |
|
#3
|
||||
|
||||
|
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. |
|
#4
|
|||
|
|||
|
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.
|
|
#5
|
||||
|
||||
|
Code:
<%
Dim objNTInfo
Set objNTInfo = CreateObject("WinNTSystemInfo")
GetComputerName = lcase(objNTInfo.ComputerName)
Response.Write "Hostname = " & GetComputerName
%>
Thanks for your help Doug! :)
|
|
#6
|
||||
|
||||
|
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
|
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Finding Hostname Through VBScript |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|