New-FsrmFmjAction

Returns an action object for file management jobs.

Syntax

New-FsrmFmjAction
   [-Type] <FmjActionTypeEnum>
   [-ExpirationFolder <String>]
   [-RmsFolderOwner]
   [-RmsFullControlUser <String[]>]
   [-RmsReadUser <String[]>]
   [-RmsWriteUser <String[]>]
   [-RmsTemplate <String>]
   [-Command <String>]
   [-WorkingDirectory <String>]
   [-CommandParameters <String>]
   [-SecurityLevel <FmjActionSecurityLevelEnum>]
   [-CimSession <CimSession[]>]
   [-ThrottleLimit <Int32>]
   [-AsJob]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The New-FsrmFmjAction cmdlet returns an object that you can use to create file management job actions. You can use the FsrmFmjAction object as input for the New-FsrmFileManagementJob cmdlet and the Set-FsrmFileManagementJob cmdlet.

The FsrmFmjAction object defines one action of the file management job when the job acts on a file. This cmdlet supports the following actions:

  • Expiration. Move the file to another location.
  • RMS. Encrypt the file (Rights Management Services).
  • Custom. Run a command.

Examples

Example 1: Create an action that expires files

PS C:\> New-FsrmFmjAction -Type Expiration -ExpirationFolder "C:\shares\expire01"

This command returns an object that expires files to the path C:\shares\expire01.

Example 2: Create an action that encrypts files by using an RMS template

PS C:\> New-FsrmFmjAction -Type RMS -RmsTemplate "Contoso Confidential"

This command returns an action object that encrypts a file to the Contoso Confidential RMS template. This command requires that an RMS template is configured on the RMS server named "Contoso Confidential".

Example 3: Create an action that encrypts files and assigns RMS permissions

PS C:\> New-FsrmFmjAction -Type RMS -RmsFullControlUser "admin@contoso.com" -RmsReadUser "AllStaff@contoso.com" -RmsWriteUser "AllFTE@contoso.com"

This command returns an action object that encrypts a file so that the administrator account in contoso.com has full control of the file, the ALLFTE security group has edit rights to the file, and the ALLStaff group has read rights to the file.

Example 4: Create an action that runs a command

PS C:\> New-FsrmFmjAction -Type Custom -Command "C:\windows\system32\cmd.exe" -CommandParameters "echo [source file path] >> c:\log.txt"

This command returns an action object that runs Cmd.exe and specifies the parameters for the command.

Parameters

-AsJob

Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete.

The cmdlet immediately returns an object that represents the job and then displays the command prompt. You can continue to work in the session while the job completes. To manage the job, use the *-Job cmdlets. To get the job results, use the Receive-Job cmdlet.

For more information about Windows PowerShell background jobs, see about_Jobs.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-CimSession

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

Type:CimSession[]
Aliases:Session
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Command

Specifies the command that the action runs. If you specify a command, you must specify Custom for the Type parameter.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-CommandParameters

Specifies the parameters that the action passes to the command when the action runs. If you specify parameters for a command, you must specify Custom for the Type parameter.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ExpirationFolder

Specifies a path that the action uses to expire files. If you specify an expiration folder, you must specify Expiration for the Type parameter.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-RmsFolderOwner

Indicates that the action adds the RMS FolderOwner to the Full Control list. If a FolderOwner is not available for a file, this setting has no effect.

If you specify an RMS folder owner, you must specify RMS for the Type parameter. If you specify this parameter, do not specify the RMSFullControlUser, RMSReadUser, or RMSWriteUser parameters.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-RmsFullControlUser

Specifies an array of email addresses to provide with full control to the Active Directory Rights Management Services (AD RMS) encryption. If you specify this cmdlet, you must specify RMS for the Type parameter. If you specify this parameter, do not specify the RMSTemplate parameter.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-RmsReadUser

Specifies an array of addresses to provide with read permission to the Active Directory Rights Management Services (AD RMS) encryption. If you specify this cmdlet, you must specify RMS for the Type parameter. If you specify this parameter, do not specify the RMSTemplate parameter.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-RmsTemplate

Specifies the name of the RMS template that the actions applies to files. If you specify an RMS template, you must specify RMS for the Type parameter. If you specify this parameter, do not specify the RMSFullControlUser, RMSReadUser, or RMSWriteUser parameters.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-RmsWriteUser

Specifies an array of addresses to provide with write permission to the Active Directory Rights Management Services (AD RMS) encryption. If you specify this cmdlet, you must specify RMS for the Type parameter. If you specify this parameter, do not specify the RMSTemplate parameter.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-SecurityLevel

Specifies the system account that the action uses to run the command that you specify in the Command parameter. If you specify this parameter, you must specify Custom for the Type parameter.

Type:FmjActionSecurityLevelEnum
Accepted values:None, NetworkService, LocalService, LocalSystem
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ThrottleLimit

Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If this parameter is omitted or a value of 0 is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Type

Specifies the type of action that the file management job performs. The acceptable values for this parameter are:

  • Expiration
  • RMS
  • Custom
Type:FmjActionTypeEnum
Accepted values:Expiration, Custom, Rms
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WorkingDirectory

Specifies the working directory in which the program or script runs. You must specify a valid path to a folder. File Server Resource Manager (FSRM) does not support paths to remote computers. If you specify this parameter, you must specify Custom for the Type parameter.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

Inputs

Microsoft.PowerShell.Cmdletization.GeneratedTypes.FmjActionTypeEnum

String

SwitchParameter

String[]

Microsoft.PowerShell.Cmdletization.GeneratedTypes.FmjActionSecurityLevelEnum

Outputs

CimInstance