Need help capturing partial text from file to use as custom property value

I’m almost there… but not quite :frowning_face:

I have the Windows portion (registry value) working as expected but the Linux portion (text file) eludes me. I need to capture the text after the “=” sign and store it as a custom property for the server object. The text file line in question looks as follows:
Computer_Description = Not Set

Here is the code I am working with (broken into 2 parts for clarity).

working when used alone:
if (name of operating system contains “Win”) then (unique values of (it as string) of values “Computer_Description” of keys “HKEY_LOCAL_MACHINE\SYSTEM\Custom_Properties” of (x64 registries; x32 registries))

Syntax error when I add the following:
Else if (content of file “/etc/Custom_Properties.conf” contains “Computer_Description =”) Then (it as string (following texts of firsts “=” of lines (line numbers of lines containing “Computer_Description =” of it) of file “/etc/Custom_Properties.conf”)

What am I missing? I could do this in PowerShell but I am a special kind of clueless when it comes to Actionscript and relevance statements.
All of the code above was cobbled together using code and script samples found on this forum so thank you to all the experts that made it possible.

Cheers,
Emil

Your second query has mismatched parentheses;

it as string (following

Needs to have an “of”, probably

(it as string) of (following

And you need a final ‘else’ clause to match your last ‘else if’ like

else if (Linux stuff) then (Linux stuff) else "Not found"

In case its of any help or future use, I have a simple template expression I use when I have a use case to capture from either Windows, Nix or MacOS platform (sometimes you want it all in 1 property and not split into 2 or 3 separate properties per platform)

(if (windows of it) then ("something") else (if(unix of it) then ("something") else (if(mac of it) then ("something") else ("something")))) of operating system

I will then work on each platform specific statement and insert it to replace the hardcoded “something” as appropriate, eg

(if (windows of it) then (concatenation " ; " of (addresses of dns servers of adapters of network as string)) else (if(unix of it) then (concatenation " ; " of (following texts of firsts " " of lines whose (it as lowercase starts with "nameserver") of file "/etc/resolv.conf")) else (if(mac of it) then (nothing) else (nothing)))) of operating system

This can be further expanded if there is a different between Unix and Linux (maybe there better ways to do that…I come more from a Windows background) :wink:

(if (windows of it) then ("something") else (if(unix of it) then (If(name of it as lowercase contains ""something"") then ("something") else ("something")) else (if(mac of it) then ("something") else ("something")))) of operating system

2 Likes