Hi All !
Ever tried to print a WorkItem ? Well i recommend – dont do that – because
what you get is a print of all properties from all tabs, without the selection method
to limit the outcome which might lead to a 6 or more page print.
A customer asked for a possibility to print selective data from a Service Request on one
because page because sometimes the field support has to have something printed.
The solution below consists of a PowerShell script which collects the infomation you want
and prints this within a nice HTML-based layout of your choice.
An output might look like this:
All you need is:
- The standard SCSM commandlets installed with the SCSM-Console
- Winword or your favorite HTML-Editor
- The Powershell script attached.
- A new task in SCSM
So how does it work ?
1.) Select which properties you want to show in the HTML Form.
This might be the Title, ID, Status and so on. The properties must be written inside
the HTML-form as placeholders for the data.
Furthermore, the properties must be placed into variables in the Powershell script
2.) Generate the HTML-Template
Open Winword, design your page with tables, fonts, … and place the variables inside
the template as shown in the screenshot below.
3.) Save as „Website -filtered“
4.) Paste the HTML Code in the Powershell script
In the Powershell Schript SRPrint.ps1 you find a section called:
$header = @“PLACE FOR HTML CODE„@
Replace the grey text with the HTML Code from the Winword file which will look like this:
5.) Create a task
In Service Manager – Library – Create a Task with no categories and the following parameters
The Powershell-script of the task needs one parameter -SRIdent which is the SR-ID. This
parameter is then handed over by SCSM to identify the Service Request.
Many thanks to Christian Graf from Asterios Design which lead me to the right direction on
howto call HTML from Powershell.
See the Powershell Script here.
Cheers / Roman