Running PSImportClient
PSImportClient is basically one script, PSImportClient.ps1 that acts as a control script depending on the PowerShell module Easit.PSImportClient.Commons. These two components together handles all flow control, error handling, logging and so on.
When you start PSImportClient.ps1, it will look for a PSImportClientSettings.json in the same directory as itself. If a settings file is found, it will use the settings to import modules and set up logging, this is referred to as the Initiation process. If, for some reason, the Initiation process fails a file named PSImportClient-init.log will be written in the same directory as PSImportClient.ps1 and include why the Initiation process failed.
PSImportClient.ps1 have two parameters, ConfigurationFile and ClientSettingsFile providing you a way to override the default settings file and what or which configurations files to use.
Parameters
Name | Description |
---|---|
ConfigurationFile | Path to configuration file for what to import to destination. |
ClientSettingsFile | Path to configuration file for how the PSImportClient script should behave. |
Manually
In its simplest form, ImportClient can be executed like this:
1 |
|
Examples
Example 1
1 |
|
In this example we let the script find all configuration files located in directory '.\configurations' and process them all. The script will run with the settings provided at 'D:\Easit\PSImportClient\myCustomSettings.json'
Example 2
1 |
|
In this example we want to run the script with only one configuration file, test.json. The script will run with the settings provided at '.\PSImportClientSettings.json'
Example 3
1 |
|
In this example we want to run the script with multiple configuration files. The script will run with the settings provided at '.\PSImportClientSettings.json'
Scheduled task
If you want to schedule PSImportClient to run on an interval or at certain times, use the Task Scheduler to schedule a task.
Examples
Example 1: Run as Windows Scheduled Task
- Command: pwsh
- Arguments: -NonInteractive -NoLogo -NoProfile -File "D:\Easit\PSImportClient\PSImportClient.ps1"
- WorkingDirectory: D:\Easit\PSImportClient
Example 2: Run as Windows Scheduled Task with specific configuration file
- Command: pwsh
- Arguments: -NonInteractive -NoLogo -NoProfile -File "D:\Easit\PSImportClient\PSImportClient.ps1" -ConfigurationFiles "D:\Easit\PSImportClient\configurations\test.json"
- WorkingDirectory: D:\Easit\PSImportClient