I need to write a script that will perform an action on each fixed disk. I want to use a Database view for this as it already knows what fixed disks are in the machine. My question is how do I reference it? Most of the database views only have one record in them such as name (vMachine.machName) but a machine can have multiple disks. Im looking at using vCurrDiskInfo but how can I check for an E drive for example in a script? For example, I need the If statement in my script to check if vCurrDiskInfo.Drivetype = 'Fixed" and vCurrDiskInfo.DriveLetter = 'E' exists.
It is not easy to do things like this in our native database views where there are multiple records per agentGuid. The GetVariable SQL View Data step can only return one (1) value per agentGuid, and you cannot tack on additional criteria and so forth to the underlying query. Furthermore, single quotes are not allowed in the construct you use that generates the SQL making it very hard to do what you suggest. However you can build the requisite SQL, save the query in an approved SQLRead XML file and then use the SQLRead command in your Agent Procedure. Note: You must be an on-premise customer to do this. I've attached the SQL XML and an agent procedure for your reference. See IF-THEN-ELSE Steps...sqlRead() help.kaseya.com/.../index.asp for more details.
Approved SQL Read XML...
Procedure Test for Fixed Disk.xml
Kaseya Professional Services