- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- how to detect network cards through Installshield
- 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
how to detect network cards through Installshield
How can i detect network cards [NIC] using Installshield [Any setting/ installscript]?
I need to detect how many NICs are present on the host machine and perform some actions accordingly.
Please guide.
Thanks
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
If nothing else you could write a C# DTF managed custom action as described here. You would need to install WiX (free) and have Visual Studio (I use 2015) in order to write these types of DLLs.
http://blog.deploymentengineering.com/2008/05/deployment-tools-foundation-dtf-custom.html
Then you would just write the code in a C# Custom Action Project (includes the special [CustomAction] attribute in the C# code) to detect the network cards and the Session object to set properties that your installer can use to know what the C# has found. For example, you could set an MSI Property to a value of the number of network interface cards found.
In InstallShield you link the DLL in by choosing the New MSI DLL...Stored in Binary table" for example and this links it in and exposes your methods for use.
Then you can start using code like this in your installers. The IS_SQLSERVER_AUTHENTICATION comes from the MSI - so you can get and set properties very easily using this technique.
try
{
session["SYSADMIN"] = "false";
string SQLServerAuth = session["IS_SQLSERVER_AUTHENTICATION"];
if (string.IsNullOrEmpty(SQLServerAuth))
{
session["IS_ERROR"] = "SQLAUTHBLANK";
session["SYSADMIN"] = "false";
return ActionResult.Success;
}
else
{
session.Log(SQLServerAuth);
AuthMode = Convert.ToInt32(SQLServerAuth);
}
...
I hope that helps.
Chad
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Whatever language you use, you should check out the Win32_NetworkAdapter class in WMI. You should be able to easily query this and iterate through the adapters.
https://msdn.microsoft.com/en-us/library/aa394216(v=vs.85).aspx
VBScript, C#, Powershell, whatever should work fine for this task.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Couldn't help but notice this.
The Win32_NetworkAdapter class is deprecated. Use the MSFT_NetAdapter class instead.
Might be fair warning.
Most important - have fun doing it
Chad
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
rguggisberg wrote:
Another way would be to execute the SystemInfo command and write the output to a file. Then do an InstallScript CA that parses the output looking for the NIC info (typically at the end) and set a property or do whatever you need to do based on the results.
Hi, the SystemInfo command doesnt support detection of NIC information. If you are sure that it does, then kindly provide some more details about it. A code snippet will be more helpful.
Thanks
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Network Card(s): 4 NIC(s) Installed.
[01]: Realtek PCIe GBE Family Controller
Connection Name: Local Area Connection
DHCP Enabled: No
IP address(es)
[01]: xxx.xxx.0.xxx
[02]: Juniper Network Connect Virtual Adapter
Connection Name: Network Connect Adapter
Status: Media disconnected
[03]: HP 802.11b/g Wireless Network Adapter
Connection Name: Wireless Network Connection
Status: Media disconnected
[04]: PANGP Virtual Ethernet Adapter
Connection Name: Local Area Connection 2
Status: Media disconnected
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
rguggisberg wrote:
When you execute SYSTEMINFO from a CMD prompt the 'Network Card(s):' info appears at the end. You can pipe the output to a file and then parse it to pull out what you want. My output looks something like this:
Network Card(s): 4 NIC(s) Installed.
[01]: Realtek PCIe GBE Family Controller
Connection Name: Local Area Connection
DHCP Enabled: No
IP address(es)
[01]: xxx.xxx.0.xxx
[02]: Juniper Network Connect Virtual Adapter
Connection Name: Network Connect Adapter
Status: Media disconnected
[03]: HP 802.11b/g Wireless Network Adapter
Connection Name: Wireless Network Connection
Status: Media disconnected
[04]: PANGP Virtual Ethernet Adapter
Connection Name: Local Area Connection 2
Status: Media disconnected
Thanks for the clarity. Does the same information can be collected by any of SYSINFO property in Installshield? I tried to search but couldnt find.
However, I achieved my requirement by running the following attached CMD file. I feel anyone can make use of it.