PowerShell Changes Operation

Overview

A PowerShell Changes operation executes a given PowerShell script and determines whether there are changes based on whether the script returns true or false.

This operation allows users to define their own custom change detection mechanism for operation lists that cannot be described through the current set of agents.

Technical Requirements

There are a number of technologies that the PowerShell Script is dependant on. Specifically:

  1. PowerShell needs to be installed on the host machine of the UNIFYNow Service installation

Usage

The PowerShell Changes operation is used to describe whether an operation list should continue into its list of standard operations. It can be used in place of standard change detection mechanisms (e.g. the Active Directory Changes operation) for target systems that cannot be described with the available agents / operations.

Whether or not to continue is defined by whether the script returns a true or false in the global context of the script, which can be represented in any of the following manners:

return $true;
return $false;
return 1;
return 0;
return "True";
return "False";

Configuration

In addition to the common operation configurations shared by all Changes Operations, the PowerShell Changes operation requires the following by way of configuration:

Name Description
Script The plain-text PowerShell script to be executed. If the script returns true the operation list will continue, otherwise the operation list will stop.

Image 3548

Examples

The following are a few examples to get started:

Example 1

Changes have occurred if a file exists

return Test-Path 'C:\log\deltafile.txt';

Example 2

Changes always occur

return $true;

Eample 3

Compare the current and last changes with hypothetical methods LastChange and CurrentChange.

$currentChange = CurrentChange();
return $currentChange != $lastChange;
Operation Changes Operation PowerShell

Is this article helpful for you?