Popular recipes by mgarrana Garrana http://code.activestate.com/recipes/users/4171135/2010-03-12T05:25:52-08:00ActiveState Code Recipesironpython script to Monitor Servers internal CPU temprature using WMI MSAcpi_ThermalZoneTemperature with e-mail alerting capability (Python) 2010-03-12T05:25:52-08:00mgarrana Garranahttp://code.activestate.com/recipes/users/4171135/http://code.activestate.com/recipes/577103-ironpython-script-to-monitor-servers-internal-cpu-/ <p style="color: grey"> Python recipe 577103 by <a href="/recipes/users/4171135/">mgarrana Garrana</a> (<a href="/recipes/tags/cputemprature/">cputemprature</a>, <a href="/recipes/tags/ironpython/">ironpython</a>, <a href="/recipes/tags/managementobjectsearcher/">managementobjectsearcher</a>, <a href="/recipes/tags/msacpi_thermalzonetemperature/">msacpi_thermalzonetemperature</a>, <a href="/recipes/tags/smtplib/">smtplib</a>, <a href="/recipes/tags/wmi/">wmi</a>). </p> <p>ironpython script. It reads a txt file called servers.txt where it contains server names each in a separate line . it executes the function remoteconnect on each server name , the function connects to the server and reads the internal CPU TEMP from the WMI class MSAcpi_ThermalZoneTemperature located in namespace \root\WMI if internal CPU temp exceeds a certian Threshold , the function sends an alerting e-mail , it can also execute any other desired action using the same concept like sending an alerting sms</p> Python Program for Windows domain based machines to collect usefull information (admins- software installed) (Python) 2009-07-16T06:49:00-07:00mgarrana Garranahttp://code.activestate.com/recipes/users/4171135/http://code.activestate.com/recipes/576844-python-program-for-windows-domain-based-machines-t/ <p style="color: grey"> Python recipe 576844 by <a href="/recipes/users/4171135/">mgarrana Garrana</a> (<a href="/recipes/tags/group_policy_startup_script/">group_policy_startup_script</a>, <a href="/recipes/tags/know_local_administrators_domain_machines/">know_local_administrators_domain_machines</a>, <a href="/recipes/tags/microsoft_inventory_collection/">microsoft_inventory_collection</a>, <a href="/recipes/tags/python_scripts/">python_scripts</a>, <a href="/recipes/tags/software_inventory_domain_machines/">software_inventory_domain_machines</a>). </p> <p>this is a python program Python Program for Windows domain based machines to collect usefull information , this can be very customizable to the type of information you'd want to collect. you can force it to run on all machines using group policy, and each machine would create a file in a specific folder ( for simplicity here , no need to go to a database at this level) with the machine name , and containing such information for example , this program collects local administrators on the machine( can be very usefull in security assesments or securing the corporate ) , a list of all the software installed on the machine also other general information like machine name ,current logged on user , system time at script run time and domain that this machine belongs to</p> <p>i've ran it in practice and i was really amazed by the result , that i couldn't find with any other tool once you get the idea ... you can go wild with your dreams and do anything you like i've also written a backend parser which parses the results and prints out a report with the required results this program needs python for win32 installed the program uses windows registery , win32 api if you will run this software by group policy , you don't have to install python and python for windows extenstions onto each clinet machine there is a tool called py2exe which magically , complies the code into and exe and DLL files , that you can run the exe by group policy as a startup script please excuse the qualtiy of the code , as i am not a programmer , i am sys admin</p> import foldernames from a txt file , and take ownership over these folders and subfolder , and delete them - Windows (Python) 2009-07-16T06:58:26-07:00mgarrana Garranahttp://code.activestate.com/recipes/users/4171135/http://code.activestate.com/recipes/576845-import-foldernames-from-a-txt-file-and-take-owners/ <p style="color: grey"> Python recipe 576845 by <a href="/recipes/users/4171135/">mgarrana Garrana</a> (<a href="/recipes/tags/script_delete_folders/">script_delete_folders</a>, <a href="/recipes/tags/script_take_ownership_folders/">script_take_ownership_folders</a>, <a href="/recipes/tags/windows_delete_folders/">windows_delete_folders</a>). </p> <p>this script opens a file called "folders.txt" which contains foldername each in a separate line , and then passes by these folders one by one in a loop and takes ownership of these folders and subfolders and deletes them</p> Adding Active Directory users to a ctive directory group, importing the users from a txt file, (Python) 2009-07-16T07:02:25-07:00mgarrana Garranahttp://code.activestate.com/recipes/users/4171135/http://code.activestate.com/recipes/576846-adding-active-directory-users-to-a-ctive-directory/ <p style="color: grey"> Python recipe 576846 by <a href="/recipes/users/4171135/">mgarrana Garrana</a> (<a href="/recipes/tags/active_directory_scripts/">active_directory_scripts</a>, <a href="/recipes/tags/adding_multiple_users_to_group/">adding_multiple_users_to_group</a>, <a href="/recipes/tags/microsoft_active_directory_users/">microsoft_active_directory_users</a>). </p> <p>this script opens a file called users.txt (which you create) , this file contains microsoft domain users written each in separate line , and then each user is added to the AD group you require </p>