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
Follow the instructions for preparing to run the collectors using JAR files.
When you run the Collector Wizard, note down the list of the environment variables to be created for the collector.
STEP 2: Create Windows accounts
Create or identify a Windows administrator account to install PowerShell modules and schedule tasks in Task Scheduler.
Create or identify a Windows account to run the collector and store and retrieve the credentials.
STEP 3: Install the Credential Manager Module
Click Start, select Windows PowerShell, and then click Windows PowerShell ISE. Right-click on Windows PowerShell ISE and select Run as administrator.
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.
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.
Right-click PowerShell ISE and select Run as different user. to run PowerShell ISE as the Windows account setup for running the collector.
From the Powershell console a prompt window opens.
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.
Alternatively, you can set these from the Windows Credential Manager.
Open Control Panel.
Click User Accounts.
Click Credential Manager.
Click Windows Credentials.
Create a new credential or select an existing credential and click Edit.
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.
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>"
Save the script.
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.
Open Computer Manager as an Administrator.
Navigate to System Tools > Task Scheduler.
Click on Create Basic Task to add a new Task.
Give the task a name, such as Run data.world collector for Tableau.
Set the schedule (For example, Daily at 3 AM).
Set Action to Start a Program.
Set program/script to PowerShell: powershell
For Add arguments, set the value to -File [path] where [path] is the path to the PowerShell script you had set here.
Close and save the task. A task is now available in the Task Scheduler Library.
Double-click to open the task.
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.
In the General tab, under Security options, select Run whether the user is logged on or not.