Update "Location" by the first few chars of Retrieved property

(imported topic written by SystemAdmin)

Im trying to update a setting called “Location” by the first few chars of a Retrieved property called “computer name”

computer name = BOS1SERVER01 > Location should = BOSTON

I have about 25 or so locations

i.e. BOS1, ATL1, BOI1, MIA1, …

boston, Atlanta, Boisie, Miami…

i shouldn’t be difficult but im struggling getting the first few of the “computer name”

Q: value of setting “LOCATION” of client

(imported comment written by NoahSalzman)

Are you looking for something like this?

Q: first 3 of computer name as lowercase

A: gor

Q: first 3 of computer name as uppercase

A: GOR

Which can lead to something like this:

Q: (if it is “bos” then “BOSTON” else (if it is “san” then “San Diego” else (if it is “was” then “Washington” else “NA”))) of (first 3 of computer name as lowercase)

A: BOSTON

(imported comment written by SystemAdmin)

Works great, thank you.

how would I set the value of “Location” with that answer

(imported comment written by BenKus)

This might be better:

  • Go to Wizards > Location Property Wizard.
  • Select the 4th option of “Create a retrieved property that uses a custom relevance expression…”
  • Pick a name (like “Location by Computer Name”) and then the relevance expression is what Noah posted:

first 3 of computer name as uppercase

  • Then paste in the key value pairs, such as

BOS Boston

SAN San Diego

Ben

(imported comment written by SystemAdmin)

thats exactly what i was looking for…

the other was was nice but had a huge relevance

Thanks again

(imported comment written by SystemAdmin)

is there a way with a task to check if a setting is and copy a retrieved property into a setting ?

(imported comment written by jessewk)

Yes, not task necessary. Just use the ‘Edit settings…’ dialog.

  1. Right click any computer --> Edit Settings.

  2. Click the ‘More options’ button

  3. Create a custom setting and for the value put your relevance expression in curly braces: {}

  4. On the target tab, target you setting to machines that have as their value. Alternatively, target to all machines.

Jesse