In Service Manager you have the option to attach files to work items. The max. number of attachments can be set using the general/global Incident settings in the SCSM console. The problem here is that the input validation does not allow you to set a value higher than 10. However, when you need more than 10 attachments per incident, this can still be configured using a simple script.
This requirement came from a customer requirement – he needed to have more than 10 attachments per incident. Before talking about how to configure that, let’s first take a look at the general incident settings.
A max. of 10 attachments can be configured here. If you need more, you can do so by using the following script that is based on the smlets PowerShell module.
$MaxNumber = 50
Import-Module smlets
$class = Get-SCSMClass System.WorkItem.Incident.GeneralSetting$
$inc = Get-SCSMObject -Class $class
Set-SCSMObject -SMObject $inc -Property MaxAttachments -Value $MaxNumber
Write-Host “Incidents can now have a max. of $MaxNumber attachments” –foregroundcolor yellow
This example script changes the max. value of attachments per incident to 50 and after a console restart you can attach more files. But if you afterwards check the general incident settings you will still see a max. of 10 attachments and that may be a bit confusing. The problem here is that when you hit OK here (maybe after changing another general incident value), the max. value for attachments will be set back to 10. If existing incidents already have more than 10 attachments, this change will have no impact on those. But it means that you have to rerun the script to change the value back to a higher value. If you want to automate this you can use Orchestrator or a custom SCSM workflow to automatically execute this script on a regular basis.
If you want to check the effective value that is set you can use this script.
Import-Module smlets
$class = Get-SCSMClass System.WorkItem.Incident.GeneralSetting$
$inc = Get-SCSMObject -Class $class
Write-Host “The max. number of attachments per incident is” $inc.maxattachments -foregroundcolor yellow
Cheers
Marcel
It’s unfortunate that this value doesn’t persist in the database. My DBA created a trigger to set the value back automatically rather than requiring the PowerShell script to be run everytime a change is made to Incident Settings. We have been running this in our test environment without any issues. Wondering if anyone else has used this approach?
In dbo.MT_System$WorkItem$Incident$GeneralSetting create a new trigger
USE [ServiceManager]
GO
/****** Object: Trigger [dbo].[TR_MT_System$WorkItem$Incident$GeneralSetting] Script Date: 07/08/2013 10:29:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[TR_MT_System$WorkItem$Incident$GeneralSetting]
ON [dbo].[MT_System$WorkItem$Incident$GeneralSetting]
AFTER UPDATE
AS
IF ( UPDATE (MaxAttachments_C4DA8670_A969_3B66_EF2D_C791CC6BA442) )
–BEGIN
–RAISERROR (60018, 16, 10)
–END;
–GO
UPDATE dbo.MT_System$WorkItem$Incident$GeneralSetting
SET MaxAttachments_C4DA8670_A969_3B66_EF2D_C791CC6BA442 = ’20’
WHERE MaxAttachments_C4DA8670_A969_3B66_EF2D_C791CC6BA442 BETWEEN 1 and 10 ;
Hey
Nice! Thanks for sharing!
Cheers
Marcel
Pingback: Increase the number of max. Incident Attachments to more than 10 - SysManBlog
Will this still work with SCCM 2012 R2