Scripting Blog

A place to learn about PowerShell and share stories of automation

How Can I Verify That All the Items in a List Also Appear in Another List?

Hey, Scripting Guy! I have a dumb question for you: If I have two lists how can I verify that all the items in list 2 can be found in list 1?-- SS Hey, SS. Trust us; we’ve heard sillier questions. For example, awhile back the Scripting Son came downstairs on a Saturday morning to find the Scripting Dad eating breakfast. “What’s that...

How Can I Get the Names of 10 Randomly-Selected Files in a Folder?

Hey, Scripting Guy! How can I get the names of 10 randomly-selected files in a folder? I need to do that so I can test and verify our backup and restore policies.-- CS Hey, CS. You know, if you’re interested in things that are random, haphazard, arbitrary, or downright chaotic, well, you came to the right place. For example, any time we ...

How Can I Test a Dynamic Array to See if the Array is Empty?

Hey, Scripting Guy! How can I test a dynamic array to see if the array is empty?-- SH Hey, SH. Today’s column is dated Wednesday, July 5th. If there really is a column today that means that, unlike last year, the neighbors and their errant fireworks didn’t set fire to the Scripting House. If there isn’t a new column today, well, to ...

How Can I Import a Fixed-Width File into Microsoft Excel?

Hey, Scripting Guy! How can I import a fixed-width file into Microsoft Excel?-- JP Hey, JP. We have a confession to make here, something we’re terribly ashamed of: for a moment - just for a moment, mind you - we doubted Microsoft Excel. Yes, we know: how could we do such a thing? All we can say is that we made a mistake, and we’re sorry...

How Can I Build an Array from a Column of Data in Excel?

Hey, Scripting Guy! How can I build an array from a column of data in Excel?-- AH Hey, AH. Obviously none of the Scripting Guys has any need to go on a diet (perish the thought!), but we do know that one time-honored dieting strategy is the theory of tiny bites: instead of gulping down your food in a few huge swallows, you nibble at it with...