Tag Archive: utils

Oct 12

How can I delete records from MS SQL Server database using Python?

The following code will delete all records from table in database on server. import win32com.client connectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=database;Data Source=server;" query = "delete from table;" con = win32com.client.Dispatch(‘ADODB.Connection’) con.Open(connectionString) con.Execute(query) con.Close( ) Note: This code works on Windows only. You will also need to install excellent Python for Windows extensions (pywin32) by …

Continue reading »

Sep 28

How can I restart Windows service with Python?

First you need to install excellent Python for Windows extensions (pywin32) by Mark Hammond from http://sourceforge.net/projects/pywin32/. Then you can use the following code (that will restart the Print Spooler service). import win32serviceutil serviceName = "spooler" win32serviceutil.RestartService(serviceName) Note: this code was tested with Python 2.7 and version 216 of the pywin32 extensions.

Dec 28

Look What I Found #5

PDFsharp: .NET library for creating and processing PDF documents on the fly. SSH.NET: .NET 4.0 library for SSH client protocol. MailSystem.NET: suite of .NET components with support for SMTP, POP3, IMAP4, NNTP, MIME, S/MIME, OpenPGP, DNS, vCard, vCalendar, Anti-Spam (Bayesian , RBL, DomainKeys), Queueing, Mail Merge and WhoIs. Json.NET: makes working with JSON formatted data …

Continue reading »

Oct 06

System Configuration Utility

I heard about this utility years ago but somehow forgot all about it. System Configuration Utility (msconfig.exe) automates the routine troubleshooting steps that Microsoft Product Support Services technicians use when diagnosing Windows configuration issues. You can use this tool to modify the system configuration through a process of elimination with check boxes, reducing the risk …

Continue reading »