This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Replace Hardcoded Computer Name (Fully Qualified)
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 12, 2011
03:40 AM
Replace Hardcoded Computer Name (Fully Qualified)
Hi, I have an MSI that I want to change a hardcoded computername in three registry keys.
The MSI was created with AdminStudio (9.5)
The three keys are formatted such as:
computername.domain.com
computername
\\computername.domain.com\folder
I believe I should be able to change the actual hardcoded name with [ComputerName] to give the short name, but how do I capture the fully-qualified computer name during install??
Regards,
Nick
The MSI was created with AdminStudio (9.5)
The three keys are formatted such as:
computername.domain.com
computername
\\computername.domain.com\folder
I believe I should be able to change the actual hardcoded name with [ComputerName] to give the short name, but how do I capture the fully-qualified computer name during install??
Regards,
Nick
(4) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 16, 2012
12:03 PM
Hi Nick,
I have the same issue as yours. Just wondering If you have found any solution to this.
I tried to change keys as
%COMPUTERNAME%.%USERDNSDOMAIN%
%COMPUTERNAME%
\\%COMPUTERNAME%.%USERDNSDOMAIN%\folder
Even tried square brackets instead of '%' like [COMPUTERNAME], but not successful. It just gives the same value instead of pulling the current computer name.
If you have find the solution for this issue Please reply me.
Thanks and Regards,
Smitha
I have the same issue as yours. Just wondering If you have found any solution to this.
I tried to change keys as
%COMPUTERNAME%.%USERDNSDOMAIN%
%COMPUTERNAME%
\\%COMPUTERNAME%.%USERDNSDOMAIN%\folder
Even tried square brackets instead of '%' like [COMPUTERNAME], but not successful. It just gives the same value instead of pulling the current computer name.
If you have find the solution for this issue Please reply me.
Thanks and Regards,
Smitha
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 16, 2012
12:35 PM
In Windows Installer, you can use [%VARNAME] to expand the value of an environment variable at run time.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 16, 2012
08:43 PM
Thank you Robert
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 21, 2012
09:01 AM
If this helps anyone, because I was in the same boat looking for computer name, here are the prototypes and the function I created to do this. I call this custom action before the PatchWelcome call in the UI path.
export prototype SetComputerName(HWND);
prototype BOOL KERNEL32.GetComputerName(BYREF STRING, BYREF NUMBER);
prototype BOOL KERNEL32.GetComputerNameEx(NUMBER, BYREF STRING, BYREF NUMBER);
//Function Definitions
//---------------------------------------------------------------------------------------//
function SetComputerName(hWND)
//Desclare local variable
NUMBER result, computerNameFormat, size;
STRING computerName;
//CODE NOTE:
//The difference between the two calls is that the GetComputerName function doesnt include
//the domain portion of the NetBIOS name of the machine running the installation.
begin
//Set the fully qualified computer name for the Web Host Name
size = 255;
computerNameFormat = 3; //Enumeration value to determine which name to return. See COMPUTER_NAME_FORMAT in the MSDN
result = GetComputerNameEx(computerNameFormat, computerName, size);
result = MsiSetProperty(hWND, "FULL_COMPUTER_NAME", computerName);
//Set the comuter name to represent the SQL Server instance name
result = GetComputerName(computerName, size);
result = MsiSetProperty(hWND, "SHORT_COMPUTER_NAME", computerName);
end;
export prototype SetComputerName(HWND);
prototype BOOL KERNEL32.GetComputerName(BYREF STRING, BYREF NUMBER);
prototype BOOL KERNEL32.GetComputerNameEx(NUMBER, BYREF STRING, BYREF NUMBER);
//Function Definitions
//---------------------------------------------------------------------------------------//
function SetComputerName(hWND)
//Desclare local variable
NUMBER result, computerNameFormat, size;
STRING computerName;
//CODE NOTE:
//The difference between the two calls is that the GetComputerName function doesnt include
//the domain portion of the NetBIOS name of the machine running the installation.
begin
//Set the fully qualified computer name for the Web Host Name
size = 255;
computerNameFormat = 3; //Enumeration value to determine which name to return. See COMPUTER_NAME_FORMAT in the MSDN
result = GetComputerNameEx(computerNameFormat, computerName, size);
result = MsiSetProperty(hWND, "FULL_COMPUTER_NAME", computerName);
//Set the comuter name to represent the SQL Server instance name
result = GetComputerName(computerName, size);
result = MsiSetProperty(hWND, "SHORT_COMPUTER_NAME", computerName);
end;
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)