
Apr 29, 2012
Converting User Names to SIDs with Powershell
While doing some Active Directory work ran across a need to translate a user name to a SID (security identifier) to help find traces of it in the registry. Here is an easy way to do this with PowerShell function. function getSID($name, $domain=$env:userdomain) { $objUser = New-Object System.Security.Principal.NTAccount($domain,$name) $strSID =... read more
Apr 22, 2012
Extending PowerShell with modules
With Microsoft adding PowerShell to Windows it opened many different possibilities for the scripter’s and IT Administrators managing hundreds and thousands of servers with automation from their desks. One of the problems with running PowerShell from the desk is that you need modules so you can write such great scripts. In this post I will list a few of the great resources to find the modules and in... read more
Jan 20, 2012
Using Powershell to Parse Event Logs
Powershell is a well needed addition to Windows. For a longtime there has been Windows admins wanting a powerful and flexible scripting language similar to what Linux / Unix users have had for years, or at least I have. One of the great command line tools for Linux has been the use of commands like cat, less, more and grep as a few to parse files. Enter in Powershell for Windows. A recent need for parsing... read more
Jan 16, 2012
Using Powershell to check service and send email
Ran into an issue with services stopping for no reason and causing IIS to stop. This was happening in the middle of the night and was sporadic in nature, making it hard to find a root cause. As a band-aid I created a Powershell 2 script to check for the service, restart if not in a running state and send and email. Here is the script. # Checks for a service to be running and starts if needed. # Author: Me... read more
Aug 20, 2011
Changing Windows 2003/2008 Eventlog Size
With the daily routine as a Systems Administrator for Windows and Linux systems we periodically are looking for ways to reduce disk space usage. One of the ways for Windows servers is to reduce the amount of space used by the eventlogs which can eat up alot of space. The value I am using in this example is 1024 kb, you can use any value you would like by changing the value to your liking. The method I am... read more