Problem authoring action w/ {guards}

(imported topic written by SystemAdmin)

I’m trying to figure out how to modify hard coded DNS entries on a number of machines where the interface name is unknown, but I’m having a serious conflict between the output of my QNA tab and evaluation in my action tabs. I consistantly get the error “Relevance clauses must be surrounded by {and} guards.”

I’ve tried two approaches to this (one using Netsh and the other using regset) and can’t seem to get either action to work.

Here’s what I’ve tried:

NetSH code:

//Step1

waithidden netsh interface ip set dns {(names of connections whose (status of it = (connection status connected) AND name of it as string contains “Local”) of network)} static ###.###.###.### PRIMARY

//Step2 etc…

waithidden netsh interface ip add dns {(names of connections whose (status of it = (connection status connected) AND name of it as string contains “Local”) of network)} ###.###.###.### index=2

//This is capable of returning multiple answers, but usually returns just one.

Q: names of connections whose (status of it = (connection status connected) AND name of it as string contains “Local”) of network

Interestingly this fails with the same error as well: parameter “connectionname” = “{name of connection of network as string}” (fails both plural and singular)

RegSet code:

Parameter “ActiveNicGuid” = “{(guid of connection whose (status of it = (connection status connected)) of network as string)}”

regset “” “NameServer”="###.###.###.###,###.###.###.###"

//This can return multiple results, but again usually returns just one:

q: (guid of connection whose (status of it = (connection status connected)) of network as string

My understanding of Parameter rules suggest that a single returned value, however, ought to be turned into a singular string.

http://support.bigfix.com/fixlet/documents/WinActions_20081110.pdf

The rules of the parameter command are:

•Parameter expressions will be coerced into strings.

•Plural expressions that result in no values will result in an empty parameter value.

•Plural expressions that result in a single value that can be coerced into a string will assign the value.

•Plural expressions that result in more than one value will result in a failure of the action.

Any ideas? Is this a singular/plural issue? Is there some sort of “for each” type loop I can do in a big fix action to loop through each plural answer from relevance?

Thanks in advance for any thoughts.

(imported comment written by MattBoyd)

Where is the action failing at? I think the same rules for the parameter command apply to any relevance that’s in action script – it must be returned as a singular value. It looks like your task will fail if there is more than one connection with the word “local” in the name.

Also, it looks like you’re not including braces when referring to ActiveNicGuid:

regset “” “NameServer”="###.###.###.###,###.###.###.###"

(imported comment written by SystemAdmin)

Thanks for the reply. Yes I think you’re right that I didn’t have my regset command right, but the relevance fails prior to that.

This fails when evaluated in an action tab:

Parameter “ActiveNicGuid” = “{(guid of connection whose (status of it = (connection status connected)) of network as string)}”

…whether the Q/A tab shows a non-unique value is returned:

q: (guid of connection whose (status of it = (connection status connected)) of network as string)

A: {89D0460F-6D86-4BC9-B55C-A35830FC1DC1}

E: Singular expression refers to non-unique object.

…or even whether on another machine a unique value is returned:

q:(guid of connection whose (status of it = (connection status connected)) of network as string)

A: {264F6E96-E135-4D75-916E-96C974ACE8CA}

I always get the error "Relevance clauses must be surrounded by { and } guards.

It was my understanding that by using “parameter” I could turn my result into a singular string… apparently not.

Is there any way I can turn my first result into a non-plural string? e.g.

q: name of connection of network as string

A: Local Area Connection

E: Singular expression refers to non-unique object.

Or better yet, loop through the results like a “for each” in VBScript?

(imported comment written by NoahSalzman)

Please paste your full ActionScript and your full Relevance.

(imported comment written by SystemAdmin)

I haven’t gotten out of the testing/development phase in the Fixlet Debugger yet, but my preference would be to use NetSH in something like this:

//The idea would be to reset & hard code the DNSes on any connection w/ an expected, but hard coded IP (DHCP off).

//Relevance:

(version of client >= “6.0.0.0”) AND ((exists true whose (if true then (exists (addresses whose (it = “172.27.7.115”) of dns servers of adapters of network as string)) else false)) AND (exists true whose (if true then (exists (addresses of adapters whose ((DHCP enabled of it = false and address of it !=“0.0.0.0”) and (address of it as string starts with “129.” or address of it as string starts with “172.” or address of it as string starts with “10.”)) of network)) else false)))

//ActionScript:

//Step1: Reset DNS entries & set them to static (they’re static for these queried computers anyway)

waithidden netsh interface ip set dns {(names of connections whose (status of it = (connection status connected) AND name of it as string contains “Local”) of network)} static 172.27.7.122 PRIMARY

//Step2: Add the next DNS server to index location 2 (can repeat as index 2+n)

waithidden netsh interface ip add dns {(names of connections whose (status of it = (connection status connected) AND name of it as string contains “Local”) of network)} 172.27.7.123 index=2

(imported comment written by NoahSalzman)

Is that ActionScript producing the error: “Relevance clauses must be surrounded by {and} guards” ? Or is there a larger script that produces that error?

(imported comment written by SystemAdmin)

We’re working on a VBScript or RegImport method of attacking this at the moment, but any of the lines below, evaluated individually and alone in the Action tab of the Fixlet debugger checked on XP or Win 7 produce the noted error:

Parameter “ActiveNicGuid” = “{(guid of connection whose (status of it = (connection status connected)) of network as string)}”

parameter “connectionname” = “{name of connection of network as string}”

parameter “connectionname” = “{names of connections of network as string}”

waithidden netsh interface ip set dns {(names of connections whose (status of it = (connection status connected) AND name of it as string contains “Local”) of network)} static 0.0.0.0 PRIMARY

(imported comment written by NoahSalzman)

This Fixlet Debugger issue appears to be bug 38923. It’s an issue with debugging Action Script in the debugger… it should not affect the actual Action Script when run on the client.