Scripting Blog [archived]

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

Hey, Scripting Guy! How Do I Create a CSV File from Within Windows PowerShell?

(image)   Hey Scripting Guy! I am having a problem trying to create a CSV file from within Windows PowerShell. I thought at first I could use the Write-Host cmdlet to do this. I came up with this command:Write-Host "col1,col2,col3" >> "C:fsotest.csv"But when I go to the test.csv file, it is empty. I am really stuck. I have spent ...

Hey, Scripting Guy! How Do I Use Windows PowerShell to Run the Same WMI Queries Against Multiple Computers?

(image) Hey, Scripting Guy! I need to run the same WMI queries against multiple computers on our network. Can I do this with Windows PowerShell?- KB(image) (image) Hi KB, Not only can you do this with Windows PowerShell, but you will be surprised at how easy it is to do. If you can create a text file in Notepad, you can run your multiple...

Hey, Scripting Guy! How Can I Load a Drop-Down List From a Text File?

(image) Hey, Scripting Guy! I have a text file that has a list of different store numbers and I would like to be able to populate a drop down list of an HTA.-- MH(image) (image) (image) Hi MH, The basic task of reading data from a text file and using it to populate a drop-down list is pretty straightforward. Below is the code for an HTML ...

Hey, Scripting Guy! How Can I Read the MAC Address From a Text File?

(image) Hey, Scripting Guy! I've been asked to create a script which will read the contents of addresses.txt and output ONLY the MAC addresses listed in the text file. Could you give me some pointers or even a demo script with which to give me a boost?-- FR(image) (image) (image) Hi FR, The last time someone asked the person writing this ...

Hey, Scripting Guy! How Can I Replace a Series of Variables Found in a Text File with Values Taken From That File?

(image) Hey, Scripting Guy! I have a text file containing TSQL syntax. In this file are a number of variables: @P1, @P2, @p3, and so on, up through @P58. The bottom line of the text file contains replacement values for these variables; for example, I need to take the variable @P1 and replace it with the first value in the last line; I need ...