Page 1 of 1
Check for Username=Computername
Posted: Thu Jan 06, 2011 2:42 am
by Balanced-Plus
Hi,
How can I check if the Windows Username is the same as the Computername?
I need to know this because SQL Server won't install if this is the case.
see:
http://dotnetfish.blogspot.com/2009/02/ ... o-not.html
Thanks,
Stef
Re: Check for Username=Computername
Posted: Thu Jan 06, 2011 2:57 am
by giaviv
Dear Stef,
In the MSIcode tab, you will find a "Get System Settings" command (under "System Information"). You will then select the "Logged on User Name" capability and insert the result into variable X. Do the same for capability "Logged on Computer Name" and put it in variable Y. All you need to do now is check if X equals Y.
Good luck!
Aviv Giladi
InstallAware Support
Re: Check for Username=Computername
Posted: Thu Jan 06, 2011 3:18 am
by Balanced-Plus
Thank you. It works perfectly.
Code: Select all
Set Variable MY_USERNAME to UNKNOWN
Set Variable MY_COMPUTERNAME to UNKNOWN
Get System Setting Logged on User Name into MY_USERNAME
Get System Setting Logged on Computer Name into MY_COMPUTERNAME
if Variable MY_USERNAME Equals MY_COMPUTERNAME
MessageBox: $TITLE$ Setup Error, Username and Computername are equal.$NEWLINE$Please change Computername to install SQL Server.$NEWLINE$$NEWLINE$Setup cannot continue.
Terminate Installation
end
Re: Check for Username=Computername
Posted: Thu Jan 06, 2011 4:10 am
by giaviv
Dear Stef,
I'm happy that it worked out!
A small note though - you don't need the "Set Variable MY_USERNAME to UNKNOWN":
Variables must be explicitly declared before they can be used in If commands, dialog boxes, or plug-in actions. Commands that write to variables automatically declare them, as long as the command is not dependent on the input value of the variable.
Thank you for your interest in InstallAware,
Aviv Giladi
InstallAware Support
Re: Check for Username=Computername
Posted: Thu Jan 06, 2011 4:26 am
by Balanced-Plus
So probably I won't need this line either.
Set Variable MY_COMPUTERNAME to UNKNOWN
One reason I declared them, is that you can select the variable from a list. Otherwise you have to enter them manually (could easy result in typos).