PowerShell Module

<< Click to Display Table of Contents >>

RayQC Advanced > 7.3 u4 > User Guide > Automation 

PowerShell Module

Certain actions on database and packages are exposed via the RayQC Advanced PowerShell module.

 

In order to get started, make sure that the module is imported. Invoke the following command in PowerShell terminal of your choice:

 

Import-Module "<RayQCAdvancedInstallDir>\Libs\Raynet.RayQCAd.Common.Automation.dll"

 

You can show the available commands by invoking the following PowerShell code:

 

 (Get-module  Raynet.RayQCAd.Common.Automation).ExportedCommands

 

Import-Package

Imports the specified package into the Software library.

 

Name 

Type 

Mandatory 

Description 

ExtractFiles

Boolean

No

A boolean value indicating whether the files should be extracted upon import (recommended).

File

FileInfo

Yes

The file to import (for example an MSI file).

Folder

String

No

The Software Library path where the package is to be imported to.

Name

String

No

The new package name of the imported package.

Package

PSPackage

Yes

The instance of PSPackage object (for reimporting).

Transforms

FileInfo[]

No

An optional list of transforms to apply upon import.

Vendor

String

No

The new vendor name of the imported package.

Version

Version

No

The new version name of the imported package.

 

 Returns PSPackage object with the newly imported package.

 

Get-Package

Gets a collection of PSPackage objects from a specified file path or from the library.

 

Name 

Type 

Mandatory 

Description 

Path

FileInfo

No

The path to a local file.

Transforms

FileInfo[]

No

An optional list of transforms (local files). This only applies to importing of MSI packages.

LibraryPath

String

No

The path in the Software library

Id

Integer

No

The internal package identifier.

All

Switch

No

If set, all packages from the library are returned.

 

Returns a collection of PSPackage objects.

 

Get-Rule

Gets a collection of PSRule rules from the database.

 

Name 

Type 

Mandatory 

Description 

RuleId

String

No

The name of the rule, using RayQC Advanced naming convention, for example TG* or TA-001-TA018.

RuleSetName

String

No

The full name of the ruleset.

All

Switch

No

If set, all rules from the library are returned.

 

Returns a collection of PSRule objects.

 

Start-Test

Performs a series of tests given the specified set of packages and rules.

 

Name 

Type 

Mandatory 

Description 

Rules

PsRule[]

Yes

The rules to be executed. You can get them using the Get-Rule command.

Source

PSPackage[]

Yes

The collection of source packages to be tested.

Target

PsPackage[]

No

The collection of target packages. This applies only to conflict checks.

Name

String

No

The name of the report

Comment

String

No

The comment to be added to the report.

DoNotAddToDatabase

Switch

No

If set, the checks are executed in a passive mode, where the results are not saved in the database. You should persist the results on your own.

 

Returns the results of a specified test encapsulated in a PSTestResult object.

 

Export-Report

Exports a report from the collection of results (contained in an object of type PSTestResult) and saves them in a specified format.

 

Name 

Type 

Mandatory 

Description 

TestResult

PSTestResult[]

Yes

The collection of test results. You can get them by invoking the Start-Test command.

Format

Enum

No

The report format.

Path

String

No

The path where the report is to be saved.

IncludeIssueDetails

Bool

No

A boolean value determining whether the issue details should be included in the output file.

IncludeRuleDetails

Bool

No

A boolean value determining whether the rule details should be included in the output file.

IncludeCustomFields

Bool

No

A boolean value determining whether the custom fields should be included in the output file.

IncludePackageInformation

Bool

No

A boolean value determining whether the package information should be included in the output file.

 

Returns an instance of FileInfo object representing the exported file.

 

Remove-Package

Removes a package from the library.

 

Name 

Type 

Mandatory 

Description 

Package

PSPackage

Yes

The package to be removed.

 

Remove-Report

Removes a report from the library.

 

Name 

Type 

Mandatory 

Description 

TestResult

PSTestResult

False

The instance of the PSTestResult object.

ReportId

Integer

False

The internal identifier of a report.

 

Start-AutoRemediation

Performs auto-remediation (when applicable) on a given test results.

 

Name 

Type 

Mandatory 

Description 

TestResult

PSTestResult

Yes

The instance representing the test results. You can get them using the Start-Test command.

RulesToFix

PSRule[]

No

The collection of rules to be auto-remediated. You can get them using the Get-Rule command.

FixMode

Enum

No

When applicable, sets the preferred type of remediation. Choose between the following values:

 

Light

Power

Ignore

 

Returns the results of a specified test encapsulated in a PSTestResult object.