Jump to content

Recommended Posts

Hello everybody,

I need to create an application that has different msi parameters depending on the VLAN the server is in. I thought i would use different Deployment types and determine the subnet by using a custom Global Condition. I started with creating a global condition using a powershell command

(Get-NetIPConfiguration | Where-Object {$_.IPv4DefaultGateway}).IPv4DefaultGateway.nexthop

this returns the ip address of the gateway but found out that this would only work on windows 2012r2 and above. There are still some 2008r2 servers here, so no good. I then decided to use a WMI query and tested it on every os.

Get-WmiObject -Query "select DefaultipGateway from win32_networkadapterconfiguration where ipenabled='true'"

created a wql query as Global Condition


then created my requirement


but when i try and deploy the application, it doesn't work. where am i going wrong here?


Share this post

Link to post
Share on other sites

You have to narrow it down to a single value result by filtering. WQL is not flexible enough to get you there. Try a powershell global condition like this.

(Get-WmiObject -Namespace root\cimv2 -Class win32_networkadapterconfiguration -Filter "ipenabled='true'" | Where-Object {$_.DefaultIPGateway -like '*.*.*.*'} | select -First 1).DefaultIPGateway

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...