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. (more…)
Entries tagged with “Windows”.
Tue 27 Jul 2010
PyWin32: Getting Windows Event Logs
Posted by Mike under Python, System Administration, Windows
View Comments
Fri 16 Jul 2010
Python and Microsoft Office – Using PyWin32
Posted by Mike under PyWin32, Python, Windows
View Comments
Most typical users have used Microsoft Office. While Office may be the bane of tech support, we still have to deal with it. Python can be used to script (AKA automate) Office and make it easier for us or our users to use. It may not be as easy as recording a macro, but it’s close. For this article, you will learn how to use the PyWin32 module to access some of the Office programs and manipulate them with Python. Some forums say that you need to run PythonWin’s makepy utility on Microsoft Word (and Excel) before you can access Office applications. I don’t think I needed to do that to make it work though (at least, not with the 2007 version). However, PythonWin comes with the PyWin32, so if you do run into trouble, you can try it. (more…)
Wed 5 May 2010
Python: How to Tell How Long Windows Has Been Idle
Posted by Mike under Python, Windows
View Comments
The other day, I received a request to create a script that could tell how long a Windows XP machine had been idle and to alert the user if it had been idle for a certain amount of time. I did a little research with Google and found a couple of ways to accomplish this feat. The only one I was able to get working was a ctypes example, so without further ado, let’s check it out! (more…)
Sat 27 Mar 2010
Restarting PCs with Python
Posted by Mike under System Administration, Windows, wxPython
View Comments
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! (more…)
Sat 20 Mar 2010
Python’s _winreg: Editing the Windows Registry
Posted by Mike under Python, System Administration, Windows
View Comments
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”. (more…)
Wed 3 Mar 2010
Finding Installed Software using Python
Posted by Mike under Python, System Administration, Windows
View Comments
Have you ever wondered what software was installed on your PC? Most people who use Windows would probably go to Add/Remove Programs to find out this information, but they’re not programmers. No, programmers have to script it because it’s just in our blood to do so. I actually had another reason to do so: my boss wanted me to log what was installed on our user’s PCs so we’d know if our users were installing unauthorized software. Thus, there’s also a practical reason to attempt this. (more…)
Thu 25 Feb 2010
Creating Windows Shortcuts with Python (Part II)
Posted by Mike under PyWin32, Python, System Administration
View Comments
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. (more…)
Sun 14 Feb 2010
Python, Windows and Printers
Posted by Mike under Python, System Administration, Windows
View Comments
I do a fair amount of technical support in addition to my software development. In our small shop, we get to troubleshoot anything that is related to technology, from networks to software to printers. I think one of the most annoying aspects is trying to get printers to work the way the user wants. Another issue is setting up printers for users that have to roam from PC to PC as a part of their job. These users usually only need the printers that are in their specific location at any given time. It’s very difficult to accommodate this type of user, especially if the PCs are being used 24/7, which is true in my case. This is where Python comes in. (more…)
Sat 13 Feb 2010
Using Python to Edit Bad Shortcuts
Posted by Mike under Python, System Administration, Windows
View Comments
A couple weeks ago, I wrote about some scripts we use at work for creating shortcuts to various programs in Windows. Well, we also push out updates to some programs which change the paths of the programs and then we need to change the user’s shortcuts to match. Unfortunately, some user’s will change the name of the shortcut which can make finding it difficult. Python makes it easy to find the shortcut I need to change though and in this article I’ll show you how to do it. (more…)
Tue 9 Feb 2010
Using Python to Reduce the Roaming Profile
Posted by Mike under Python, System Administration, Windows
View Comments
Roaming Profiles are a blessing and a curse. If the user uses the internet, their browser’s cached files will grow like mad. If the user downloads programs to their desktop or creates large Powerpoint files anywhere in their profile, then they have to be managed whenever the user logs in or out. There are several solutions to this problem: disk quotas, blocking the ability to download or put stuff in one’s profile, etc. In this article, I will show you how to exclude specific directories from the user’s profile using Python. (more…)