I am calling another script, (or could be a function), which gathers data from a website, then sets variable names to the values retrieved. I want to return the variable names as well as their values to my parent script.
It would be a better practice to return a single object. The caller can assign it to whatever variable they like:
# in your function:
Tag1 = ($json.os).Replace(" ","_")
Tag2 = $json.type
Tag3 = $json.virtual_subtype
# Out in the calling code:
$result = Do-Something # placeholder for the call to your function
One last part is that I need to trim the results of Tag1 further.
$tag1 is now Microsoft_Windows_Server_2003_Standard_(32-bit)
Sometimes $tag1 might be Microsoft_Windows_Server_2003_Enterprise_(64-bit)
I will need to trim everything after the "_" which is following the Enterprise or Standard. This value could be different depending upon what the $tag1 ends up being. In every case, all I want is the OS (Microsoft_Windows_Server_2003_Enterprise) not anything after that string.
Would you please help me with this?
Thanks so much!