Automating the Removal of Old Office Versions and Upgrade to 2016

By | February 2, 2017

The end-of-life for the click-to-run version of Office 2013 is quickly approaching (February 28th, 2017). This is a quick reference on how to automate the deployment of Office 2016 to your environment, while also fulfilling the prerequisite of removing any previous versions of Office (including 2013).

Step 1 – Automate the uninstall of previous versions of Office

Installing Office 2016 will not do this on its own, unfortunately. There are several ways to uninstall previous Office versions, but the most reliable I have found in my experience is to use the available OffScrub scripts from Microsoft, which can be extracted from the EasyFix uninstallers for Office 2003, 2007, and 2010. For Office 2013 and 2016, a separate script can be run to automate the uninstall using O15CTRRemove.diagcab. All scripts can be combined and run from a single package/program using SCCM. There is a great guide available from Jay Michaud on how to do all of this: https://www.deploymentmadscientist.com/2016/02/08/deploying-microsoft-office-2016-removing-old-versions/

Step 2 – Automate the installation of Office 2016

There are several guides on how to use the Office 2016 Deployment Tool, which allows you to download the Office 365 client installation files and package them up for deployment. This reference guide contains all available commands to customize the XML file which controls how Office 2016 is downloaded, installed, and configured. The final step is to package it up for deployment in SCCM. All of these steps are outlined here: https://www.systemcenterdudes.com/sccm-2012-office-2016-deployment/.

Step 3 – Deploy both packages simultaneously with Configuration Manager

Of course, you will want to run step 1 and step 2 together to minimize the amount of time that users are without Office on their systems. You can deploy sequential applications in SCCM by using software packages (setting the uninstall program to always run first in the install program properties), by using software applications (setting a software dependency for the uninstall script to run prior to install), or by using a task sequence that contains all of the steps (task sequences can do more than just deploy an OS, after all). As always (and especially with multi-step software deployments), be sure to test deployment with a few pilot systems before running it for all of production.

Microsoft has done a good job of making Office settings/profiles migrate easily to new versions, and the same is true for 2016. Outlook will automatically upgrade any existing mail profiles when run for the first time and should not require any special configuration from the user.

SQL Query to Export All SCCM Maintenance Windows

By | December 13, 2016

Maintenance windows tend to be illusive in Configuration Manager, especially in large environments with multiple admins. A common request that I receive from my customers is to “retrieve all of maintenance windows.” There isn’t a great report for this or an easy way to do this with PowerShell (yet). The easiest method I’ve found to do this with the most detailed information is through a simple SQL Query on the CM database.

query

SELECT c.Name, c.Comment,SW.IsEnabled, SW.CollectionID, c.MemberCount, SW.Description, SW.StartTime, SW.Duration

FROM v_ServiceWindow SW

JOIN v_Collection C ON C.CollectionID = SW.CollectionID

ORDER BY c.Name

The results of this query will give you the Name, Comments, Date/Time/Frequency, and Duration for every maintenance window in your environment, as seen below.

queryresults

 

In-Console Updates Stuck Installing in ConfigMgr: How To Fix It

By | October 19, 2016

Disclosure: do not follow these steps if you do not know what you’re doing. They should only be used as a last resort. Use with caution.

I’ve had a couple different SCCM environments get stuck during update installations that have come down through the new Updates and Servicing feature in the current branch builds. Typically, this does not happen but I have yet to determine the root cause. It’s very important to note that updates that come down through the console can take a significant amount of time to install and you should be patient. I would recommend waiting several hours for them to complete while checking dmpdownloader.log for the real-time status. You should also close and reopen the SCCM console before taking any action – it may just be waiting for you to relaunch the console to install a newer version of the console.

This fix will help you if your hotfix updates are stuck in the Installing state, like so:

su1

There were no actions available to resolve the state of these hotfixes from the SCCM console, and restarting the SMS_EXECUTIVE service and CONFIGURATION_MANAGER_UPDATE services and the server itself did not help in this case, either. It actually looked like the hotfixes successfully applied weeks ago, yet the state had not been updated. The workaround for this was to change the status of these hotfixes directly in the CM database, which should be considered a last resort in any scenario. There’s a simple SQL query to do this from SQL Server Management Studio, which originated from this TechNet article from an earlier Technical Preview version:

EXEC spCMUSetUpdatePackageState N'd26be618-1df5-4680-a65f-03cec6abc7ec', 262146, N''

You will need to modify the above query with the metadata string from the corresponding update. To find which string to use, go to your SCCM installation directory open the EasySetupPayload folder that serves as the cache for in-console updates, and find the folder name for the hotfix that is stuck. In this case, I ran the query twice – once for each hotfix that was stuck installing.

su2

After executing the query and refreshing the SCCM console, the status was cleared immediately and I was able to proceed with the install the latest branch release.

su3

 

WSUS Synchronization Failures in SCCM with HTTP Status 503

By | September 19, 2016

I ran into a new error today during a WSUS synchronization for SCCM Software Updates. Synchronizations had been running fine for a while, but it would fail after running for an extended amount of time. The error was easy to find in the wsnycmgr.log file in the Configuration Manager logs:

wsus

Usually when synchronization fails, it does so immediately due to WSUS not being configured properly, WSUS missing a hotfix, or not being mapped to the proper ports in IIS.

After a bit of research, I found a very useful article saying that the WSUS Application Pool in IIS may be running out of memory during synchronization. To help identify this issue, you will see the 503 error in wsyncmgr.log, and the Application pool for WSUS will be stopped in IIS when it fails:

image1_thumb_4c714962

To fix the issue, you can set the Private Memory Limit to 4000000 or 8000000 as recommended in the article and restart the application pool. You can then trigger a manual synchronization and monitor the log again.

image6_2e26926c

So far in testing this change in other environments, it appears that it can significantly improve performance and cut down on those sync times as well.

Bulk Assign Licenses in Office 365 Using PowerShell

By | September 13, 2016

If you manage an Office 365 tenant, you are probably familiar with assigning licenses to provision services for users. That process is pretty straightforward for a single user.

license1

But how do you do it for a hundred or thousand people in your organization? PowerShell.

First, you will need to connect to Office 365 via PowerShell. If you haven’t done this before, follow these steps to install the prerequisites.

To connect to O365/MSOnline, use the following command:

Import-Module MSOnline
Connect-MsolService

You will be prompted for credentials – this needs to be a user with at least user management role permissions, but most operations in this module will require global admin permissions.

Next, you will need to get a list of licenses available in your tenant. This can be viewed easily in the admin portal under Billing, but is identified by the AccountSkuID in PowerShell. To generate a list of what is available and assigned, run the following command:

Get-MsolAccountSku

The results will contain your tenant name and sku and looks something like this:

license2

If you’re using E1/E3 licenses, they will have a name like “tenantname:ENTERPRISEPACK” or “tenantname:STANDARDPACK”.

Now that you know what you have available to assign, you need to determine which users will be assigned a license. This can be a difficult task, especially in larger organizations.

If you’re lucky enough to just assign all users in your tenant a license, your process will be relatively simple. Prior to assigning licenses, you must assign a location. This is a required field and is done by country. This will essentially provision the Exchange Online mailbox in the proper region and ensure that it follows all local laws, etc.

To assign the US location to a single user, you would use the following command:

Set-MsolUser user@domain.com $upn -UsageLocation US

All countries follow the 2-letter ISO code standard – a list of those can be found here.

Now, we’re using PowerShell – we want to actually bulk assign licenses and locations, not just do single users. To assign the US location to all of your tenant users, use the following command:

Get-MsolUser -All | Set-MsolUser -UsageLocation US

To verify the results, use the following command:

Get-MsolUser -All | Select DisplayName,UsageLocation

Once the location is assigned either through the admin portal or PowerShell, you can assign licenses. The following command would assign an E3 license to all users in the US only:

Get-MsolUser -All -UsageLocation ‘US’ | Set-MsolUserLicense -AddLicenses “tenantname:ENTERPRISEPACK”

There are several other properties that may be useful in narrowing down the scope of users to bulk assign licenses to. Use the following command to view only users that do not have a license assigned:

Get-MsolUser -UnlicensedUsersOnly

This command will assign licenses only to users with a specific domain name:

Get-MsolUser -All -DomainName ‘joshheffner.com’ | Set-MsolUserLicense -AddLicenses “tenantname:ENTERPRISEPACK”

A full list of properties to use with Get-MsolUser can be found here.

What if it isn’t this straightforward in your organization? You may have several countries, types of licenses, or maybe you want to assign licenses in batches. Sometimes it’s just easiest to assign both the location and license at the same time from a CSV file – this is usually the preferred method in larger organizations. This operation can be done with a simple PowerShell script (download it here):

license4

The above script references users in a CSV file containing users’ UPN, location, and license to assign. It looks like this (download it here):

license3

You will need to modify the script to use the correct path to the CSV file.

If you need to generate a list of users in your O365 tenant, including their UPN, location, and whether or not a license is currently assigned, you can use the following command:

Get-MsolUser | select-object DisplayName,UserPrincipalName,UsageLocation,IsLicensed

Your results will look similar to this:

license5

To export the same data to a CSV file, add a bit more to the end:

Get-MsolUser | select-object DisplayName,UserPrincipalName,UsageLocation,IsLicensed | export-csv C:\pathtofile\o365export.csv -notype