Scripting Blog

A place to learn about PowerShell and share stories of automation

Using Windows PowerShell to Determine if a Laptop Is on Battery Power

  Microsoft Scripting Guy Ed Wilson here. It is time for another road trip. This time we are heading to Asheville, North Carolina for the Blue Ridge Classic Horse Show. Somewhere deep in my Scripting Guy lineage is an association with Kentucky, which is considered a horse state. Horse shows are really cool. My significant other and I went...

Quick-Hits Friday: The Scripting Guys Respond to a Bunch of Questions (7/30/10)

In this post:   How Can I Learn to Script?  Hey, Scripting Guy! I am working as a desktop support technician in a private company. I would like to know about windows scripting. I looked at the Learn Scripting site on the Script Center, but I am still confused where to start.   In my office, I have to ...

How to Add Data to an XML File Using Windows PowerShell

Hey, Scripting Guy! I need to be able to use Windows PowerShell to add data to an XML file. Unfortunately, there is no Add-XML cmdlet available. I thought about using the Windows PowerShell Add-Content cmdlet and trying to write my data to the file, but it never worked correctly. I never could get all of those angle thingies to line up ...

Writing Double Quotation Marks to a Text File Using Windows PowerShell

  Hey, Scripting Guy! I need to be able to write double quotation marks to a text file using Windows PowerShell. I know that in VBScript it was really annoying to do this because the quotation marks ended up getting confused with the quotation mark that was used to indicate the start of a string; when the next quotation mark was seen, ...

Deleting Extra Returns and Line Feeds from a Text File Using Windows PowerShell

  Hey, Scripting Guy! Is it possible to use Windows PowerShell to groom a text file by deleting extra returns and line feeds it may contain? Here is the deal. I have a file that we need to download each day. This file contains updated prices for commodities used in our manufacturing operation. We use the updated commodity pricing to ...