Automation - Oscar Romero
Attached is the Kaseya Accelerate/Connect 2018 Script Content Pack as presented during Accelerate events.
List of scripts as of 2/27/2018:
- Hide Kaseya Working Directory
- Rename Kaseya Agent Service
- Remove Kaseya from Start Menu
- Execute Patch Scan Now
- SMART Disk Check
PRE-POST AUTOMATION:
- Patch Pre-Warning
- System Restore Point Creation
- Windows Timestamp Update
WEBROOT:
- Automated deployment/installation (OSX and Windows)
Some articles of referenced discussed:
Database Variables: http://help.kaseya.com/WebHelp/EN/VSA/9040000/#3480.htm
New Agent Installed: http://help.kaseya.com/WebHelp/EN/VSA/9040000/index.asp#4248.htm
Procedure alerts: http://help.kaseya.com/WebHelp/EN/VSA/9040000/#10337.htm
To view a full list of Kaseya events, please navigate below:
https://www.kaseya.com/resources/events-and-webinars#meetups
https://kaseyaconnect.com/
Kaseya Connect Local 2018 - Script Pack has no reviews.
Hey Buster,
Thank you for your comment. Is there an error on the execution? The script is a system script which does not display the steps in the agent procedure however it does execute the task. You may review if the patch was successful in the 'Patch Scan' status within the Legacy Patch Management module.
Feel free to email me: oscar.romero@kaseya.com
After seeing the SMART HDD check at connect I decided to try it since we get a number of failed drives in our endpoint population. I ran it, and found a few failed drives, however the script simply fails if it is anything other than OK. Its almost as if it cant access the file in order to determine the status. I am able to filter on failed agent procedures and every one of them is a failing drive, but the email and alert would be nice...
Matthew, I have the exact same issue. We're on SaaS 9.5 and I'm wondering whether it's a problem with our instance. I tested a couple of other, similar scripts, and had the same problem as soon as it gets to any 'if' statements.
I tried re-writing it, turning off Authanvil 2fa, editing the script, and a bunch of other things and nothing worked.
I didn't work with Oscar at Kaseya Connect but stopped by the Kaseya Genius booth and we weren't able to get this working. I also attended Oscar's session but had been trying to get this working even before attending Kaseya Connect.
If you're on SaaS 9.5, I'd suggest waiting for the next update and trying again. This was just one of a few other weird bugs in 9.5 for us.
I have never seen the > used in this context. I am wondering if that is not being interpreted correctly? Try replacing that with #vAgentConfiguration.Machine_GroupID# and see if you have any better luck. I didn't have a failed machine to check on.
Chris
clubmsp.com
I actually went through and removed that variable amongst others to eliminate that as an issue. Still failed unfortunately. We are on prem 9.4.0.36 and will be updating to the latest 9.5 build soon. Hopefully it will work after that.
Can you post the Procedure log on a failed machine? I don't see any of those commands that would be version dependent. Not much has changed in the Agent Procedure editor for quite some time!
10:15:52 AM 15-May-18
Onboarding - SMART Disk Check
mdecker
Script Summary: Failed THEN in step 2 (Line 7)
10:15:52 AM 15-May-18
Onboarding - SMART Disk Check
mdecker
FAILED in THEN step 2, execute script Onboarding - SMART Disk Check-0001(ID = 1721080620) (Line 7)
10:15:52 AM 15-May-18
Onboarding - SMART Disk Check-0001
mdecker
Script Summary: Failed loading ELSE steps
10:15:52 AM 15-May-18
Onboarding - SMART Disk Check-0001
mdecker
FAILED to load the ELSE steps for Onboarding - SMART Disk Check-0001(ID = 1721080620).Error: Invalid script variable syntax or bad command parameter (step 3)
Thanks. Do you know if the file is being created in the KWorking directory? It sure seems like it can't find the file, but the scripting module can output some weird things! The last message "Invalid script variable..." is of concern. There is another variable that I don's see documented, which is #scriptIDTab.scriptname# variable. I don't see the scriptIDTab view documented. Can you try to change that to "SMART Disk Check - Results: NOT OK" (get rid of the variable), and re-try?
The file was being created there.
So I ended up essentially rewriting this script from scratch. Its not exactly the same... but basically. It works fine. I also used a number of the same variables, like scriptIDTab and and that didn't cause a problem in it.
The problem I ran into was on the disk check script. If any drive registers "OK" the script calls the computer OK. If the computer has multiple drives and only one returns "OK" the script calls the computer ok. The script should be looking for "Pred Fail" or any other status instead of OK.
I agree with that as well.
Hey guys,
This is great and exactly what I aspire a community to be around scripts, technical situations, and more. I agree as well this script should be modified to account for all situations. As mentioned during my presentations, these scripts are not one size fits all and other perspectives really allow me and others to think outside the box and get the most out of automation.
If anyone creates a more robust solution and approach, please feel free to share.
Yes, that would be an issue.... I am guessing the problem is that the responses might be different for different drives, so it is hard to account for all of them, and you would have to setup an IF statement for each possible answer. On machines with 2 drives, you might want to write the txt file to the agent procedure log with a tag, and create a report that you can scan through.
Glad you got it working!
Hey guys, I just need to throw this out here. How reliable does everyone find the WMIC SMART check? I've tested it before in the past and tossed it aside because every hard drive was OK. I tested an external hard drive that I know was failing and practically dead and WMIC SMART still came up as OK. It makes we weary to implement this script because of this. Other then that, I absolutely love the idea behind the script.
Rob, I think it is one more check.... Not sure what is any better? I remember reading an article from one of the big storage companies where they said that getting a SMART error pretty much indicated the drive was on borrowed time, but they would still fail without reporting SMART. CHKDSK is just as useless, so not sure what a 100% check would be? My guess is that it doesn't exist.
Rob - I would go 50/50 on that... .If the disk is reporting enough stats to pass a threshold to put it in Pred Failure than this is great... but a drive could easily pass SMART and fail a SHORT DST test in the BIOS. If I can head off a few failures before the computer is toast its a win. I know there are some test using other applications in the Kaseya Power Packs
Matthew, would you mind sharing the script that you made?
Even if the SMART check is not 100% in its finding, anything helps. In our case, when testing this script, we were able to identify a hard drive with a predictive failure. At least now we can get ahead of the failure and replace the hard drive or restore to a different machine.
The hard drives I tested with WMIC SMART I had tested with HDAT2 and CrystalDisk first. The latter two were consistent in their results, WMIC SMART showed EVERYTHING as okay lol. Yes, I could think of it as just one more check to add to the list but I wouldn't trust the results one way or another. I definitely don't expect 100% either...just something that doesn't label everything as okay. I'd rather have 90% false bads then 90% false goods. Atleast if everything was bad, god forbid, I could use the other two apps for further testing haha! Out of 1000 endpoints, not one warning, I don't believe that one bit.
The procedure I created uses CrystalDiskInfo to obtain the SMART information then outputs to a text file which is then read into a column. I have found the smart information to be pretty reliable. I do have a few use cases for a more simple procedure like this - I'm testing the results now.
Rey - Sure I don't mind sharing... I am testing this now, so far I did get a couple of failures to come back. If all goes well I will post it on the Automation Exchange
See the link below
https://buyphillips.sharefile.com/d-s97a6a65e8a44822a
FYI this link will expire after a week
Matthew, thanks a lot. I downloaded and will test it out within the next couple of days.
Emily, there's another procedure that uses smartmontools, which I assume is like what you are doing. For anyone interested, you can see it at http://community.kaseya.com/xsp/f/28/t/6690.aspx and perhaps this will give others better results than using WMIC. If SMART status check doesn't work, it's also worth checking the bios to see if the monitoring was turned off. Not all motherboards can toggle it on and off, but I've at least seen one recently where I had to turn SMART monitoring on.
If interested... my version is now posted here https://automationexchange.kaseya.com/products/504#details
I tried to run the procedure to execute patch scan and it does not work.. I opened the procedure details and it is not calling any procedure. Please advise.