Division using relevance

(imported topic written by Darknight)

Can someone please let me know how can i perform division by 1024 on the below WMI output ( I am aware size of the disk can be found out using pure relevance such but i have constraint to use WMI for extracting size of teh hardisk)

q:
(string value

of

property

“size”

of

it
)

of

it

of

(select objects

“size from win32_DiskDrive”

of
wmi)

A:
42944186880

A:
483177623040

T:
75.384 ms

(imported comment written by jgstew)

See related analysis here:
http://bigfix.me/analysis/details/2994572

First of all, you do not need to use WMI to do this. I would recommend the native inspectors instead of WMI… BUT the issue is that the values returned by WMI are strings, so if you add (…) as string as integer … then you will be able to do math on them.

Using native and universal inspectors:

(it / 1024) of total spaces of drives

(imported comment written by Darknight)

Hi jgstew,

Can you please let me know how can i apply division on the above relevance which uses WMI to evaluate the disk space.

I am aware of the direct relevance which you have mentioned in the above post. But i have a limitation to evaluate the disk space using WMI only.

Therefore could you please let me know how can i do this…? i just want the WMI output to be divided by 1024 twice so that i can display it in MB format.

(imported comment written by jgstew)

I explained how to do this using WMI in the first part of my answer.

Why are you required to use WMI for this? The answer I provided using the universal inspectors will work for all OSes, including windows.

(imported comment written by gearoid)

Q: (it as integer / 1024) of (string value of property “size” of it) of it of (select objects “size from win32_DiskDrive” of wmi)

A: 62910540

T: 17.235 ms

I: plural integer

(imported comment written by Darknight)

thanks a lotr geroid for the help… it works perfectly :slight_smile:

Hi jgstew , the reason for using WMI for extracting size of DiskDrive is that i am working on teh project where there are around 200 attributes that needs to be extracted from all sorts of OSs which includes windows as well as non windows servers.

For example : i have to create a report for CI DiskDrive in which there is one property thats is ‘Size’ , now i have to create a property which will work on all the OSs. In addition to this there are many servers/desktops which have multiple hardisks and also as there are around 200 proeprties that needs to be evaluated which includes proeprties like disk PNPDEVICE number, powermanagementsupported , powermanagementcapabilities, sectorspertracks, total heads. Now as there are multiple entries for these proeprties alongwith ‘size’ i have to find a unique way to extarct these multiple properties. also as you know if i expand each multiple line using “+” sign webreport will create multiple lines of it so the end result will be a huge report with duplicate entries in it.

So in order to avoid this i am combining the properties which have multiple entries using a separator “|” and representing under a single property and using some perl scripting alongwith webreport i am separating these results. so if i am combining all properties which inludes multiple results i have to find a common meothod to extract all those properties . As the rest of the proeprties are mostly evaluated by WMI i am using the same technique that is WMI to extarct the size of teh disk drive also.

I hope i have answered your question.

Thanks a lot for your usual support :slight_smile:

(imported comment written by Darknight)

Hi jgstew, gearoid
110000G7X9… iam facing one issue while concatinating the…

I am gettign below error while runing below relevance on unix machine:

Q: if (unix of operating system) then ("" & “|” & “” & “|” & “” & “|” & “” & “|” & “” & “|” & “” & “|” & “” & “|” & “” & “|” & “” & “|” & “” & “|” & “” & “|” & “” & “|” & “” & “|” & “” & “|” & “” & “|” & “” & “|” & “” & “|” & (sum of (total space of it as integer / (1024*1024)) of drives whose (type of it = “DRIVE_FIXED”)) ) else “”

E: The operator “concatenate” is not defined.

T: 426

here i am trying to concatinate separator “|” with the relevance which will give me sumation of size of drive.

Could you please assist me in rectifying the above relevance.

(imported comment written by gearoid)

The error message is telling you that concatenate is not allowed on one of the arguments. In this case the integer result of the sum of.

So casting the result of your sum of to a string should resolve it:

(sum of (total space of it as integer / (1024*1024)) of drives whose (type of it = “DRIVE_FIXED”)
as string
)

(imported comment written by Darknight)

thanks a trillion gearoid…this removed the error :slight_smile:

(imported comment written by JasonWalker)

I hope you’re not putting giant WMI queries into any Fixlet/Task Relevance. Using WMI is a very expensive operation and you don’t want the BES client to constantly evaluate WMI as part of its processing loop.

Consider creating an Analysis with the properties you want (concatenating your results into one value, as you want) and ensure that this Analysis Property is configured to evaluate infrequently. In the case of hardware lookups, evaluating once per week should be sufficient as the hardware does not change often.

Alternatively, you can create an Action to execute script on the client, determine the results, and either save it as a text file on the client or as a client setting. Then you can have your Analysis read results from the file or client settings, which is much less expensive than WMI queries.

(imported comment written by jgstew)

Many of the properties you are looking for are probably already found on BigFix.me and some of them are actually universal and will work for many different OSes already.

http://bigfix.me/analysis/details/2994601
Hardware Information (Windows & *Nix) - SMBIOS

http://bigfix.me/analysis/details/2994710
Hardware Information (Universal) - CPU

http://bigfix.me/analysis/details/2994563
Hardware Information (Windows) Extended

http://bigfix.me/analysis/details/2994574
Random Access Memory (RAM) Properties (Windows) - Extended

Please consider sharing anything you develop on BigFix.me