Oliver Script: A Holiday Tale–Part 2


Summary: Oliver discovers how to easily find data with Windows PowerShell.

Note  This is the second post in a series. To get started, read Oliver Script: A Holiday Tale–Part 1.

“Would you like fries with that?” How Oliver hated uttering those words daily. He hated going home, smelling of rancid grease and old soda pop. But he found contentment because it did pay the bills and he was grateful to have work when so many others didn’t.

He also got an occasional free lunch—even though it was food expired from the heat chute at the restaurant. But food is food, and the small blessings in life should not be shunned.

During this time, Oliver found a place of his own and discovered something interesting—people leave older broken computers at the side of the road. This made no sense to him, and for the next few years, he began to retrieve these machines cast to the Land of Misfit PCs and brought them home.

Over time, he amassed a collection of technology across the ages—a collection that would have shocked the curators of the Microsoft archive in Redmond.

Oliver also found that he had an amazingly strong skill at fixing these old machines for fun. Even though Oliver could make money at this, he found it much nicer to give them away to the odd neighbor who didn’t have much money. “Perhaps it might help them gain skills as I did or to get a job,” he would think to himself.

As time passed, Oliver dreamed of going out on his own and starting his own computer company repairing machines. Yet he didn’t dare risk missing his rent or food, and he continued to stay with his current job. By this time, the job involved working the nighthawk hours to scrub behind all of the equipment. Poor Oliver found few friends during those hours, and he began to smell a bit too.

But his reputation grew within the neighborhood. People would come from far and wide to have him fix their machines. Often they couldn’t pay much, if anything, but the joy Oliver felt in doing something he loved more than made up for it.

One day, a neighbor, Mrs. Bedwin, came to Oliver in a panic.

“My pictures!” Those were the only words Oliver heard over and over, “My family pictures!”

It appeared that this particular neighbor for some reason had left Local Administrator rights enabled, and Mr. Sikes, a boarder in her rooming house, had moved her pictures to a new location. He refused to let her know where he put them unless she paid him a handsome sum of $150 and obtained a signed autograph from Rowan Atkinson.

And of course, the family photos she had been collecting with her Nokia Lumia 1020 weren’t backed up, which made complete sense to nobody except her.

“Oliver Script, I’ve been told that you are about the best there is. If I don’t get those photos back, I don’t know what I’m going to do!” The sobs rolled out as the tear flowed freely from her eyes. “I have no clue who Rowan Atkinson is!”

Oliver quietly thanked himself that he had wrapped his keyboard to protect it from coffee spills years ago. Her tears nearly soaked the “ANYKEY” he had painted a long time ago.

Earlier that week, he had been playing with Get-ChildItem, and he found that it was a fantastic tool for not only listing a directory structure, but also for seeking data.

Looking up, he smiled, “Give me a few minutes. I think I can help you solve this.”

Oliver booted into her laptop with his Windows PE USB key, which was preloaded with Windows PowerShell. He then started PowerShell.exe and proceeded to use Get-ChildItem to access the entire file structure to see if the drive was in fact intact:

GET-Childitem C:\ -recurse

Image of command output

Satisfied that the drive was at least functional and intact, he then targeted the folder structure to find all files ending in .jpg for the missing photos. Oliver’s hope was that somebody had simply inadvertently dragged-and-dropped a folder somewhere.

GET-Childitem C:\ -recurse –include *.jpg

Image of command output

But as he could see, this process was yielding too much information. Although it showed pictures and where they were located, it was pulling information that he didn't need, such as Microsoft Office Clipart files.

Oliver scratched his head, thoughtfully thinking, while the neighbor looked up. The letters WP struck his head like a brick tossed casually by a thoughtless child. “All photos from her Windows Phone would typically start with WP!”

He adjusted his search to yield only files matching a particular file name and extension:

GET-Childitem C:\ -recurse –include WP*.jpg

Image of command output

Her eyes lit up when she saw the pictures were still there. They examined a few to make sure everything was intact.

“Where should they be located?” he asked.

“They SHOULD be located in the Pictures folder under my Bedwin ID. If you could move them there, that would be wonderful!”

Oliver used the Move-Item cmdlet to immediately place the pictures exactly where they belonged:

MOVE-item ‘C:\Users\Sikes\My Family\Camera Roll’ ‘C:\Users\Bedwin\Pictures’

New tears flowed from Mrs. Bedwin’s eyes when she saw everything where it should be. “Oliver! You’re a genius!” she cried as she gave the young fellow a big hug.

Oliver spent a few minutes securing her laptop and showing her how to make sure her phone automatically backed up the photos to OneDrive. He also copied her current collection to her OneDrive storage account for good measure.

They sat and chatted for a bit because she wondered why such a gifted fellow didn’t do this for a living. Oliver confided that he had been unable to get the money together to finish his courses in school. In the meantime, he was biding his time and trying to save money by cleaning toilets and grease traps for a living.

“Such wasted skills! I shall see none of this continue!” Mrs. Bedwin announced, for she had some friends in higher places. “You, young man, are going to computer school!”

The next day, a loan was secured for Oliver to begin attending courses at a private computer college. The loan amount was enough for him to cease working as a grease trap/fryer specialist and focus on his studies.

However, poor Mr. Sikes (our would-be extortionist) found two new changes in his life. He found himself no longer staying at said rooming house and he found himself muttering daily, "Would you like fries with that?"

Does Oliver still smell like fries? Is he excited to start his computer training career? Has Mr. Sikes memorized the theme song for his new job? Stay tuned to tomorrow’s episode of Oliver Script: A Holiday Tale on the Hey, Scripting Guys! Blog.

We invite you to follow the Scripting Guys on Twitter and Facebook. If you have any questions, send an email to the Scripting Guys at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, remember the Power of Shell is in You.

Sean Kearney, Windows PowerShell MVP and Honorary Scripting Guy 

Comments (5)

  1. @aaron

    If it brought a smile or a giggle to your face, it was worth the effort 🙂

    Sean

  2. OMG I am starting to get this!

  3. This makes reading about Powershell fun! Can we make soap out of it? How many more will follow.
    Great stuff.

  4. @Maurice Ausum

    This series will continue on until Dec 26th but definitely keep your eyes son the Scripting Guys for more Powershell fun. There is some amazing content here daily contributed by people from Microsoft and regular people just like us 🙂

    If you’re interested, do a search for the earlier Holiday Specials as well as the BATCHMan and Cmdlet series!

    Sean

  5. aaron says:

    U guys are crazy :). Thanks for the scripts though!

Skip to main content