Tuesday, October 23, 2012

SCSM 2012 : Work Item Running Number


One counter for all types of work items:
For instance:

  • New Incident = IR1
  • New Change Request = CR2
  • Change Request contains 2 activities = RA3 and MA4
  • New Incident = IR5

and so on

All work items are sharing the same counter for ID. Only the prefix is added to this ID based on the work item class (IR, CR, PR, SR, MA, RA).
For this reason the ID is not increment uniformly for each type of work item.
This behavior can't be changed. 

However, you can set the starting number by changing a value in the database.

Basically there is this table in the ServiceManager database called the AutoIncrementAvailableRange table.  This value stores the next available number for a particular class property.  If the last work item ID that was handed out was 1234 this table would show 1235 and then once 1235 was used it would say 1236.  You get the idea.  So, by changing this number we can change the base number that we start from.  Let’s say for example that we always want our incident IDs to be in the 10,000+ range.  We could change thus number to 10000 and start from there.  Definitely don’t set it lower than the current number though!  That will most likely be very bad.

Use the SQL command below to set the new number you want
update AutoIncrementAvailableRange
set FirstAvailableValue = 10000 
where ManagedTypeId = 'F59821E2-0364-ED2C-19E3-752EFBB1ECE9' and ManagedTypePropertyId = '28B1C58F-AEFA-A449-7496-4805186BD94F'
Use the command below to check if the value changed to the one you set using command above
select
MT.TypeName,
MT.ManagedTypeId,
MTP.ManagedTypePropertyName,
MTP.ManagedTypePropertyID,
AIAR.FirstAvailableValue
from ManagedType as MT, ManagedTypeProperty as MTP, AutoIncrementAvailableRange as AIAR 
where MT.ManagedTypeId = AIAR.ManagedTypeId and MTP.ManagedTypePropertyId = AIAR.ManagedTypePropertyId
Notice that at the end of the role "System.WorkItem", at the "FirstAvailableValue" column, the number is the number you have set.



Saturday, July 28, 2012

Update Rollup 2 for SCSM 2012 released

It is available now for download. For those of you who having the following issues, please find yourself this update with this Rollup 2 release :-

  • The URL links to incidents or activities in the Notification Templates are incorrect. For more information about this issue, go to the following Microsoft TechNet website:
  • Including Links to Incidents or Activities in Notification Templates (SCSM 2012)
  • The time stamp for incidents that are created by using the SMTP connector are incorrect.
  • If you change the SharePoint site language in the Service Manager portal, an incorrect language may be displayed.
  • Service Manager does not generate an incident for alerts that are created by Operations Manager rules.
More information can be found at http://support.microsoft.com/kb/2706783.




Tuesday, May 22, 2012

Rapid VM deployment with Powershell on Hyper-V 3

I have conducted a web seminar for 'Microsoft Partner Readiness Webminar' Module 2a which focusing on working with Hyper-V 3 with Powershell.

In my first demo 'Demo1', I have showed to the audience on how we could rapidly deploy VMs Without the use of:-
1. Hyper-V Manager
2. System Center Virtual Machine Manager

The Power of Powershell in managing VMs in Hyper-V

Most of us thought that with the Hyper-V Manager, we could do most of the administrative tasks easily. Well, time to rethink if you have hundreds (if not thousands) of VMs running on you Hyper-V infrastructure and you have to do the following :-
1. To find out the Startup Memory, Minimum Memory and Maximum Memory each VM
2. To find out vCPU count of each VM
3. To find out the vSwitch and VLAN ID each VM connected
With the few tasks as listed, immediately we know how complicated things going to be, and a good example is that we have to right-click each and every VM, properties just to find out these information.

Let think this through with Powershell, you could simply use these to solve the tasks above :-
1. Get-VMMemory -VMNAME <vmname> | ft vmname, startupmemory, minimummemory, maximummemory
2. Get-VMProcessors -VMNAME <vmname> | ft vmname, count
3. Get-VMnetwork

How Aboout Bulk Creating VMs ?

Yes ! Of course we can do that, in fact there are numerous ways in getting this done. In this blog I am going to share with you how we pre-defined the VMs configuration in an CSV spreadsheet and then use powershell to created alll these VMs.

I have change the script I shared last at http://ariessysadmin.blogspot.com/2011/12/how-to-rapid-deploy-vm-using-powershell.html How-To: Rapid Deploy VM Using Powershell to the following

#BulkCreateVMs.ps1
$vmdefaultpath = "D:\VMs"
$ParentVHD = "D:\Hyper Base\WIN2K8R2SP1_Ent_Sysprep_180days_Updated20120404.vhd"
$path = "D:\vms\VMs.csv"
import-csv -path $path|ForEach-Object {
$erroractionpreference = 0    
$vmName = $_.Name
[int] $vmmemory = $_.Memory
$vmstartmemory=$vmmemory*1073741824
$vmcpucount = $_.Cpucount
$vmSwitch = $_.Network
$vmpath = $vmdefaultpath
#Create the VM
New-VM -Name $vmname -Path $vmdefaultpath
#Set the VM Memory properties
Set-VM -Name $vmname -StaticMemory -MemoryStartupBytes $vmstartmemory
#Set the vCPU
Set-VMProcessor -VMName $vmname -Count $vmcpucount
#Connect the VM to vSwitch
Connect-VMNetworkAdapter -VMName $vmname -SwitchName $vmSwitch
#Create VHD for the VM
New-VHD -Path $vmpath\$vmname\$vmname.vhd -ParentPath $ParentVHD
#Add the VHD to the VM to IDE 0 Location 0
Add-VMHardDiskDrive -vmname $vmname -ControllerType IDE -ControllerNumber 0 -Path $vmpath\$vmname\$vmname.vhd
Write-Host -BackgroundColor Green -ForegroundColor Black "Virtual Machine $vmname has been successfully created"     
}


The script above:-
1. Reads all VM configuration listed in VMs.csv and create in Hyper-V 3 host
2. Stores all VMs configuration files, snapshots, and VHDs in D:\VMs\
3. Creates diferrencing disk for each VMs with the Parent VHD in D:\Hyper Base\
4. Creates VMs with static memory


You have to change this script properties to suit your environment if you plan to use this.

Below is the video i have captured, showing how the script works for my demo.