Scripting Blog

A place to learn about PowerShell and share stories of automation

Hey, Scripting Guy! How to Query the Contents of a Special Folder on a Windows 7 Computer?

    Hey, Scripting Guy! I need to query for the contents of a special folder on my Windows 7 computer. I would like to use Windows PowerShell to do this. I know I can use the Get-ChildItem cmdlet to return the contents of a folder, but I am not sure how to do this with a special folder, other than typing a long path that would ...

Hey, Scripting Guy! How Can I Have Files Copied to a USB Drive When the Drive Is Inserted into a Computer?

Hey, Scripting Guy! I would like to be able to use Windows PowerShell 2.0 to monitor for the insertion of a portable USB drive into a computer. When the drive is detected as having been added to the computer, I would like to have the script copy files to the USB drive. Is this possible? -- AJ   Hello AJ, Microsoft Scripting Guy Ed ...

Hey, Scripting Guy! How Can I Use Windows PowerShell to Retrieve Information About Computer Hardware?

    Hey, Scripting Guy! I need to use Windows PowerShell to retrieve information about my computer hardware. Specifically I am interested in the make, the model, and the speed of my CPU by using a script. Can this be done? -- DH   Hello DH, Microsoft Scripting Guy Ed Wilson here. The 2010 Scripting Games had an event that ...

Hey, Scripting Guy! Can I Use Windows PowerShell to Read a Text File and Update an Environment Variable on Remote Computers?

    Hey, Scripting Guy! I need to be able to read a text file, and connect to a number of different remote machines to update an environment variable. Is this something that can be done using Windows PowerShell? -- ES   Hello ES, Microsoft Scripting Guy Ed Wilson here. We looked at that specific scenario during the 2010 ...

Hey, Scripting Guy! How Can I Use Windows PowerShell 2.0 to Create a Series of Text Files?

    Hey, Scripting Guy! I need to know how to use Windows PowerShell 2.0 to create a series of text files on my Windows 7 computer. Here is the deal: I would like to create a large number of text files that contain basic information and would be used for record keeping. Is this something that can be done with Windows PowerShell 2.0...