PeterHing
asked on
Retreive Computer Name - VBScript / ASP
Hi All,
Can anyone explain why when I put this code (found on another post) into my page, nothing happens?
<script language="VBScript">
Set oNetwork = CreateObject("WScript.Netw ork")
sUserName = oNetwork.UserName
sComputerName = oNetwork.ComputerName
MsgBox("UserName = " & sUserName & vbCRLF & "ComputerName = " & sComputername)
</script>
Many Thanks,
Pete
Can anyone explain why when I put this code (found on another post) into my page, nothing happens?
<script language="VBScript">
Set oNetwork = CreateObject("WScript.Netw
sUserName = oNetwork.UserName
sComputerName = oNetwork.ComputerName
MsgBox("UserName = " & sUserName & vbCRLF & "ComputerName = " & sComputername)
</script>
Many Thanks,
Pete
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry, missed the comment posting, lsavidge is correct. If you want to shorthand the split/(0) lines into one:
<%
sComputerFQDN = "PCName.uk.companyname.int ranet"
sComputerHostname = split(sComputerFQDN, ".")(0)
%>
I am glad it worked well for you.
<%
sComputerFQDN = "PCName.uk.companyname.int
sComputerHostname = split(sComputerFQDN, ".")(0)
%>
I am glad it worked well for you.
Thanks for the question and the points.
ASKER
Perfect - Thanks for that - As it now works perfectly - However, the results come back as
PCName.uk.companyname.intr
Is there a way I can split it down so it just shows the PC Name?
(Points Increased to 300)