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 {
$KBName=$_.ArticleId
If($_.EndUserContent -ne $null)
{
$br = new-object io.binaryreader $_.EndUserContent
$al = new-object collections.generic.list[byte]
while (($i = $br.Read()) -ne -1)
{
    $al.Add($i)
}
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)
{
    $al.Add($I)
}
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:
Abstract
AnalystContent
ArticleId
ArticleOwner
ArticleTemplate
ArticleType
AssetStatus
Category
Comments
CreatedBy
CreatedDate
DisplayName
EndUserContent
ExternalURL
ExternalURLSource
Keywords
Notes
ObjectStatus
PrimaryLocaleID
Status
Tag
Title
VendorArticleID
#Id
#Name
#Path
#FullName
#LastModified
#TimeAdded
#LastModifiedBy
EnterpriseManagementObject
RelationshipAliases

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

Friday, 5 April 2013

Service Manager & Cireson App Store Additions

I've recently had some interesting conversations with the guys from Cireson.

Cireson are a System Center consultancy firm in the USA who have developed from the needs of their customers a range of extensions to Service Manager which help fill some of the perceived gaps in the solution.

They have a range of solutions/extensions covering many different needs:
  • SCSM Web Console
  • SCSM Asset Management
  • SCSM My Work Items
  • SCSM Group Assign
  • SCSM Preview Pane
  • SCSM Tier Watcher
  • SCCM Power Manager
  • SCSM Auto Close
  • SCSM Notify Analyst
  • SCSM Customizations
  • SCSM Calendar Sync
  • SCSM Risk Calculator
  • SCSM Change Calendar
  • SCSM Asset Import
  • SCSM Affected User

One of the main areas I was interested in was the Asset Management solution, since that's where I began my Service Manager journey back in 2010.

Cireson have extended the console to provide you with a rich asset management solution, contained within the Configuration section of the console.

From here you can manage Contracts, Costs, Warranties, Organisational information as well as your various assets.

 
One area I specifically really do like is the Software Asset Management extensions, giving you the easy ability to start monitoring license counts and simplifying/rationalising the data pulled in from ConfigMgr in terms of versions and product names.



You can find more information about Cierson's selection of extensions for Service Manager here in their handy "App Store":
http://www.cireson.com/app-store/

I'll be posting some more around these great tools shortly so keep your eyes open for the posts!

Thursday, 4 April 2013

Orchestrator & VMware vSphere – Quiesce Snapshots

While there is an official VMware vSphere Integration Pack for Orchestrator available from Microsoft (here) I was working for a customer the other week where they had an extra need that the Create Snapshot activity didn’t seem to provide.

The customer as part of their SoP (Standard Operating Proceedure) have the requirement that all snapshots are quiesced for both memory and file operations during a snapshot activity.

While the vSphere IP activity allows you to set the option for capturing the memory state with the snapshot, there is no reference as to whether it quiesces the file system by default or not.

So the quickest way to achieve this, fall back to PowerShell and script it.

VMware have a PowerShell module available for vSphere known as PowerCLI.
Once I had downloaded and installed this on both the Runbook Designer workstations and the SCORCH server I started working on the script.

The script:
$VC = "<Insert vCenter Server>"

$VMName = "<Insert VM Name>"

$Snapshot = "<Insert VM Name>"

if(-not (Get-PSSnapin VMware.VimAutomation.Core -ErrorAction SilentlyContinue))



{
 
Add-PSSnapin VMware.VimAutomation.Core



}
 
Set-PowerCLIConfiguration -DefaultVIServerMode Single -InvalidCertificateAction Ignore -confirm:$false

Connect-VIServer -Server $VC -ErrorAction SilentlyContinue

Get-VM $VMName | New-Snapshot -Name $Snapshot -Memory:$true -Quiesce:$true -Description "Snapshot for protection while running automated process" -Confirm:$false



Basically this script will take the input of a virtual machine name and a name for the snapshot then perform a snapshot of the VM but with the options set to quiesce both the memory and file system.

Wednesday, 3 April 2013

Orchestrator & VMware vSphere – Calculate Datastore Capacity

While there is an official VMware vSphere Integration Pack for Orchestrator available from Microsoft (here) I was working for a customer the other week where I ran into a problem that meant we couldn’t use it and I had to work around it.

The problem looks to stem from having a vApp present within their vSphere environment, as discussed in this TechNet forum thread: http://social.technet.microsoft.com/Forums/en-US/scoscip/thread/2a1c03db-c24b-43c8-b035-f7c8cd6f6a83/

The biggest problem we had is that the Get Datastore Capacity activity which was failing was the very first step of the process that we were trying to automate.

The customer wanted to be able to check that there was sufficient space as dictated by their SoP (Standard Operating Proceedure) on the Datastore before taking snapshots of the VM’s.
So the quickest way to achieve this, fall back to PowerShell and script it.

VMware have a PowerShell module available for vSphere known as PowerCLI.
Once I had downloaded and installed this on both the Runbook Designer workstations and the SCORCH server I started working on the script.

N.B. There is also a community IP from Ryan Andorfer that wraps the PowerCLI into activities, but it's based on PowerCLI v4 and isn't compatible with PowerCLI v5 which is what I wanted to utilise.

This is a modified version of the script that LucD discusses on the VMware community forums here: http://communities.vmware.com/message/2119043

The script:

$VC = "<Enter vCenter name here>"

if(-not (Get-PSSnapin VMware.VimAutomation.Core -ErrorAction SilentlyContinue))


{
 
Add-PSSnapin VMware.VimAutomation.Core 

}
 
Set-PowerCLIConfiguration -DefaultVIServerMode Single -InvalidCertificateAction Ignore -confirm:$false

Connect-VIServer -Server $VC -ErrorAction SilentlyContinue

$VMInfo=Get-VM "<Enter VM Name here>" | Select Name, MemoryGB, UsedSpaceGB, @{N="Cluster";E={Get-Cluster -VM $_}}, @{N="ESX Host";E={Get-VMHost -VM $_}}, @{N="Datastore";E={Get-Datastore -VM $_}}

$ESXiHost=$VMInfo.ESXHost.name

$DSName=$VMInfo.datastore.name

$VMMem=$VMInfo.MemoryGB

$VMHD=$VMInfo.UsedSpaceGB

$Datastore=Get-Datastore -Name $DSName | select Name, @{N="Capacity";E={[Math]::Round($_.CapacityMB/1024,2)}}, @{N="FreeSpace";E={[Math]::Round($_.FreeSpaceMB/1024,2)}}

$Capacity=$Datastore.Capacity

$FreeSpace=$Datastore.FreeSpace

*Sorry about the formatting, blogger mangles code*

Basically this script will take the input of a virtual machine name, lookup which datastore the VM resides on and then query that datastore for the available free space and output it as a variable that we capture onto the SCORCH databus.
While I was writing the script and finding the datastore for the VM I thought we might as well pull back some other info regarding the VM and ESX host so the script also makes some more information available as variables that we can push back onto the databus.

Variables:
Datastore Name ($Datastore)
Datastore Capacity ($Capacity)
Datastore FreeSpace ($FreeSpace)
VM Assigned Memory ($VMMem)
VM Assigned Disk Size ($VMHD)
ESX Host running the VM ($ESXiHost)

Add this into a simple runbook as shown below and we can prompt for a virtual machine name (or pass it across from a calling runbook!), query vSphere for all the details and then return the data to be used as part of the further process.


MMS 2013 - Birds of a Feather Session

I've just had the e-mail I was hoping for - My BoF session nomination at the Microsoft Management Summit 2013 has been approved.



System Center 2012 Service Manager Cookbook - Desserts Chapter

Here's your chance to quiz the Authors of the System Center 2012 Service Manager Cookbook and get some more information on topics that we couldn't squeeze into the main book chapters. These could range from more advanced topics through to real-life deployment experiences. All the "dessert" information you can eat.

Join Myself (Steve Beaumont), Sam Erskine (MCT), Anders Asp (MVP), Dieter Gasser and Andreas Baumgarten (MVP) and ask us all those pressing SCSM questions that the book may not have answered.  There may even be a prize or two for the best questions!

Tuesday, 5 March 2013

Windows Phone 8 Company Portal 2.0

The Company Portal app for Windows Phone 8 has been updated to version 2.0 due to the problems found when using it with certain other languages.

The new v2.0 download can be found here:
http://www.microsoft.com/en-us/download/details.aspx?id=36060

According to MS Support the easiest way to get this out to devices will be:

If you are using this inside of System Center 2012 Configuration Manager you will need to turn off the Windows Phone Setting in the Windows Intune Connector, delete your existing SSP Package, Sign the XAP, Create a new SSP Package and redeploy, then add the setting for Windows Phone in the Windows Intune Connector. 
 
If you are using this inside of Windows Intune then you will need to sign the XAP, Upload the Package to Windows Intune, and then delete the old package as you cannot delete the old SSP until the new one is uploaded currently.