Tag Archives: System Admin

PyWin32: How to Get an Application’s Version Number

Occasionally you will need to know what version of software you are using. The normal way to find this information out is usually done by opening the program, going to its Help menu and clicking the About menu item. But this is a Python blog and we want to do it programmatically! To do that on a Windows machine, we need PyWin32. In this article, we’ll look at two different methods of getting the version number of an application.

Continue reading PyWin32: How to Get an Application’s Version Number

Python: Changing Microsoft Office User Initials

A couple of months ago at work, we received a report that a file was locked. The dialog that appeared showed the initials of a user who wasn’t even working for us any more. Thus we discovered an annoying bug that can crop up with Office. Basically, a user is asked by Word or Excel to input their name and initials during the first run of that respective application and it will keep that data no matter who logs into the machine later on. This can lead to some serious confusion when we get error messages of this sort. Anyway, let’s take a quick look at how to get this done. Continue reading Python: Changing Microsoft Office User Initials

How to Find and List All Running Processes with Python

The other day, I was tasked with finding a way to get a list of all running processes on a Windows XP virtual machine. I was also supposed to include information about how much CPU and memory each process used. Fortunately, this didn’t have to be a remote script, but one that could be run on the client. After a fair bit of Googling here and there, I finally found a solution. In this article, we’ll look at some of the rejects as well as the eventual solution, which happens to work cross-platform. Continue reading How to Find and List All Running Processes with Python

Getting Remote Drive Space on Windows

After about a year or so at my current job, as we were still working on upgrading the last few Windows 98 machines to Windows XP, we had a need to check which machines on our network were getting low on disk space. The issue was cropping up because we had Windows XP loaded on several machines that had 10 GB hard drives and a few with 20 GB and one or two with just 4 GB. Anyway, after some digging online, I discovered that the PyWin32 package could accomplish what I needed. Continue reading Getting Remote Drive Space on Windows

PyWin32: Getting Windows Event Logs

The other day, there was a post on one of the mailing lists that I follow about accessing the Windows Event Logs. I thought that was an interesting topic, so I went looking for examples and found a pretty nice example on ActiveState. In this article, you’ll find out what I discovered. Continue reading PyWin32: Getting Windows Event Logs

Python: Running Ping, Traceroute and More

Last year I needed to figure out a way to get the following information with Python: get the route table, capture the data from pinging a series of IPs, run tracert and get information about the NIC(s) installed. This all needed to be done on a Windows machine as it was part of a diagnostics script to try to figure out why the machine (usually a laptop) wouldn’t connect to our VPN. I ended up creating a wxPython GUI to make it easy for the user to run, but these scripts will work just fine without wx. Let’s see what they look like! Continue reading Python: Running Ping, Traceroute and More

Restarting PCs with Python

Have you ever wanted to restart your Windows PC with out pressing Start, Shutdown or CTRL+ALT+DEL? What about restarting your annoying co-worker’s PC…the one who just doesn’t know when to shut up? Well, Python has the answer and this blog will tell you how to do it! Continue reading Restarting PCs with Python

Python’s _winreg: Editing the Windows Registry

Python’s standard library is known for including lots of handy modules and packages that can be used without installing anything else. That’s one of the primary reasons that its standard library is called “batteries included” so often. So it should come as no surprise that Python includes a Windows only module for editing the Windows Registry. This particular module goes by the odd name of _winreg (odd because it starts with an underscore). In this article, we’ll learn the basics of working with the Registry using this “battery”. Continue reading Python’s _winreg: Editing the Windows Registry

Python: Finding the Commit Charge Values in Windows

This week I was tasked with trying to find a way to find out what the Peak Commit value was on our virtual workstations. The reason being that we are trying to save money and were wondering if we were allocating too much memory or not. We didn’t need the Total Commit Charge or the Limit Commit Charge values, but since I figured out how to get those during my research, I’ll show how to get those as well. Continue reading Python: Finding the Commit Charge Values in Windows

Creating Windows Shortcuts with Python (Part II)

Back when I first wrote about creating shortcuts with Python last month, I kept thinking to myself that I had a 3rd way of doing it. Today, I had to maintain some of my shortcut code and I stumbled upon it once more. I also noticed that my post had received a comment from Tim Golden on yet another way to create shortcuts, so I’ll include that in this post as well. Continue reading Creating Windows Shortcuts with Python (Part II)