how to show client computer name wiht vbscript

Mayhan28 1 Reputation point
2022-08-05T06:57:08.373+00:00

i use iis wiht asp page in my computer. i want to show client computer name.
I need vbscript code that shows client computer name.
Thanks

Developer technologies ASP.NET Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Lan Huang-MSFT 30,186 Reputation points Microsoft External Staff
    2022-08-05T08:43:17.877+00:00

    Hi @Mayhan28 ,
    You can refer to the code below for how to retrieve the computer name using various scripting techniques, you can refer to this link for details.
    https://www.robvanderwoude.com/vbstech_network_names_computer.php
    Environment Variable

    Set wshShell = CreateObject( "WScript.Shell" )  
    strComputerName = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )  
    WScript.Echo "Computer Name: " & strComputerName  
    

    SHGINA.DLL (Shell.LocalMachine)

    Set objPC = CreateObject( "Shell.LocalMachine" )  
    strComputerName = objPC.MachineName  
    WScript.Echo "Computer Name: " & strComputerName  
    

    System Scripting Runtime

    Set objLM = CreateObject( "SScripting.LMNetwork" )  
    strComputerName = objLM.ComputerName  
    WScript.Echo "Computer Name: " & ComputerName  
    

    Best regards,
    Lan Huang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.