Browse by Tags

Tagged Content List
  • Blog Post: PowerTip: Use PowerShell to Add Content to File

    Summary : Learn how to use Windows PowerShell to add content to a file. How can I use Windows PowerShell to add content to a file? Use the Add-Content cmdlet, and specify the path to the file and the value of the content, for example: Add-Content C:\fso\AnEmptyFile.txt -Value "This is content"
  • Blog Post: PowerTip: Use PowerShell to Create New File

    Summary : Create a new file with Windows PowerShell. How can I use Windows PowerShell to create a new text file that will be empty until I add content? Use the New-Item cmdlet and specify a path, name, and type, for example: New-Item c:\fso\AnEmptyFile.txt -ItemType file
  • Blog Post: PowerTip: Use PowerShell to Verify Syntax of Path

    Summary : Learn how to use Windows PowerShell to verify the syntax of a path. How can I use Windows PowerShell to verify that a path that accepts user input is using the correct syntax? Use the –IsValid parameter of the Test-Path cmdlet, for example: PS C:\> $a = "c:\myfolder\nonexistentfile...
  • Blog Post: Weekend Scripter: Using PowerShell to Look for Documents

    Summary : Microsoft Scripting Guy, Ed Wilson, talks about different approaches to find documents with Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. It is a lovely weekend down here in the deep south USA. I am sipping a nice cup of English Breakfast tea with lemon, lime, orange pith...
  • Blog Post: Use PowerShell to Explore Old Windows VHDs

    Summary : Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to explore old Windows VHDs. Hey, Scripting Guy! It is time for spring clean-up around our datacenter. I am not talking about chasing out dust bunnies, although that is part of it. What I am talking about is trying...
  • Blog Post: PowerTip: Use PowerShell to Find Virtual Hard Disks

    Summary : Use Windows PowerShell to find virtual hard disks on your system. I notice that my disk space appears to be disappearing at a rapid rate, and I suspect someone is creating virtual hard disks (VHDs) and forgetting about them. How can I use Windows PowerShell to find all the VHDs on my system...
  • Blog Post: Use PowerShell to Create Documents from Template

    Summary : Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to create Word documents from a template. Hey, Scripting Guy! I often need to create a bunch of Word documents. These documents have a number of standard features. Right now, I basically paste the last document I was...
  • Blog Post: Weekend Scripter: Count Images with PowerShell

    Summary : Microsoft Scripting Guy, Ed Wilson, counts the images he used in Hey, Scripting Guy! Blog posts through the years. Microsoft Scripting Guy, Ed Wilson, is here. I have been writing the Hey, Scripting Guy! Blog for a while…actually, quite a while. It is the best job I have ever had—and...
  • Blog Post: Weekend Scripter: Use PowerShell to Investigate File Signatures—Part 2

    Summary : Windows PowerShell MVP, Boe Prox, concludes this two-part series about investigating file signatures with Windows PowerShell and the .NET Framework. Microsoft Scripting Guy, Ed Wilson, is here. Welcome back guest blogger, Boe Prox , for the conclusion of the two-part series he started yesterday...
  • Blog Post: Weekend Scripter: Use PowerShell to Investigate File Signatures—Part 1

    Summary : Windows PowerShell MVP, Boe Prox, talks about investigating file signatures by using Windows PowerShell. Microsoft Scripting Guy, Ed Wilson, is here. This weekend we have a two-part series from guest blogger, Boe Prox … When you work with File Server Resource Manager (FSRM), one...
  • Blog Post: Use PowerShell to Find Files that Have Not Been Accessed

    Summary : Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to find files that have not been accessed for some time. Hey, Scripting Guy! On our server, we have tons of files. Unfortunately, many of them haven’t been accessed for years. I know the cost of storage is coming...
  • Blog Post: Use PowerShell to Find Metadata from Photograph Files

    Summary : Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to obtain metadata from photo files. Hey, Scripting Guy! I need some help. I have thousands of photo files on my computer. I need to bring some order to them. I know that I can use Get-ChildItem from Windows PowerShell...
  • Blog Post: List Music File Metadata in a CSV and Open in Excel with PowerShell

    Summary : Microsoft Scripting Guy, Ed Wilson, shares a function that gets file metadata, and then he writes the information to a CSV file. Hey, Scripting Guy! Getting basic file properties such as the file name, the size of a file, and the directory that a file resides in is pretty cool. But when...
  • Blog Post: Use PowerShell to Create CSV File to Open in Excel

    Summary : Microsoft Scripting Guy, Ed Wilson, talks about exporting a directory list to a CSV file and opening the file in Microsoft Excel with Windows PowerShell. Hey, Scripting Guy! I have a lot of music files that reside in nested folders. I would like to be able to look at the file information...
  • Blog Post: List Files in Folders and Subfolders with PowerShell

    Summary : Use Windows PowerShell to list files in folders and subfolders. Hey, Scripting Guy! I am an old VBScript guy. I love using VBScript, and I have done so for nearly 15 years. One reason I love VBScript so much is that, to me, it is easy to use. It is also very powerful. But after attending...
  • Blog Post: How Can I Delete Specific Files in a Specific Folder?

    Hey, Scripting Guy! How can I access the files in the folder T:\Act and delete any files that have the string “current” somewhere in the file name? -- SC Hey, SC. We have to admit, the notion of deleting anything current has a certain appeal, doesn’t it? Well, not for the Scripting Guys, of course;...
  • Blog Post: How Can I Get a List of All the .dll Files in a Folder, Along with Their Version Numbers?

    Hey, Scripting Guy! How can I get a list of all the .dll files in a folder, along with their version numbers? -- DD Hey, DD. You know, when we sit down to write this column we usually try to start off with an amusing and at least semi-relevant anecdote. In this case, that would mean a cute story about...
  • Blog Post: How Can I Get a List of All the .PST Files on a Computer?

    Hey, Scripting Guy! How can I get a list of all the .pst files on a computer - along with their size and their location - and then save that information to a comma-separated values file? -- DC Hey, DC. If you hang around baseball fields long enough sooner or later you’ll hear someone use the expression...
  • Blog Post: How Can I Determine If the Number of Files in a Series of Folders Exceeds a Specified Value?

    Hey, Scripting Guy! How can I determine if the number of files in a series of folders exceeds a specified value? -- DP Hey, DP. Buongiorno. Le come sta? Tutto bene? What does all that mean? Io non so; Io non parlo Italiano. In other words: I don’t know; I don’t speak Italian. No, really: “Io...
  • Blog Post: Hey, Scripting Guy! Quick-Hits Friday: The Scripting Guys Respond to a Bunch of Questions (11/14/08)

    Troubleshooting a Script That Uses the TrimStart Method Hey, Scripting Guy! Greetings from an old VBScript guy. I have a problem with a Windows PowerShell script. It returns the unexpected result of "RANSFER" instead of the desired result of "\TRANSFER". One more thing: How can I use the TrimStart...
  • Blog Post: Hey, Scripting Guy! Quick-Hits Friday: The Scripting Guys Respond to a Bunch of Questions (02/20/09)

    How Do I Determine the Versions of Several Executable Files Not Registered in the Registry? Hey, Scripting Guy! I need your help. I need to know the version of several executable files not registered in the registry. I can find the version of a single executable by using the following code. Set...
  • Blog Post: How Can I Delete a Backup File Created on the Previous Day?

    Hey, Scripting Guy! Each day we have a program that creates a file with a name similar to this: backup_20050607.bak. How can I delete the previous day’s file? -- JC Hey, JC. Hmmm, a script that goes out and automatically deletes whatever happened the day before. Boy, could we have used a script like...
  • Blog Post: How Can I Delete All Files Older Than a Specified Date?

    Hey, Scripting Guy! I’d like to have a script that can search my computer for all files older than a certain date, and then automatically delete those files. Can I do that? -- GM Hey, GM. Can you write a script that will search for and delete all the old files on your computer? You bet. Should you...
  • Blog Post: Hey, Scripting Guy! How Can I Work with Directories, Files, and Folders by Using Windows PowerShell?

    Hey, Scripting Guy! This may not sound too exciting, but I do a lot of work with files and folders. I constantly have to create folders and files, move files, and move folders. This was easy to do by using VBScript, but nevertheless it always required at least six lines of code to do anything. Is it...
  • Blog Post: Avoid Blank Lines at End of a Text File with PowerShell

    Summary : Microsoft Scripting Guy Ed Wilson teaches how to avoid writing blank lines at the end of a file by using Windows PowerShell. Hey, Scripting Guy! I have a problem with my script. For example, in my script, I build up a variable. Then when I write the variable to a file, I always end up...