Friday 31 May 2013

Testing Windows Phone 8 with System Center 2012 Configuration Manager and Windows Intune

On 30/05/2013 Microsoft release a package that allows administrators to test Windows Phone 8 management via System Center 2012 Configuration Manager (ConfigMgr) and Windows Intune.

Previously the only way to test this feature was to purchase a Windows Phone Dev certificate which involved signing up as a developer at $99 and then purchasing a Symantec certificate at a further $299.

Now you can download this package from Microsoft which includes a pre-signed Company Portal, a script to set the relevant settings in ConfigMgr with a temporary token and also a couple of sample applications.

You can download the package here:

After downloading the MSI, run through the install which basically just extracts the files to a folder.  By default this is - C:\Program Files (x86)\Microsoft\Support Tool for Windows Intune Trial management of Windows Phone 8.

Create an Intune subscription in the System Center 2012 Configuration Manager SP1 console and leave WP8 disabled

Copy the SSP.XAP from the package extraction directory to a UNC available path.
Create an Application within the Configuration Manager console and deploy this application to cloud DP ( targeting cloud managed users
Watch out for the default name of the application and ensure you rename it to something a bit more friendly. 

Run through the deploy wizard and select as the distribution point

To enable management of WP8 devices open a command prompt and run the script ConfigureWP8Settings_Field.vbs (found in the package extraction directory) in query mode to get Company Portal name

cscript ConfigureWP8Settings_Field.vbs <server> QuerySSPModelName
Replace <server> with the server name for top level site (standalone site or CAS)
The result looks something like this "ScopeId_3C63FB50-0302-48CE-B076-5F93020AC548/Application_42291d36-6ffc-4d18-be78-9efdace3eef5".
This output will be used in the next step.

Run the script ConfigureWP8Settings_Field.vbs in save mode this time with the SSP name result.
This will populate the necessary certificate information to enable Windows Phone 8 device management

cscript ConfigureWP8Settings_Field.vbs <server> SaveSettings <Company Portal name>
where <Company Portal name> is the output from the earlier step.

After completion of the steps above, verify that WP8 device management is enabled by checking the ConfigMgr console by going to the Intune subscription properties, WP8 tab.
WP8 should be enabled, certificate should be present, and company portal app should be populated with the name you gave the Company Portal app when you set it up.

Assuming you have users sync'd up to the Intune/Azure directory and the UPN's match the accounts known by ConfigMgr, you should now be able to enrol users on their Windows Phone 8 devices.

Also included in this new package is some sample apps so that you can import something straight away for testing!

Sunday 26 May 2013

Migrate Knowledge Base Articles from Service Manager 2010 to 2012

To help ease the migration between Service Manager 2010 and 2012 (or even just one management group to another!) I've created a script that will export all of the Knowledge Articles, including the Rich Text used for the Analyst and End User content.

You can find the script here on the TechNet Gallery:

Download and extract the zip file and put the SCSMExportKB.ps1 file in a directory you have access to.

The script also relies on the SMLets from CodePlex found here which also makes this independent of which version of Service Manager you're running.

After you've installed the SMLets, launch a PowerShell session (Elevated as Admin) and ensure that the execution of scripts is allowed by typing:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted

Next navigate to the folder with the script and run it with the paramerter of where to export the KB Articles to.  If you do not specify a path it will default to exporting the KB Articles to the users temp folder.

For example I would run this to export to my downloads folder:

.\SCSMExportKB.ps1 C:\Users\SBAdmin\Downloads

The script will then start running and you will see the progress of it exporting to RTF files any Analyst or End User content and then the rest of the KB Article details.


Copy these exported files to the same location on the target server (or modify the csv to point to a new location) and then use the KBImport.xml provided in the zip file along with the Knowledge.csv created by the PowerShell script to import them into the target Service Manager system using the CSV Import Wizard.

N.B. Before you do the import, be sure to remove the first line of the CSV which has the headers in it!

And that should be that, one set of exported and imported Knowledge Articles.
There is one limitation however...
In this current version only the Out-Of-Box lists are supported.  I'm working on the script to handle custom list values and will update the solution when it's automated.  Until then you will need to find the enumeration ID's from your target site and replace the source ID's in the CSV file with the corresponding ones.
I'd also like to thank Anton Gritsenko (aka FreemanRU) for pointing me in the right direction for this script.

Wednesday 22 May 2013

Service Manager - Exporting the Knowledge Base Analyst and End User Comments

How can I export my knowledge base articles from Service Manager?

I've heard this question asked a few times now, especially when it comes to doing a migration rather than an upgrade from 2010 to 2012.

While it's fairly straight forward to output things like the Article ID, Title, Category etc using PowerShell, getting the Analyst and EndUser comments out is slightly more tricky due to them being stored as binary data within the database (They're RTF files basically).

While I may update this post to give a script that will export every last detail I'm pushed for time at the moment so I'll just post the most complicated part.

You can use the following PowerShell script to export the comments to individual rtf files for both Internal and Analyst comments.

$OutDir = "C:\KnowledgeFolder"
Get-SCSMClass -DisplayName "Knowledge Article" | Get-SCSMClassInstance | ForEach-Object {
If($_.EndUserContent -ne $null)
$br = new-object io.binaryreader $_.EndUserContent
$al = new-object collections.generic.list[byte]
while (($i = $br.Read()) -ne -1)
Set-Content ("$OutDir\$KBName"+"EndUserContent.rtf") $al.ToArray() -enc byte
If($_.AnalystContent -ne $null)
$br = new-object io.binaryreader $_.AnalystContent
$al = new-object collections.generic.list[byte]
while (($i = $br.Read()) -ne -1)
Set-Content ("$OutDir\$KBName"+"AnalystContent.rtf") $al.ToArray() -enc byte

I've only had a quick test of this within a 2012 environment which has the native Get-SCSMClass and Get-SCSMClassInstance cmdlets whereas 2010 doesn't. 

However with the SCSM Cmdlets from CodePlex this script should be easily adaptable for the 2010 environment.

You could then use either PowerShell to import them back into a new environment, or use Anders CSV import method shown on his post here

Travis also has a useful post with the Enum GUID's that you would need when importing via CSV here

Some useful details for working with Knowledge Articles in PowerShell:

Class Details:
DisplayName - Knowledge Article
Name - System.Knowledge.Article
ManagementPackName - System.Knowledge.Library

Some of the array contents:

Tuesday 14 May 2013

Problems Clustering Virtual Machines on Windows Server 2012 Hyper-V

I was re-building our lab environment at work the other week in preparation for our big Summit13 event, that and the lab had been trashed over the last year...

As part of the re-build I had decided to implement a couple of virtual machine clusters, one for a scale-out file server and one as a SQL cluster.

I'd deployed the virtual machines for the cluster nodes using Service Templates in SCVMM and as part of that template chosen to use an availability set to ensure the VM's were separated across hosts (a cluster doesn't provide much High Availability if they all reside on the same host that's failed!).

When I started to create the cluster I ran straight into a problem with the Failover Cluster Manager reporting problems due to timeouts when creating the cluster.

Creating a single node cluster worked fine, but then would again fail when trying to add in another node.

I happened to put one of the Hyper-V hosts into maintenance mode for something and it migrated all the VM's onto the same host, at which point creating the cluster worked flawlessly, yay!

However, when the Hyper-V host came back out of maintenance mode and the availability sets kicked in during optimisation forcing a VM node back onto a separate physical host, the clusters broke again, not yay :(

So after some Googling Binging about and a shout on Twitter (Thanks @hvredevoort and @WorkingHardInIT) an issue with Broadcom NICs was brought to my attention and I came across this TechNet Forum post talking about the same issue.

Sophia_whx suggested trying to use Disable-NetAdapterChecksumOffload on the NICs to help with the issue.

So, first things first.  Use the Get-NetAdapterChecksumOffload to see just what the configuration was and sure enough Checksum Offload is enabled for just about all services across the majority of the NICs.

I then used the Disable-NetAdapterChecksumOffload * -TcpIPv4 command which resulted in this:

A reboot later and then perform it on the second host and whoa....
For some reason, the virtual switch really didn't like having that done to it.
I wish I had some screenshots, but I went into "get it fixed fast" mode.
Basically the switch via powershell was showing as up, the NIC Teaming GUI was showing it down and all the bound adapters as failed. SCVMM had lost all configuration for the switch altogether.
Deleting the switch from SCVMM didn't delete it from the host, but brought it back to life on the host but was missing in SCVMM.  SCVMM then wouldn't redetect it or let you build it again as it was still there, apparently???
I had to manually remove the team from a remote NIC Teaming GUI (I could of PowerShell'd it I know!) and then recreated via SCVMM.
Anyway... at first this looked to have fixed the clustering within virtual machine issues, but it only delayed the symptoms i.e. it took longer to evict nodes and randomly brought them back online.
So next I tried disabling Checksum Offload for all services, being careful not to touch the Virtual Switch this time.
Rather than going adapter by adapter I used the following command:
Get-NetAdapter | Where-Object {$_.Name -notlike "Converged*"} | Disable-NetAdapterChecksumOffload
This resulted in the Checksum Offload being disabled for the various services as shown, except for my virtual switch.

After doing this on the other host and giving them a reboot, my clustered virtual machines appear to be nice and stable when split across physical hosts. Yay! Problem fixed.

Just as another side note about Broadcom adapters, there have also been reports of performance issues when the Virtual Machine Queue (VMQ) setting is enabled, despite it being a recommended setting.

A quick check of my hosts showed it was enabled:

Another quick PowerShell line later and it wasn't:

Get-NetAdapterVmq -InterfaceDescription Broad* | Disable-NetAdapterVmq