Skip to content

Global Condition Gateway

Featured Replies

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

image.png.07b2b9762bf707b6626cd4d199e64118.png

then created my requirement

image.png.4eb3bedbae84bad206ab6ddde86f4c2e.png

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

 

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

Join the conversation

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

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.