Monitor folder/UNC path, must be emtpy
-
jueves, 21 de junio de 2012 8:10
Hi Guys,
I need to setup a monitor that monitors a folder like \\servername\prod$ this folder should only hold files in it for a maximum of 10 minutes, if there is still foles in it after 10 minutes, it should send a warning with the list of files thats still in the folder.
It should also be possible to make a except, as some of the folders contains 1 or 2 files/folders in them that should always be there.
Alternatevly a script that just checks if a foldersize exceed 10MB, that would indicate that it is not empty.
Anyone know of a script or a MP that can do the trick?
Regards
Todas las respuestas
-
jueves, 21 de junio de 2012 8:38
I don't know is a best practice for your issue. You can create discovery with DateTime property when file was discovered and compare this item with current time, but this issue have a bad side - it will not support cookdown and discovery will create many instances, which will live only 10 minutes. You can use Date Created property and compare current date with this property, but you need to be sure what this property is changed after move operation (Explorer change this Property, but Robocopy not).
- Editado bobgreen84MVP jueves, 21 de junio de 2012 8:39
-
jueves, 21 de junio de 2012 8:51Okay, I think I will go with the alternatevly option, and just check the foldersize. How would a script and monitor look like for that?
-
jueves, 21 de junio de 2012 9:31Moderador
Hi
First up, I'd go a VBScript for this using the filesystemobject. This can check a folder for any files and for any files it finds, it can check the datecreated or datelastmodified timestamp (depending exactly which you prefer - I suspect if is datecreated that is key).
http://ss64.com/vb/filesystemobject.html
Once that is done, we can look to plug the script into SCOM. For execeptions, you'll need to build in the option of overrides:
There is an example here of checking to see if a folder exists and then checking the file size of each file in the folder. You can tweak this for datecreated rather than size.
http://systemcentersolutions.files.wordpress.com/2009/07/fileexists.pdf
Cheers
Graham
PS You could also do this using PowerShell but you'd need to make sure that PowerShell was installed on all servers that this would execute on which might be an issue if you want to run it on Windows 2003 servers.
Regards Graham New System Center 2012 Blog! - http://www.systemcentersolutions.co.uk
View OpsMgr tips and tricks at http://systemcentersolutions.wordpress.com/ -
jueves, 21 de junio de 2012 9:50
You just can take some parts of script from this thread - http://social.technet.microsoft.com/Forums/en-US/operationsmanagerauthoring/thread/c8236ada-1636-496c-8f22-8fc95ad9f040. If you can't to write mp by yourself then I can help you with this task, but I need a time up to week.
P.S.: Better to move the post to Authring branch.
- Editado bobgreen84MVP jueves, 21 de junio de 2012 9:57
-
jueves, 21 de junio de 2012 12:17
Problem solved, I found this http://www.systemcentercentral.com/PackCatalog/PackCatalogDetails/tabid/145/IndexId/13064/Default.aspx
works like a charm :)
Thank you.
- Marcado como respuesta L_Thomsen jueves, 21 de junio de 2012 12:18

