Example PowerShell Script for DCS 6.x REST API
search cancel

Example PowerShell Script for DCS 6.x REST API

book

Article ID: 174455

calendar_today

Updated On:

Products

Data Center Security Server Data Center Security Server Advanced

Issue/Introduction

In DCS 6.x, it is more recommended to query DCS using the API whenever possible, rather than connecting to the database, and an example to start from is needed.

Resolution

The attached script is a PowerShell 3 and newer compatible script provided as an "As Is" example that can be built upon for your purposes.

NOTE: This script is not optimized for pulling DCS Events and should be used only for pulling other data such as Assets, Statistics, Guest Virtual Machines, etc.

Environmental Requirements:

  • PowerShell version 3+
  • UMC's Certificate imported into the Trusted Root Certification Authorities certificate store
  • DNS (or hosts file) must resolve the FQDN to the appropriate IP Address

After downloading, you must edit the script to populate the following:

Required fields:

  • UmcFqdn - You must use the FQDN, or PowerShell Security will cause connection problems.
  • Username - If UMC is integrated with Active Directory, you must use two backslashes between Alias and Username. Example: domain\username
  • Password
  • OutputPath - The path specified here must include the filename. Example: C:\Reports\filename.csv

Required to run but change if needed:

  • UmcPort - Only change if set up on a custom port.
  • ApiPort - Only change if set up on a custom port.
  • ApiCall - You must determine the API URI, which you need to connect to from the DCS API Page, then update accordingly.

Note: If UMC is set up with an IP, you must specify the IP Address instead of the FQDN.

 

Attachments

Example_GetGVMs_ApiCall_v2-1.zip get_app