Powershell script collection for ConfigMgr 2012

This post will contain all my scripts and snippets in zip format for download, that I use to manage my ConfigMgr environments or anything related to System Center 2012. I’m going to update this post with every script I write. These scripts should all work, you probably need to adjust some of those scripts to your environment as some of them still have hard-coded stuff in them. As always: No warranty Download all in one:  [Update] 22/11/2014 Fixed links I have fixed the link for the all-in-one download. I haven’t updated the zip file itself, but I will do that soon.

Install Windows features through PowerShell – by clicking

 Rebuilding my home lab with PowerShell I am currently rebuilding my home lab (again! This time properly, I promise.) and my goal is to use as much PowerShell as possible. I am building everything on a Dell XPS 15 laptop with a 1TB Samsung SSD and 16GB RAM. Enough for a mid-size mobile lab. The host runs Windows Server 2012 R2, what else? On top of that I have also installed the Windows Management Framework 5 November Preview in order to use all the latest and greatest features of PowerShell, for example Desired State Configuration in its latest version. Of course, I have also downloaded the DSC Resource Kit in … Continue reading

Import users to Azure and Office 365 with PowerShell

Mass import of users into a cloud directory with PowerShell By now you should already know that PowerShell should be the default tool for every IT Pro nowadays. Every new product and every new release of an existing product out of Microsoft is shipped with a PowerShell module, that’s a clear sign. It’s not only Microsoft, VMware, Citrix, Amazon, all big vendors make their products and services manageable via PowerShell. So get used to it This article will show you an end-to-end example of a PowerShell script that does a mass import of users into a Microsoft Azure Active Directory or Office 365 directory via PowerShell. Azure Active Directory won’t … Continue reading

Update SQL Always On Cluster with ConfigMgr & Powershell

How to update a cluster with a cluster-ignorant tool I’ve recently been tasked to create a process to patch SQL Always On Availability Groups (I guess calling it a cluster is not really accurate?!) with just the tools I had available, no new implementation of stuff. This meant to do a proper patching cycle (Operating System AND SQL) with graceful failovers of SQL roles from one node to the other, no data loss. So, quick inventory; what did I have? ConfigMgr 2012 R2 PowerShell Phew, PowerShell, you can do a lot with PowerShell. ConfigMgr, mhhh, ConfigMgr can do Software Updates and execute stuff on machines when it is told to … Continue reading

Recover deleted users in Azure Active Directory

You know of the recycle bin in Active Directory, right? I guess this feature has probably saved a bunch of people already big time. Anyways, even the cloud can’t save you from stupidity, failures or “Are you sure? Of course I’m sure!” situations when, for whatever reason, user accounts get deleted when they should not have been deleted. This scenario will specifically show how you can recover deleted user accounts both from Office 365 and also from Azure Active Directory. Azure Active Directory You can’t view deleted users in your Azure Portal (unless you can show me where!), too bad. Gone is gone. PowerShell to the rescue. Connect your PowerShell … Continue reading

Infrastructure Saturday Powershell scripts

You’ve been to Infrastructure Saturday in Brisbane / Queensland / Australia? (www.infrastructuresaturday.com) Awesome, hope you enjoyed it. You haven’t been? Try next time, until then, you can go and grab all the scripts I used during both my sessions here to test in your own environment. Azure Active Directory Identity Management Rich Identity Management session with James Bannan on Azure Active Directory: The web site I used to build the dummy user data is http://www.generatedata.com/ Service Management Automation and Powershell Service Management Automation Session: Scripts: Slides: Disclaimer! Please check all scripts before you execute them. Most only make sense in context but might demo some limited functionality.

Deploy SMA Server via Powershell DSC resource

Hi, I’m currently sitting on my plane from Minneapolis to Dallas. I love technology, WiFi on a plane, awesome!!! After two weeks of conferences (MVP Summit and MMS) I’m pretty exhausted and looking forward to get back home. I already wrote about how to deploy a SMA (Service Management Automation) runbook worker with the help of Powershell DSC (Desired State Configuration) here , but Microsoft has just the other day released the DSC Resource Kit Wave 8 with now in total more than 100 custom resources. Some of those are for System Center components, for example for SMA. DSC Resource for SMA (xSCSMA) The custom module released by Microsoft to … Continue reading

Backup Service Management Automation Sample Runbooks

I have just set up a new SMA and Windows Azure Pack (WAPack) environment and if you have ever deployed SMA, you know that it comes with a lot of sample runbooks, 25 for that matter. The runbooks overview in Azure Pack gets pretty crowded by that. Yes, you can search your runbooks, but it’s still not pretty.   That’s why I quickly wrote this little script which backs up the sample scripts to the file system and removes the sample runbooks from SMA. This way you can always re-import the runbooks if you like. Test the script before you use it in production! If you’re scared of what the … Continue reading

Powershell DSC on Azure

After my session at TechEd Australia (Sydney) on Powershell Desired State Configuration where I quickly demoed how DSC runs on your Azure IaaS Virtual Machines I now would like to go into a bit more detail. Microsoft enables you as an administrator to execute Powershell against your Azure environment, which basically makes it irrelevant where your workload is, you can manage it through Powershell. I said it before, I will say it again: Powershell is King! Need more general information on DSC? Go read some of my earlier articles on that topic. How does DSC work on Azure? A while ago Microsoft announced the availability of VM Extensions and one … Continue reading

Powershell DSC scripts from AuTechEd

Powershell Desired State Configuration Following my session on Powershell Desired State Configuration I am uploading all my scripts and snippets I showed during my PSDSC session in TechEd Australia in Sydney, and some more I didn’t get to show. Use these scripts and configurations in your test environment and learn how to use DSC and embrace the DevOps world. Download the examples here: I will update this article as soon as the recording and slides are up on Channel9. Hope you enjoyed my session and get to play with DSC very soon. -David

Upcoming speaking gigs 2014 / 2015

Seems to be my ‘year of conferences’ this year. Since moving to Australia in March 2014 I didn’t have a quiet and laid back month; and it won’t change in the next few months. Here’s my speaking schedule up until next February: Topic Date Event Powershell Desired State Configuration 27/10/2014-28/10/2014 TechEd Australia Sydney Service Management Automation / Azure Automation (with Trevor Sullivan) 11/11/2014-13/11/2014 Midwest Management Summit (Minneapolis / USA) Powershell Desired State Configuration (with Jeff Wouters) 11/11/2014-13/11/2014 Midwest Management Summit (Minneapolis / USA) Powershell Tips ‘n Tricks (co-presenting with Jeff Wouters and Trevor Sullivan) 11/11/2014-13/11/2014 Midwest Management Summit (Minneapolis / USA) Service Management Automation and ConfigMgr 11/11/2014-13/11/2014 Midwest Management Summit … Continue reading