Location based software installation

Started by TSFleming, February 15, 2015, 04:44:20 PM

Previous topic - Next topic

TSFleming

Iââ,¬â,,¢m trying to create a script to install software based on location, and location is determined via hostname.  Letââ,¬â,,¢s say I have 3 computer naming conventions, for this example; DT-Chicago-123, DT-London-123 & DT-Tokyo-123.  Iââ,¬â,,¢m getting the hostname from the registry and am setting a variable based on that;

HostName = RegQueryValue(@REGMACHINE, "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters[Hostname]")

Next I tried to determine which hostname was returned in order to specify what software to install;

CHI = strindexNC(HostName, "* Chicago *", 1, @fwdscan)
LON = strindexNC(HostName, "* London *", 1, @fwdscan)
TOK = strindexNC(HostName, "* Tokyo *", 1, @fwdscan)
If CHI == @TRUE then
else
If LON == @TRUE then
else
If TOK == @TRUE then

Obviously the above is incomplete/incorrect which is why Iââ,¬â,,¢m posting.  What would be easiest (correct) way to accomplish this?

Any assistance is appreciated.

stanl


TSFleming

Thanks, that seemed to have worked.  I also found that I could simply use the following syntax to get the desired results;

If strindexNC(HostName, "Chicago", 1, @fwdscan) then
If strindexNC(HostName, "London", 1, @fwdscan) then
If strindexNC(HostName, "Tokyo", 1, @fwdscan) then

:)

stanl

Yes, that would have been the correct method if you removed the * as I suggested.