Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Retrieving the name of the computer


3 replies to this topic

erez

erez
  • Members
  • 24 posts

Posted 29 January 2002 - 08:21

Hi,

I need to get the name of the target computer during the installation. Also, how can I use a windows API function from InstallScript code?

       Thanks
                 Erez



Kurt Schneider

Kurt Schneider
  • Members
  • 98 posts

Posted 29 January 2002 - 16:24

Erez,

I got a couple lines of VBScript that outta do the trick in getting that computer name:

-------------------------------------------------
Option Explicit

Main()

Sub Main

    Dim wshNetwork
    Dim sServerName

    Set wshNetwork = CreateObject("WScript.Network")
    sServerName = wshNetwork.ComputerName

    Session.Property("YOURPROP") = sServerName

End Sub

Most OS's come with the Windows Scripting Host.  The keyword is 'Most'.  I haven't run this across any OS prior to WIn98SE.  So some investigation may be required.

Good Luck

Kurt Schneider


vrrajesh

vrrajesh
  • Members
  • 7 posts

Posted 29 January 2002 - 16:25

Check out this registry key- this might help you. Also it might be different for different OS

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ComputerName

Hpoing this might help you

Thanks,
vr


erez

erez
  • Members
  • 24 posts

Posted 29 January 2002 - 16:45

Thank you for your replies but somebody gave me the best solution: use the property [ComputerName]. It holds the name of the target machine.

   Thanks
            Erez