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 recommended more 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 from for your purposes.

NOTE: This script is not Optimized for pulling DCS Events and as is should be left to only pulling other data such as but not limited to Assets, Statistics, Guest Virtual Machines etc...

Environmental Requirements:

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

After downloaded 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 setup on a custom port
  • ApiPort    -    Only change if setup on a custom port
  • ApiCall    -    This you must determine the API URI which you need to connect to from the DCS API Page then update accordingly.

Note:  If UMC is setup with IP you must specify the IP Address instead of the FQDN.

Attachments

Example_GetGVMs_ApiCall_v2-1.zip get_app