New-FsrmAction

New-FsrmAction

Returns an FSRM action object.

Sintaxis

Parameter Set: CreateAction0
New-FsrmAction [-Type] <ActionTypeEnum> [-AsJob] [-Body <String> ] [-CimSession <CimSession[]> ] [-Command <String> ] [-CommandParameters <String> ] [-EventType <ActionEventTypeEnum> ] [-KillTimeOut <Int32> ] [-MailBCC <String> ] [-MailCC <String> ] [-MailTo <String> ] [-ReportTypes <ActionReportTypeEnum[]> ] [-RunLimitInterval <Int32> ] [-SecurityLevel <ActionSecurityLevelEnum> ] [-ShouldLogError] [-Subject <String> ] [-ThrottleLimit <Int32> ] [-WorkingDirectory <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Descripción detallada

The New-FsrmAction cmdlet returns a File Server Resource Manager (FSRM) action object. An FsrmAction object does not contain the trigger for the action. You can pass the action object to other cmdlets that use notifications and quota thresholds.

An FsrmAction object encapsulates a single action, such as sending an email. FSRM does not save an action object unless it is used as part of another object. For example, you can use an FsrmAction object to create notifications and quota thresholds. The saved object provides the trigger for the action.

The New-FsrmAction cmdlet supports the following actions:

-- Email: Send email to the user or administrator that the event triggered
-- Event: Create an event log entry
-- Command: Run a command that the administrator specifies
-- Report: Run one or more storage reports

Parámetros

-AsJob

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-Body<String>

Specifies the content of an email. If you specify this parameter, you must set Email or Event Specify for the Type parameter.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

True (ByPropertyName)

¿Aceptar caracteres comodín?

false

-CimSession<CimSession[]>

Ejecuta el cmdlet en una sesión remota o en un equipo remoto. Escriba un nombre de equipo o un objeto de sesión, como la salida de un cmdlet New-CimSession o Get-CimSession. El valor predeterminado es la sesión actual en el equipo local.

Alias

Session

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-Command<String>

Specifies the full path to the program or script. If you specify this parameter, you must set Command for the Type parameter.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

True (ByPropertyName)

¿Aceptar caracteres comodín?

false

-CommandParameters<String>

Specifies the parameters for the program or script. If you specify this parameter, you must set Command for the Type parameter.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

True (ByPropertyName)

¿Aceptar caracteres comodín?

false

-EventType<ActionEventTypeEnum>

Specifies the event type of the action. If you specify this parameter, you must set Event for the Type parameter. Los valores aceptables para este parámetro son los siguientes:
-- None
-- Information
-- Warning
-- Error

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

True (ByPropertyName)

¿Aceptar caracteres comodín?

false

-KillTimeOut<Int32>

Specifies the timeout period, in minutes, after which the process that the action created is ended. Specify the default, -1, to indicate that the server does not end the process. If you specify this parameter, you must set Command for the Type parameter.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

True (ByPropertyName)

¿Aceptar caracteres comodín?

false

-MailBCC<String>

Specifies a semicolon-separated list of email addresses for the Bcc recipients of an email. Valid email addresses are an administrator email account or the owner of the file. If you specify this parameter, you must set Email for the Type parameter.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

-1

¿Aceptar canalización?

True (ByPropertyName)

¿Aceptar caracteres comodín?

false

-MailCC<String>

Specifies a semicolon-separated list of email addresses for the Cc recipients of an email. Valid email addresses are an administrator email account or the owner of the file. If you specify this parameter, you must set Email for the Type parameter.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

True (ByPropertyName)

¿Aceptar caracteres comodín?

false

-MailTo<String>

Specifies a semicolon-separated list of email addresses for the recipients of an email. Valid email addresses are an administrator email account or the owner of the file. If you specify this parameter, you must set Email for the Type parameter.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

True (ByPropertyName)

¿Aceptar caracteres comodín?

false

-ReportTypes<ActionReportTypeEnum[]>

Specifies an array of report types that the action generates. If you specify this parameter, you must set Report for the Type parameter. Los valores aceptables para este parámetro son los siguientes:
-- DuplicateFiles
-- FilesByFileGroup
-- FilesByOwner
-- FilesByProperty
-- LargeFiles
-- LeastRecentlyAccessed
-- MostRecentlyAccessed
-- QuotaUsage

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

True (ByPropertyName)

¿Aceptar caracteres comodín?

false

-RunLimitInterval<Int32>

Specifies the minimum interval, in minutes, before the server can run the action again. For example, if the interval expired since the action last ran, the server runs the action again in response to an event; otherwise, the server cannot run the action again. The default value, 60, specifies that there is no limit.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

60

¿Aceptar canalización?

True (ByPropertyName)

¿Aceptar caracteres comodín?

false

-SecurityLevel<ActionSecurityLevelEnum>

Specifies the computer account type under which the program or script runs. Los valores aceptables para este parámetro son los siguientes:
-- LocalService
-- NetworkService
-- LocalSystem

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

LocalService

¿Aceptar canalización?

True (ByPropertyName)

¿Aceptar caracteres comodín?

false

-ShouldLogError

Indicates that the server records errors codes from running commands in the event log.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

True (ByPropertyName)

¿Aceptar caracteres comodín?

false

-Subject<String>

Specifies the subject of an email. The maximum size of a subject is 1 KB. If you specify this parameter, you must set Email for the Type parameter.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

True (ByPropertyName)

¿Aceptar caracteres comodín?

false

-ThrottleLimit<Int32>

Especifica el número máximo de operaciones simultáneas que se pueden establecer para ejecutar el cmdlet. Si se omite este parámetro o es especifica un valor de 0, Windows PowerShell ® calcula un límite óptimo para el cmdlet en función del número de cmdlets de CIM que se estén ejecutando en el equipo. El límite solo se aplica al cmdlet actual, no a la sesión ni al equipo.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-Type<ActionTypeEnum>

Specifies the type of the action. This setting determines the action that the server takes in response to a quota or file screen event. Los valores aceptables para este parámetro son los siguientes:
-- Email
-- Event
-- Command
-- Report

Alias

ninguno

¿Requerido?

true

¿Posición?

2

Valor predeterminado

ninguno

¿Aceptar canalización?

True (ByPropertyName)

¿Aceptar caracteres comodín?

false

-WorkingDirectory<String>

Specifies the working directory in which the program or script runs. You must specify a valid path to a folder. FSRM does not support paths to remote computers.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

True (ByPropertyName)

¿Aceptar caracteres comodín?

false

-Confirm

Solicita confirmación antes de ejecutar el cmdlet.

¿Requerido?

false

¿Posición?

named

Valor predeterminado

falso

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-WhatIf

Muestra lo que sucedería si se ejecutara el cmdlet. El cmdlet no se ejecuta.

¿Requerido?

false

¿Posición?

named

Valor predeterminado

falso

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

<CommonParameters>

Este cmdlet admite los siguientes parámetros comunes: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer y -OutVariable. Para obtener más información, consulte about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Entradas

El tipo de entrada es el tipo de los objetos que se pueden canalizar al cmdlet.

Salidas

El tipo de resultado es el tipo de objetos que emite el cmdlet.

Ejemplos

Example 1: Create an action that sends an email

This command returns an object that indicates that the server sends an email when an associated event occurs. The recipient of the email is the user sarah.jones@contosco.com and the CC recipient of the email is the administrator, john.smith@contosco.com.

PS C:\> New-FsrmAction Email -MailCC "john.smith@contosco.com" -MailTo "sarah.jones@contosco.com" -Subject "Warning: Approaching storage limit" -Body "You are about to reach the end of your available storage."

Example 2: Create an action that has a run limit

This command returns an object that indicates that the server sends an email to the administrator and the file owner when an associated event occurs. The command specifies that the event can trigger no more than once every 120 minutes. If the event does trigger, the action will have no effect before the time interval passes.

PS C:\> New-FsrmAction Email -MailTo "john.smith@contosco.com;sarah.jones@contosco.com" -Subject "Warning: Approaching storage limit" -Body "You are about to reach the end of your available storage." -RunLimitInterval 120

Example 3: Create an action that logs an event

This command returns an object that indicates the server logs an event that contains the specified message when an associated event occurs. The event should trigger no more than once every 180 minutes. If the event does trigger, no additional event log entries are created before the time interval passes.

PS C:\> New-FsrmAction Event -EventType Information -Body "The user [File Owner] is about to reach the end of his available storage." -RunLimitInterval 180

Example 4: Create an action that runs a command and logs errors

This command returns an object that indicates that when an associated event occurs, the server runs Cmd.exe with the specified parameters. The command specifies that the server records errors codes from the command in the error log.

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

Example 5: Create an action that runs a storage report

This command returns an object that indicates that the server runs LargeFiles and DuplicateFiles reports when an associated event occurs.

PS C:\> New-FsrmAction Report -ReportType @(LargeFiles, DuplicateFiles)

Temas relacionados

New-FsrmQuotaThreshold

New-FsrmFileScreen

New-FsrmStorageReport

New-FsrmScheduledTask

New-FsrmFileManagementJob

New-FsrmFMJNotification