3.9 Policy Actions

-policy

Performs operations on a policy. When it is used without policy action options, all policies on the server are listed.

Syntax

DswCli.exe -policy 
         [-add | -modify | -delete | -detail | -associate | -disassociate] 
         [policy_parameter] 
         [policy_option]
         [authentication_parameters] 

For information about how to provide the servername and login credentials that are needed to connect to the server that you want to manage, see Section 3.3, Authentication Parameters.

3.9.1 Policy Parameters

This section describes the following common policy parameters:

-description

Specifies a textual description of the policy. The description is optional.

Syntax

-description=<"text">

Example

-description="Move graphics to secondary weekly"
-policyId

Specifies the policy identifier. You can provide the policy name, or provide the GUID of the policy.

Syntax

-policyId=<"policyname"|"GUID">

Examples

-policyId="myPolicy"

-policyId="My JPG and BMP Policy"

-policyId="My Last Modified GT 6 Months Policy"
-policyIdList

Specifies a comma-separated list of policyId parameters. For each policy, you can provide the policy name, or provide the GUID of the policy.

If the policy list is not specified, all policies that are associated with the specified pair are run.

Syntax

-policyIdList=<"<policyname|GUID>[,<policyname|GUID>,...]">

Example

-policyIdList="myPolicy,myPolicy100"

3.9.2 Add a Policy

-add

The -add action creates the policy with the specified name and stores the configuration as an XML file in the C:\ProgramData\Dynamic File Services\Policies folder.

Syntax
DswCli.exe -policy 
         -add 
         ‑name=<policyname>
         [-description"text"]
         directionOption
         filterOptions 
         frequencyOptions
         [authentication_parameters] 

After you add a policy, you must associate it with one or more pairs before you can run it on the pairs. For information, see Section 3.8.7, Associate a Pair and Policy

You can run a policy manually, or associate it with a policy schedule to run it automatically. For information, see Section 3.10.3, Add a Policy Schedule and Section 3.9.7, Associate a Policy Schedule to a Policy.

Add Policy Parameter
-name

Specifies a name for the policy. The name must be unique on the server you are managing.

Syntax

-name=<"policyname">

Example

-name="myPolicy"
Add Policy Direction Option

Choose one of the direction options in combination with the -add action.

-primaryToSecondary

Specifies the direction to move files. If a direction option is not specified, the default direction is primary to secondary.

Restriction: This option cannot be used with the -secondaryToPrimary option.

-secondaryToPrimary

Specifies the direction to move files. If a direction option is not specified, the default direction is primary to secondary.

The -secondaryToPrimary option is valid on a standard pair, but not on a retention pair.

Restriction: This option cannot be used with the -primaryToSecondary option.

Add Policy Filter Options

Specify the following as filter options in combination with the -add action. Filter options are applied in combination to determine which files you want to move. All of the specified filter options must be met in order for the file to be moved.

You can specify one or more filter options in the same policy. Only one filter option of each type can be used in the same policy.

Filters set in the same policy are enforced as AND conditions. A file must meet all filter conditions to be moved. For example, if you specify a filter with the file extension option for files ending in *.jpg and *.gif, then any file with either of the specified extensions is moved. If you specify a second filter with a file size option for files with a file size greater than 5 MB, only the *.jpg and *.gif files that have a file size greater than 5 MB are moved.

Filters set in different policies that run at the same time are enforced as OR conditions. A file that meets the conditions in any one of the policies is moved. In the example above, if each of the filters was set in two separate policies and both policies run at the same time, then a file is moved if it ends in *.jpg or *.gif, or the file is moved if it is greater than 5 MB with any file extension.

The following filter options are available:

-fileSize

Specifies the file size of files to filter for movement.

Syntax

-fileSize=<"ccn[...]uu">

Where:

  • cc = gt or lt conditional
  • n[...] = any length numeric value
  • uu = units of size

Valid uu values are:

  • b=bytes
  • kb=kilobytes
  • mb=megabytes
  • gb=gigabytes

Examples

Move all files that are greater than 1 GB in size:

 -fileSize="gt1gb" 

Move all files that are less than 100 KB in size:

 -fileSize="lt100kb"
-lastAccessed

Moves files that meet the specified condition based on the last accessed time.

Syntax

-lastAccessed=<"ccn[...]u">

Where

  • cc = gt or lt conditional
  • n[...] = any length numeric value
  • u = units of time

Valid u values are:

  • d = days
  • w = weeks
  • m = months
  • y = years

Examples

Move all files that have a last accessed time greater than 10 days old:

-lastAccessed="gt10d" 

Move all files that have a last accessed time less than 5 weeks old:

-lastAccessed="lt5w" 
-lastModified

Moves files that meet the specified condition based on the last modified time.

Syntax

-lastModified=<"ccn[...]u">

Where

  • cc = gt or lt conditional
  • n[...] = any length numeric value
  • u = units of time

Valid u values are:

  • d = days
  • w = weeks
  • m = months
  • y = years

Examples

Move all files that have a modified time greater than 10 days old:

-lastModified="gt10d" 

Move all files that have a modified time less than 5 weeks old:

-lastModified="lt5w" 
-filePattern, -fileExtension

Moves files that match a specified file pattern. Moves files that have the specified file extensions. An asterisk (*) can be used as a wildcard character. Separate multiple entries with a comma.

Syntax

-fileExtension=<"extensionList">

The -fileextension option has been aliased to -filePattern.

-filePattern="patternList"

Examples

Move all .jpg files and .gif files:

-filePattern="*.jpg,*.gif"

-fileExtension="*.jpg,*.gif"

Move all files that begin with gw that have the file extension .mail:

-filepattern="gw*.mail"

Move all .txt files:

-filePattern="*.txt"
-fileTypes [-fileContent]

Moves files based on the file type. Separate multiple entries with a comma. Use the -fileTypes option in combination with the -fileContent option to additionally use the file content to determine which files to move.

File types are the MIME content types or perceived types of file extensions that are associated with applications installed on the server. These types appear in the server’s Windows Registry.

You can also use the perceived file types that are defined in the Dynamic File Services\DswFileTypes.cfg file. The file lists well-known file extensions and their perceived types. Each line in the DswFileTypes.cfg contains a file extension and its perceived type. For example:

.doc/document

You can customize the list by using a text editor to add or remove file extension entries in the proper format. The file types and extensions can be listed in any order.

Syntax

-fileTypes=<"typeList"> [-fileContent]

Valid types are:

application
audio
compressed
image
message
model
system
text
video

Examples

Move video and audio files:

-fileTypes="video,audio"

Move video and audio files based on file content:

-fileTypes="video,audio" -fileContent
-fileContent

Use the -fileContent option in combination with the -fileTypes option to additionally use the file content to determine which files to move. The policy moves a file only if its content matches the MIME type of the specified file type. Checking the file content increases the time needed to process the files during a policy run. Required parameter: -fileTypes.

Syntax

-fileContent

Examples

Move video and audio files based on file content:

-fileTypes="video,audio" -fileContent
-fileOwners

Move files based on identity.

You can specify one or more valid usernames in order to move files based on file ownership. For usernames, files are moved if they are owned by any of the specified users.

IMPORTANT:The CLI does not verify the usernames that you add. Make sure to enter valid usernames. Invalid usernames are ignored when the policy runs.

Syntax

-fileOwners=<"userList">

Example

-fileOwners="user1,user2"
-groups

Move files based on group identity.

You can specify one or more valid group names in order to move files based on file ownership. For usernames, files are moved if they are owned by any users listed as members of the group when the policy runs.

IMPORTANT:The CLI does not verify the group names that you add. Make sure to enter valid group names. Invalid group names are ignored when the policy runs.

Syntax

-groups=<"groupList">

Example

-groups="group1,group2"
-noOwner

Use the -noOwner option to move ownerless files. Files are considered to be ownerless if the user name or group name has been removed from the Active Directory domain or the server’s Users and Groups list. A file retains the Security Identifier (SID) of that user or group even after the associated name becomes invalid.

Syntax

-noOwner

Example

-noOwner
Add Policy Examples

Each of the following -policy commands creates a policy with one type of filter. The direction option is not set in these policies, so data is moved in the default direction of primary to secondary.

Example: Policy to Filter by File Extension
DswCli.exe -servername=localhost -u=Administrator -p=novell 
         -policy 
         -add 
         -name="My Pictures Policy" 
         ‑fileExtension="*.jpg,*.bmp,*.gif"
Example: Policy to Filter by File Size
DswCli.exe -servername=localhost -u=Administrator -p=novell 
         -policy 
         -add 
         -name="My Size GT 1GB Policy" 
         ‑fileSize="gt1gb"
Example: Policy to Filter by Last Modified Date
DswCli.exe -servername=localhost -u=Administrator -p=novell 
         -policy 
         -add 
         -name="My Last Modified GT 10 Days Policy"
         ‑lastModified="gt10d"
Example: Policy to Filter by File Content for Video and Audio Files
DswCli.exe -servername=localhost -u=Administrator -p=novell 
         -policy 
         -add 
         -name="Files with invalid owners"
         ‑fileTypes=audio,video
         -fileContent
Example: Policy to Filter by Ownerless Files
DswCli.exe -servername=localhost -u=Administrator -p=novell 
         -policy 
         -add 
         -name="Files with invalid owners"
         ‑noowner

3.9.3 Modify a Policy

-modify

The -modify action modifies a specified policy and stores the new configuration in the policy’s XML file in the C:\ProgramData\Dynamic File Services\Policies folder.

Syntax
DswCli.exe -policy 
         -modify
         ‑policyId=<"policyname"|"GUID">
         [‑name=<policyname>]
         [-description"text"]
         directionOption
         filterOptions 
         frequencyOptions
         [authentication_parameters] 

For information about the options, see Section 3.9.2, Add a Policy.

For modifying a policy, the required parameters are policy and policyId. Name, description, direction, and filter options can be changed. Policy GUIDs cannot be changed.

The changes apply to all pairs that are associated with the policy.

Modify Policy Examples

Each of the following -policy commands modifies a policy that has one type of filter.

Example: Policy to Filter by File Extension

Modify a policy to add .mp3 files to the list of file extensions. Change the policy name from “My Pictures Policy” to “My Pictures and Music Policy”:

DswCli.exe -servername=localhost -u=Administrator -p=novell 
         -policy 
         -modify 
         -policyId="My Pictures Policy" 
         -name="My Pictures and Music Policy" 
         ‑fileExtension="*.jpg,*.bmp,*.gif"
Example: Policy to Filter by File Size

Modify a policy that moves files bigger than 1 GB to move only files bigger than 2 GB. Change the name to reflect the new setting:

DswCli.exe -servername=localhost -u=Administrator -p=novell 
         -policy 
         -modify
         -policyId="My Size GT 1GB Policy"
         -name="BIG FILES GT 2GB Policy" 
         ‑fileSize="gt2gb"
Example: Policy to Filter by Last Modified Date

Modify a policy that moves files based on last modified date greater than 10 days to one greater than 10 months:

DswCli.exe -servername=localhost -u=Administrator -p=novell 
         -policy 
         -add 
         -policyId="My Last Modified GT 10 Days Policy"
         -name="My Last Modified GT 10 Months Policy"
         ‑lastModified="gt10m"

3.9.4 Delete a Policy

-delete

The -delete action removes the specified policy from the database. All links to any pairs are removed.

Syntax

DswCli.exe -policy 
         -delete 
         ‑policyId=<"policyname"|"GUID">
         [authentication_parameters] 

Example

The following -policy command deletes the DynamicFS policy named myPolicy on the specified server:

DswCli.exe -servername=localhost -u=Administrator -p=novell 
         ‑policy 
         -delete 
         -policyId="myPolicy"  

3.9.5 List All Policies

(no action options)

When the -policy action option is used without any other parameters or options, all policies on the server are listed.

Syntax

DswCli.exe -policy
         [authentication_parameters] 

Example

The following -policy command displays a list of all policies on the specified server:

DswCli.exe -servername=localhost -u=Administrator -p=novell 
         ‑policy 

3.9.6 List Details for a Policy

-detail

The -detail action provides a details for a a specified policy, including the direction that files are moved, the filter options, the policy schedule, and its associated pairs. You must specify the policyId parameter for the policy.

Syntax

DswCli.exe -policy 
         -detail 
         -policyId=<"policyname"|"GUID">
         [authentication_parameters] 

Example

The following -policy command lists details for the DynamicFS policy named myPolicy on the specified server:

DswCli.exe -servername=localhost -u=Administrator -p=novell 
         ‑policy 
         -detail 
         -policyId="myPolicy"

3.9.7 Associate a Policy Schedule to a Policy

-associate

When the -scheduleId parameter is used with the -associate action for a policy, it links a specified policy schedule to a specified policy. You must specify the policyId parameter for the policy that you want to associate, and the scheduleId parameter for the policy schedule.

Syntax

DswCli.exe -policy 
         -associate
         ‑policyId=<"policyname"|"GUID"> 
         -scheduleId=<"schedulename"|"GUID">
         [authentication_parameters] 

Example

The following -policy command associates the policy named myPolicy with the policy schedule named Weekends on the specified server:

DswCli.exe -servername=localhost -u=Administrator -p=novell 
         ‑policy 
         -associate 
         -policyId="myPolicy" 
         ‑scheduleId="Weekends"

3.9.8 Disassociate a Policy Schedule from a Policy

-disassociate

When the -scheduleId option is used with the -disassociate action for a policy, it removes the association between a specified policy and schedule. You must specify the policyId parameter for the policy. You must specify the scheduleId parameter for the schedule that you no longer want to be associated with the policy.

Syntax

DswCli.exe -policy 
         -disassociate 
         ‑policyId=<"policyname"|"GUID"> 
         -scheduleId=<"schedulename"|"GUID">
         [authentication_parameters] 

Example

The following -policy command removes the association between the policy named myPolicy and the schedule named Weekends on the specified server:

DswCli.exe -servername=localhost -u=Administrator -p=novell
         ‑policy 
         -disassociate 
         -policyId="myPolicy"
         ‑scheduleId="Weekends"

3.9.9 Associate a Policy and a Pair

See Section 3.8.7, Associate a Pair and Policy.

3.9.10 Disassociate a Policy and a Pair

See Section 3.8.8, Disassociate a Pair and Policy.

3.9.11 List Policies Associated with a Pair

See Section 3.8.12, List Details for a Pair.