Jump to content


M13LU

Global Condition Gateway

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

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?

 

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.

Guest
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.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.