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

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,245 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Lan Huang-MSFT 25,386 Reputation points Microsoft Vendor
    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