Friday, 26 September 2014

Query the CMDB with PowerShell

With XIA Configuration Server version 6.2 we're now directly supporting the use of PowerShell to query the CMDB.

The following very simple example generates a PDF document for an item and opens the file in the default PDF document viewer.

  • In the example the PDF is generated for the item with ID 1031, however any valid item ID may be used. 
  • The output is returned from the server as a byte[] array, this is then saved to the filesystem before opening. In the example the file is saved to "c:\temp\sample.pdf", however any valid path may be used. 



Code Sample
Write-Host "Getting PDF data..."
$filename = "c:\temp\sample.pdf"
$binaryData = $xia.GET_PDFOutputBasic(1031)
[IO.File]::WriteAllBytes($filename,$binaryData)
[System.Diagnostics.Process]::Start($filename


Output





For more information see the PowerShell page of our web site
http://www.centrel-solutions.com/XIAConfiguration/features.aspx?feature=PowerShell

Or view the full documentation in the Administrator's Guide

No comments:

Post a Comment