Adding or editing a Resource

You can add a new Resource or edit an existing Resource from a command line. For example, this allows you to create an automated (daily) process to add software updates as a Resource in Ivanti Automation and to create a report on the progress. This functionality is currently only available for Resources stored in the Datastore.

New Resource via command line

You can add a new Resource from the command line using the following parameters:

Parameter

Value

Functionality

/action

newresource

Specifies the action, in this case Add New Resource.

/targettype

<type>

Identifies the type of location where the Resource is added. Default and only value is:

  • datastore

/source

<path\filename>

Identifies the path and filename of the source. Environment variables are supported. Wildcard characters are not supported.

/folderGUID

<GUID>

Optional: specifies the GUID of the folder where the Resource is added. Please notice that the user needs modify access to this folder.

Specify resources or root to add the Resource to the root node Resources.

If the folder GUID is not a Resource folder or left empty, the action will fail.

/user

- and -

/password

<username>

- and -

<password>

Optional: specifies the Ivanti Automation credentials to access the Console. If not given, the Microsoft Windows Authentication credentials will be used to determine if the user has access to the Console and sufficient access to perform the action.

/description

<description>

Optional: adds a description text.

/special

<special>

Optional: enables or disables the special actions. The values are:

  • none: no parsing is used. Default value.
  • parse: Parse variables, parameters and functions in contents of this file
  • parsenoenv: Skip parsing of environment variables

/silent

 

Optional: no user interaction, such as message boxes, is shown when running this action.

Example

"C:\Program Files (x86)\Ivanti\Automation\Console\WMC.exe" /action=newresource /targettype=datastore /source="c:\Example\123.txt" /folderguid={12A34B56-7890-1234-5678-1234C5D678EF} /description="New resource added via commandline" /user=jsmith /password=secret /special=parsenoenv

When adding a Resource via the command line, it will inherit the trust data from the folder it is placed in.

Edit Resource via command line

You can edit an existing Resource from the command line using the following parameters:

Parameter

Value

Functionality

/action

editresource

Specifies the action, in this case Edit Resource.

/resource

<GUID>

Identifies the GUID of the Resource that needs to be edited.

/targettype

<type>

Identifies the type of Resource that needs to be edited. Default and only value is:

  • datastore

/source

<path\filename>

Identifies the path and filename of the source. Environment variables are supported. Wildcard characters are not supported.

/user

- and -

/password

<username>

- and -

<password>

Optional: the Ivanti Automation credentials to access the Console. If not given, the Microsoft Windows Authentication credentials will be used to determine if the user has access to the Console and sufficient access to perform the action.

/description

<description>

Optional: edit the descriptive text. Please notice that the current description will be replaced with the new value, also when this value is empty "".

/silent

 

Optional: no user interaction, such as message boxes, is shown when running this action.

Example

"C:\Program Files (x86)\Ivanti\Automation\Console\WMC.exe" /action=editresource /resource={12345678-AAAA-9988-7766-123456789AAA} /targettype=datastore /source="c:\Example\123.txt" /description="Edit-update via commandline" /user=jsmith /password=secret

When editing a Resource via the command line, its attributes and trust data will stay unchanged.

Return codes

Code

Explanation

0

Success

1

Failed

2

Aborted

5

Failed to login.

6

Source file not found -or- Invalid Source file.

7

Invalid Folder GUID.

8

Invalid Target type.

9

Insufficient access. The security role entered for "/user" has no modify access to the resources node.

10

Invalid value for parameter "special".

11

Edit Resource Failed: when saving changes to the Datastore.

12

New Resource Failed: when saving the new resource to the Datastore.

13

Invalid Resource GUID.