Skip to main content

Automating collector runs on Windows machines

This topic provides a step-by-step guide on securely operating collector runs on Windows Operating Systems using JAR files. It is important to note that various credential vaults can be used depending on your requirements. This document presents one example of a secure pattern to execute the collector.

Important

This guide is for running collectors on Windows Operating Systems using JAR files.

STEP 1: Set up pre-requisites

You will need the following installed or configured to run the collector.

STEP 1: Set up the collectors

  1. Follow the instructions for preparing to run the collectors using JAR files.

  2. When you run the Collector Wizard, note down the list of the environment variables to be created for the collector.

    note_variables.png

STEP 2: Create Windows accounts

  1. Create or identify a Windows administrator account to install PowerShell modules and schedule tasks in Task Scheduler.

  2. Create or identify a Windows account to run the collector and store and retrieve the credentials.

STEP 3: Install the Credential Manager Module

  1. Click Start, select Windows PowerShell, and then click Windows PowerShell ISE. Right-click on Windows PowerShell ISE and select Run as administrator.

  2. Run the following command to check if the Credential manager module is installed.

    Get-Module -ListAvailable -Name CredentialManager

    If the Credential Manager module is installed, the command returns details of the module. If it returns no output, it means the module is not installed.

  3. If PowerShell does not have the Credential Manager module, install it using the following command from the PowerShell console. Make sure to follow the instructions that appear during the process of installation.

    Install-Module CredentialManager

STEP 2: Set up Windows Credential Manager for storing credentials

This section will guide you on how to set up the credentials in the Windows Credential Manager.

  1. Right-click PowerShell ISE and select Run as different user. to run PowerShell ISE as the Windows account setup for running the collector.

    1. From the Powershell console a prompt window opens.

      windows_01.png
    2. Provide the credentials for running the collector. This includes the API token and any other collector specific credentials that should be stored in the Windows Credential Manager. These are the environment variables you noted in the pre-requisite tasks. If only an API token is needed to connect to a system, you can store the API token as a password.

  2. Alternatively, you can set these from the Windows Credential Manager.

    1. Open Control Panel.

    2. Click User Accounts.

    3. Click Credential Manager.

      windows02.png
    4. Click Windows Credentials.

    5. Create a new credential or select an existing credential and click Edit.

    6. Update the username and password with the credentials for your source system and the data.world API token.

STEP 3: Create a script for running the collector

This section walks through how to set up an example script to fetch credentials from a vault (in this case, Windows Credential Manager) and runs the collector with the credentials.

  1. Create a new PowerShell script. Note that no credentials are stored in the script. In this example script the data.world API token ($ddwapitoken) and credentials for Tableau ($username, $password), are retrieved from the Windows Credential Manager.

    $credentials=Get-StoredCredential -Target "data.world api token"
    $ddwapitoken=$credentials.GetNetworkCredential().Password
    $credentials=Get-StoredCredential -Target "Tableau credentials"
    $username=$credentials.GetNetworkCredential().Username
    $password=$credentials.GetNetworkCredential().Password
    
    java -jar C:/Programs/data.world/dwcc.jar catalog-snowflake \
    -A -a "<org name>" -s "<server>" -d "<database>" -n "<catalog name>" \
    -u $username -P $password --api-token=$ddwapitoken \
    -r "<role>" -o "/dwcc-output" -U --upload-location="<dataset>"
  2. Save the script.

  3. Click the Run command button to run the collectors.

STEP 4: Set up a schedule for running the collectors

This section guides you on how to set a schedule for running the collectors.

  1. Open Computer Manager as an Administrator.

  2. Navigate to System Tools > Task Scheduler.

  3. Click on Create Basic Task to add a new Task.

  4. Give the task a name, such as Run data.world collector for Tableau.

  5. Set the schedule (For example, Daily at 3 AM).

  6. Set Action to Start a Program.

  7. Set program/script to PowerShell: powershell

  8. For Add arguments, set the value to -File [path] where [path] is the path to the PowerShell script you had set here.

  9. Close and save the task. A task is now available in the Task Scheduler Library.

  10. Double-click to open the task.

  11. In the General tab, under Security options, click on Change User or Group. Select the Windows account that is created for running the collector and has access to the credentials set in the Windows Credential Manager. Click OK.

  12. In the General tab, under Security options, select Run whether the user is logged on or not.