Scripting Blog [archived]

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

Latest posts

Nov 10, 2016
Post comments count 0
Post likes count 0

Manage SharePoint Online site collections and the web templates with PowerShell

Doctor Scripto

Summary: PowerShell commands can manage site collections and the web templates that create site collections. Christopher Weaver is a Microsoft Premier Field Engineer (PFE) who focuses on SharePoint and Office 365 solutions for large enterprise Premier customers. He has been doing PowerShell and SharePoint with Microsoft for nine years. In his spare time, he enjoys backpacking, hiking, kite surfing, and spending time with his kids and dog. You can follow him on his blog at https://blogs.technet.microsoft.com/christwe/. Hello All, As we prepare our SharePoint Online environment for migration, we will need to be ...

Nov 9, 2016
Post comments count 0
Post likes count 0

Part 3 – Use Azure Automation DSC to Configure Linux and execute PowerShell scripts

Doctor Scripto

Summary: Learn how to configure and use PowerShell, Bash, and DSC with Linux. Hi, my name is Stefan Roth (Blog: http://stefanroth.net / Twitter: @stefanroth_net), and I am a Cloud and Datacenter MVP. In my last post of this three-part series, I would like to show you how we are able to hook up the previously installed Linux system to Azure Automation desired state configuration (DSC), deploy a DSC configuration, and apply it to our Linux system. What we are actually going to do is create a cronjob on Linux via Azure Automation DSC. This cronjob will run a PowerShell script on Linux every five minutes to send the...

Nov 8, 2016
Post comments count 0
Post likes count 0

How to avoid reinventing the wheel in Azure Automation

Doctor Scripto

Summary: Take advantage of existing scripts to create your own solutions.   Automation is the number one technical skill that IT needs to have to thrive in today’s quickly changing world. My recommendation is that anything you do for automation you should do in PowerShell, and you should use Azure Automation as your go-to automation solution. (PoSH Wizard illustration courtesy of myITforum.com) The Microsoft Operations Management Suite provides functionality around log analysis, backup and recovery, security and compliance, and IT automation. IT automation uses Azure Automation and is described as a met...

Nov 4, 2016
Post comments count 0
Post likes count 0

PowerTip: Capture error code of a PowerShell session in Linux or macOS

Doctor Scripto

Summary: Capture the status code of a PowerShell session in Linux or macOS. Could you show me how to run a PowerShell script in Linux or macOS and capture the status of whether that script succeeded or failed? No problem, my friend. Just run the PowerShell session, and start the script as in the following example. You can view the status in the built-in variable in Linux and macOS.

Nov 4, 2016
Post comments count 0
Post likes count 0

Open Source PowerShell – Part 1

Doctor Scripto

Summary: Find and install the Open Source PowerShell software for Linux or Windows. I was reading up about a great new change in PowerShell. I heard that the newest version was Open Sourced on GitHub. Any chance you could give me a quick run-through to check it out? Honorary Scripting Guy, Sean Kearney, is here today to bring you up to pace with the coolest new change that was introduced ever. The newest version of Windows PowerShell (version 6.0) is on GitHub.com as an Open Source project! Don’t believe me? Check it out right now at https://github.com/PowerShell/PowerShell. To say, “This is big,” is a very...

Oct 28, 2016
Post comments count 0
Post likes count 0

PowerTip: Know the difference between the .split() method and ‘-split’

Doctor Scripto

Summary: Cloud and Datacenter Management MVP, Thomas Rayner, shows how to split a string by using a string instead of just a character. I am trying to split the string “this is my amazing string” on the pattern “my” by using “this is my amazing string”.split(“my”) but it’s giving me a bunch of garbled stuff back. How do I accomplish my goal?  You’ll have to use –split instead of .split(). Methods like .split() and .trim() take arrays of characters instead of strings. What happened to you is that your pattern, “my”, was treated as an array of characters and “this is my amazing string” was split on all of the “m”...

Oct 28, 2016
Post comments count 0
Post likes count 2

PowerShell regex crash course – Part 5 of 5

Doctor Scripto

Summary: Thomas Rayner, Microsoft Cloud and Datacenter Management MVP, shows the basics of working with regular expressions in PowerShell. Hello! I’m Thomas Rayner, a proud Cloud and Datacenter Management Microsoft MVP, filling in for The Scripting Guy! this week. You can find me on Twitter (@MrThomasRayner), or posting on my blog, workingsysadmin.com. This week, I’m presenting a five-part crash course about how to use regular expressions in PowerShell. Regular expressions are sequences of characters that define a search pattern, mainly for use in pattern matching with strings. Regular expressions are extremely ...

Oct 25, 2016
Post comments count 0
Post likes count 0

Join the PowerShell tenth birthday celebration

I_am_mr_ed

SUMMARY: Microsoft Scripting Guy Ed Wilson announces November 14, 2016 as date for PowerShell 10th anniversary celebration Can you believe that PowerShell is nearly 10 years old (that is a long time in 'internet time')? On November 14, 2016 we will celebrate the occasion with a day-long event that will run from 8 in the morning until 4 in the afternoon (PST). We will stream this live event on the Channel 9 homepage. This is going to be a day long extravaganza befitting the most awesome management, tool ever shipped. We will have segments on SQL and PowerShell, Azure Automation and PowerShell, the future of Powe...

Oct 21, 2016
Post comments count 0
Post likes count 0

PowerTip: How to use regular expressions to split a string without losing the character you split on

Doctor Scripto

Summary: Cloud and Datacenter Management MVP, Thomas Rayner, shows how to split a string without losing the character you split on. I’m splitting this file name some file.txt into its name and extension by going “some file.txt” –split “.”. It’s giving me some file and txt, but I want to keep the dot and get .txt instead. How can I do this? You can split on a regex lookahead and split on the space between characters where the character on the right is a dot