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

Computer name.


3 replies to this topic

Marcia Cardoso

Marcia Cardoso
  • Members
  • 5 posts

Posted 05 October 2005 - 19:48

Hi.
I'm using the InstallShield DevStudio 9 - Install Script Project - and I don't know how to get the computer name in the InstallScript. Is there a variable or a function that return the computer name ?
Thanks.

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 06 October 2005 - 12:07

I think you can use the COMPUTERNAME environment variable.

Ozone

Ozone
  • Full Members
  • 77 posts

Posted 18 October 2005 - 22:33

Try this

NOTE: sv_COMPUTER_NAME must be defined as a Global Variable in your code.

CODE

/////////////////////////////////////////////////////////////
//
// FUNCTION:  Get_Computer_Name()
//
// PURPOSE:   Retrieve the Computer Name and place it in
//             the Global variable sv_COMPUTER_NAME
//
// LAST UPDATED: 05-02-2005 - Created - TEB
//
// Look in the registry entry below.
// HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName
//
/////////////////////////////////////////////////////////////

prototype   Get_Computer_Name(); //...........// Retreives the computer name from the registry

function Get_Computer_Name()

NUMBER nvType , nvSize;

begin
   
 // Set the Root Key
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);

if (RegDBKeyExist("SYSTEM\\CurrentControlSet\\Control\\ComputerName\\ComputerName") = 1) then  // exists
 if (RegDBGetKeyValueEx("SYSTEM\\CurrentControlSet\\Control\\ComputerName\\ComputerName" , "ComputerName" , nvType, sv_COMPUTER_NAME, nvSize ) = 0) then
  // got value
  if (StrLengthChars ( sv_COMPUTER_NAME ) < 1) then
   // No entry
   sv_COMPUTER_NAME = "No Computer Name Entry";
  endif;
 else
  // NOT got value
  sv_COMPUTER_NAME = "No Computer Name Entry";
 endif;
else
 // No entry
 sv_COMPUTER_NAME = "No Computer Name Entry";
endif;

end;



Edited by Ozone, 18 October 2005 - 22:36.


Marcia Cardoso

Marcia Cardoso
  • Members
  • 5 posts

Posted 25 October 2005 - 16:14

Thanks a lot.