Trying to return a Property from a PC, and a Mac under one Field

(imported topic written by Shembop91)

So, We are trying to come up with a way where our devices will have the City State, Country, and Support Group information returned for each machine.

We have built a Task where the responsible parties will populate registry keys on PC’s with this information.

I have created a text file that we intend to drop on the Macintosh devices with this information in the file.

I can set up a property to return this information on a PC, or a Macintosh, BUT, I cannot seem to do this under one property. Here is the skinny of what I want.

If the Registry key value “CITY” exists, then return the City value.

If it doesn’t exist, then look in the Root directory “/BFInfo.txt” and return the text after the “header” for example CITY = LA would return LA

If neither exists, then I want it to return a N/A so we know the difference between those who haven’t had the information put on their system, and the ones with a problem.

As I said, if I do this for the PC’s it works - If I do it for the Mac, it works, but I can’t get it to return whichever exists.

(imported comment written by Lee Wei)

Why don’t you post the content of the “BFInfo.txt” file for us to work from.

It will also be useful for you to post the current relevance you have for both Windows and Mac OS X so far.

Lee Wei

(imported comment written by Shembop91)

Here was my latest attempt.

Again, if I choose one, or the other, I get the City name Returned.

If exists “HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Asset Info” of native registry then value “CITY” of key “HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\MWV Asset Info” of native registry else following texts of firsts "CITY = " of lines whose (it starts with "CITY = ") of file “/BFInfo.txt”

The BFInfo.txt - which is in it’s infant state is now posted.

(imported comment written by Lee Wei)

There might be 2 errors in your statement.

  • Is it intentional that you check for the existence of key “Asset Info” then pick up the value from “MWV Asset Info”?
  • The Value returns type “Registry Value”, which if of a different type from Strings from the lines of file. So we need to make them the same.

Here is an example statement that you might be able to copy from.

if (name of operating system as lowercase contains 
"win") then If exists 
"HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Asset Info" of 

native registry then (value 
"CITY" of key 
"HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Asset Info" of 

native registry) as string 

else (
"None found on Windows") 

else ( 

if (name of operating system as lowercase contains 
"mac os x") then 

if (exists file 
"/BFInfo.txt") then (following texts of firsts 
"CITY = " of lines whose (it starts with 
"CITY = ") of file 
"/BFInfo.txt") 

else (
"None found of Mac OS X") 

else  (
"None found") )

Lee Wei

(imported comment written by jessewk)

The best way to store cross-platform configuration information is to use client settings. Store the location information in a client setting and you can use the same relevance and action to retrieve and manipulate the data on any platfrom running a BigFix client.

You will find this much more reliable and maintainable than registry keys and text files.

Jesse

(imported comment written by Shembop91)

Mr. Wei,

Your code worked in retrieving the PC’s where the registry key exists, but strangely, if it isn’t there it does not return None found on Windows, it returns

On the Mac’s, even though I know it exists on at least one of them, they all returned None found of Mac OS X

Jesse,

As I have had little success with copying my BFInfo text files to Mac’s using Big Fix, I am curious to hear your side as well.

The intent of this will be to allow Field Service folks to define the “home” of a system, as well as be able to report on this via an SQL query, Excel connector, Web Reports, etc. My intent is/was to create an analysis of all these traits for use in various organizational endeavors, including a more precise Automatic Computer Groups membership. Alas, it would appear that if I want to keep that part simple, and visual, I would need to make each of these attributes a computer property rather than an analysis.

I am very willing to be corrected on any point.

(imported comment written by Lee Wei)

Sorry I gave you a bad statement, try this one instead.

if (name of operating system as lowercase contains 
"win") then If (exists key 
"HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Asset Info" of 

native registry and exists value 
"CITY" of key 
"HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Asset Info" of 

native registry) then (value 
"CITY" of key 
"HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\Asset Info" of 

native registry) as string 

else (
"None found on Windows") 

else ( 

if (name of operating system as lowercase contains 
"mac os x") then 

if (exists file 
"/BFInfo.txt") then (following texts of firsts 
"CITY = " of lines whose (it starts with 
"CITY = ") of file 
"/BFInfo.txt") 

else (
"None found of Mac OS X") 

else     (
"None found") )