Scripting Blog [archived]

Formerly known as the "Hey, Scripting Guy!" blog

Writing Double Quotation Marks to a Text File Using Windows PowerShell

  (image) 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...

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

  (image) 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 ...

Parsing an AuditPol.exe Report with Windows PowerShell 2.0

  (image) Hey, Scripting Guy! I have been using AuditPol.exe to verify the audit policy that is configured on our network. The problem is that the report that is generated has a lot of text, and it is not easy to see exactly what is being audited or not. Is it possible to use Windows PowerShell 2.0 to parse the report generated by ...

Hey, Scripting Guy! How can I Migrate a VBScript to Windows PowerShell that parses a log file for errors?

  (image)   Q: Hey Scripting Guy! I need to migrate a VBScript to Windows PowerShell 2.0 that I use to parse a log file for errors that occur during a specific operation. I am only interested in the errors, not the success statements. Because this log has a tendency to grow rather large, I would like to write the failure ...

Hey, Scripting Guy! How can I Convert a VBScript That Searches Text Files into Windows PowerShell?

  (image)   Q: Hey Scripting Guy! I need to convert a VBScript into Windows PowerShell 2.0. The script reads the first line of all text files that are in a particular folder, and if a specific word is in that file, it moves the text file to an archive folder. -- AO A: Hello AO, Microsoft Scripting Guy Ed Wilson here, I have ...