A new Flexera Community experience is coming on November 25th, click here for more information.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Need help converting batch file process into existing MSI

Hello,

Newbie here needing some AdminStudio help. I’m not even sure where to get started.

I have a process that runs in a batch file that seeks out an IP address for a server. So after the current MSI installs, the below process runs to identify the IP and then places it in the registry. We’re moving this process to group policy and I need help understanding how to build/add this functionality into the existing msi. Or create a new one? Anyone have some ideas or directions? 🙂


for /f "tokens=1-2" %%i in ('nslookup %computername% 192.168.xxx.xxx ^| findstr /N Address ^| findstr /V 192.168.xxx.xxx') do set IP=%%j

reg add "HKLM\Software\InterSect Alliance\AuditService\Config" /v ClientName /t REG_SZ /d %IP% /f
pause


Thank you in advance… 🙂
(7) Replies
Can't you use dns and put the fully qualified name in the package?
Tony_Toni_Tone wrote:
Can't you use dns and put the fully qualified name in the package?

We wont actually know the name/ip until the package runs, so thats why we need nslookup to find it.
I thought you were getting the ip address of a server on the network and then adding that servers IP address to the workstations registry?

Are there multiple servers?
Tony_Toni_Tone wrote:
I thought you were getting the ip address of a server on the network and then adding that servers IP address to the workstations registry?

Are there multiple servers?

This will run via group policy on every new server that comes online. Since we wont know the name of the server until that time, we're using nslookup to bounce off the App Server and return the value of the New Server ip. That ip then gets written to the New Server registry.
Hope that makes sense. I imagine there are many ways to do this process and i'm open to easier methods, but thats how the package was originally set up.

Thanks,
So you just need to write the ip address into the registry of the server the package is being installed on.. the %computername% in nslookup threw me..

if I have understood correctly you could add this script stored in a custom action

Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT IPAddress FROM Win32_NetworkAdapterConfiguration",,48)

For Each objItem In colItems
If Not IsNull(objItem.IPAddress) Then
IP = objItem.IPAddress(0)
Exit For
End If
Next

Session.Property("IP_ADDY") = IP


Create a property IP_ADDY=NotSet
Set registy value in package to [IP_ADDY]

NotSet will be replaced with IP Address..
Tony_Toni_Tone wrote:
So you just need to write the ip address into the registry of the server the package is being installed on.. the %computername% in nslookup threw me..

if I have understood correctly you could add this script stored in a custom action


Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT IPAddress FROM Win32_NetworkAdapterConfiguration",,48)

For Each objItem In colItems
If Not IsNull(objItem.IPAddress) Then
IP = objItem.IPAddress(0)
Exit For
End If
Next

Session.Property("IP_ADDY") = IP


Create a property IP_ADDY=NotSet
Set registy value in package to [IP_ADDY]

NotSet will be replaced with IP Address..

So this brings me back to Custom Actions. This is where I need some experienced help: How do I take what you have laid out above and apply it to a CA? I can get the code into a CA but not sure about "Creating a property" and "setting registry value to [IP_ADDY]".
Thanks again for the help.
So I have a working vbscript that I can run independently of the msi and it writes the IP to registry. When I put it in a Custom Action it doesnt work.

Here are the details of my CA:

Deferred Execution
Stored directly in the CA (Also tried Store in Binary Table)
Source vbs is network path to file
Return Process - Synchronus(Check exit code)
After InstallInitialize
Condition Not Installed

Any ideas?

Thanks,