Converting a folder of text files into a well formatted CSV spreadsheet with PowerShell

We are in the process of changing over our Print Server and the first step on the plan was to get some data from all the computers on my network about which printers they had installed. This needed to grab the data from all users on all PCs so the only logical way to do this was to create logon script below and let it run for a week. In a previous post I discussed how PowerShell Export-CSV turns lovely tables in to garbage but now I needed to get a CSV from hundreds of separate text files …

Continue reading

PowerShell Export-CSV turns lovely tables in to garbage

powershell logo Following on from my promise to do better blogging in 2013, here’s something that frustrated me in PowerShell.

It stems from me being very much a beginner still in the PoSh ranks. Although, I’m using it more and more of late and starting to get the hang of it all

One issue I recently struggled with was when a user asked me if I could create a spreadsheet containing all the London staff phone numbers and email addresses. This sounded easy enough, I ran the following line of code and was happy with my results

Continue reading

Using PowerShell to send a Windows Service Recovery Email Alert

recovery dialogue boxEach Service that runs in Windows features a Recovery tab in the Services.msc management console. Normally I only ever set this up to restart the service after 5 minutes in case something had conflicted with it’s initial start-up attempt. However, we recently had a problem with an IBM service that caused our Windows 2003 R2 x64 server to reboot if it crashed. I thought it would be very handy if we could get an email sent to the IT department if the service was failing. I had dabbled with using BLAT in the past but seeing as all of our servers already have PowerShell installed I thought that would be a more efficient option.

Continue reading