Saturday, 18 April 2015

powershell: XML search for keyword, write, and if statement



Ok, I'm trying to tackle a problem that a piece of software that monitors for alarms can't apparently do.. and I'm trying to work around it.


I'm a powershell noob, so please pardon my inexperience.


What I need to do is:



  1. Search a folder for all XML that contain the word "Major".

  2. if it also contain the word "parsedxml" Do nothing and exit.

  3. else, write.Eventlog -Message ("insert the complete contents the pared XML file")

  4. then write "parsedxml" to the file so it knows it has already been checked if file still exists in the folder on the next search.


I have been working with Kaseya to try and get this done thru their tool and cannot get it to work. I can call a powershell script from Kaseya let's say every 5 minutes, but as I said.. I'm not a programmer by day and need a little help laying out how I would need to do this.


Thanks in advance..


No comments:

Post a Comment