VBScript Function GetCompName Set objNetwork = CreateObject("WScript.Network") ComputerName = objNetwork.ComputerName GetCompName = ComputerName End Function InstallScript function STRING GetCompName() STRING szKey, szName, svValue; NUMBER nvSize, nvType; begin szKey = "System\\CurrentControlSet\\Control\\ComputerName\\ComputerName"; szName = "ComputerName"; // Set the default root. RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE); // Retrieve the registry key value. RegDBGetKeyValueEx(szKey, szName, nvType, svValue, nvSize); return svValue; end;
November 18, 2009
Reading ComputerName - VBScript & InstallScript Samples
Often we have a requirement to read the target computer name to update INI / config file etc., and this article discuss the different ways to read the Computer Name in Script, which can be used within any installer.
Labels:
InstallScript,
Scripting,
VBScript
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment