The following custom cmdlets and regular PowerShell cmdlets are allowed with Automate MFT.

For practical examples of using custom cmdlets, see Custom script samples.

Custom cmdlets

Customcmdlets are provided to manage cached files and session variables.

Custom cmdlets

Purpose

Add-MftItem -Name <string> -RelativeFolder <string> -Force

Adds a new item to the local cache. Throws an exception if an item with the same Name and RelativeFolder already exists, unless –Force is used.

Arguments:
  • Name Specifies the file name (no folders).
  • RelativeFolder Specifies the subfolder relative to the upload destination.
  • Force When set to true, overwrites an existing item instead of throwing an exception.

Get‑MftContent -Item <MftItem>

Gets the contents of a cached file and returns it as a string.

Get-MftItem

Retrieves all items stored in the local MFT cache, returned as an array of MftItem objects. Each object includes file metadata such as host origin, filename, and local file system path, as well as endpoint metadata.

The MftItem has following properties:
  • Name: The full name of the file, as it will be uploaded. Does not include folders.
  • RelativeFolder: The folder where the file will be uploaded. The folder is relative to the destination folder. For example, if an item has Name = file.txt, RelativeFolder = mybox/backfiles, and we have a local upload endpoint C:\tmp\myboxfiles, it will be uploaded as C:\tmp\myboxfiles\backfiles\file.txt.
  • Path: The file’s full path as stored on the operating system.
  • EndpointId: The unique identifier of the endpoint from which each file was downloaded.
  • EndpointName: The user-defined display name of the originating endpoint.
  • FileSize: The size of the cached file, in bytes.
  • LastWriteTimeUTC: The last write time of the cached file, returned as a UTC DateTime object.
  • LastAccessTimeUTC: The last access time of the cached file, returned as a UTC DateTime object.
  • Permissions: File permissions returned as a number in Unix-style format, for example, 755.

Get-MftParameter -Name <string>

Gets the value of a task parameter.

Arguments:
  • Name Specifies the name of the parameter.

Get‑MftVariable -Name <string>

Gets the value of a named session variable.

Remove‑MftItem -Item <MftItem>

Removes the specified file from the local MFT cache.

Rename-MftItem -Item <MftItem> -NewName <string> -NewRelativeFolder <string>

Renames a local cached file.

Arguments:
  • NewName Updates the file’s Name property. Required.
  • NewRelativeFolder: Updates the RelativeFolder property. Optional.

Set‑MftContent -Item <MftItem> -Value <string>

Sets the content of the specified cached file with the provided string value.

Set-MftParameter -Name <string> -Value <string>

Gets the value of a task parameter.

Arguments:
  • Name Specifies the name of the parameter.
  • Value Sets the value of the named parameter. This must be a string or a variable that contains a string.

Set‑MftVariable -Name <string> -Value <string>

Sets the value of a named session variable.

PowerShell cmdlets

A subset of standard PowerShell cmdlets is enabled for general scripting.

PowerShell Cmdlet

Purpose

Add-Member

Adds properties or methods to an object.

Clear-Content

Deletes the contents of an item.

Clear-Item

Deletes the contents of an item.

Compare-Object

Compares two sets of objects.

ConvertFrom-CliXml

Converts a CliXml-formatted string to an object.

ConvertFrom-Clixml

Converts CLIXML back into PowerShell objects.

ConvertFrom-Csv

Converts CSV text into objects.

ConvertFrom-Json

Converts JSON text into PowerShell objects.

ConvertFrom-Markdown

Converts Markdown into PowerShell objects.

ConvertFrom-SecureString

Converts a secure string into encrypted text.

ConvertFrom-StringData

Converts strings in key=value format into a hash table.

ConvertTo-CliXml

Converts an object to a CliXml-formatted string.

ConvertTo-Clixml

Converts objects to CLIXML (XML-based) format.

ConvertTo-Csv

Converts objects to CSV-formatted text.

ConvertTo-Html

Converts objects into HTML format.

ConvertTo-Json

Converts objects into JSON format.

ConvertTo-SecureString

Converts a string into a secure, encrypted string.

ConvertTo-Xml

Converts objects into XML.

ForEach-Object

Performs an operation on each pipeline item.

Format-Custom

Displays objects using a custom view.

Format-Hex

Displays binary data in hex format.

Format-List

Formats output as a list.

Format-Table

Formats output as a table.

Format-Wide

Displays one property per line across the screen.

Get-Content

Reads the contents of a file.

Get-Date

Gets the current date and time.

Get-FileHash

Computes the hash of a file.

Get-Member

Lists object properties and methods.

Get-Random

Selects a random item or random number.

Get-SecureRandom

Generates cryptographically secure random data.

Get-TimeZone

Gets the system’s current time zone information.

Get-Unique

Returns unique items from a sorted list.

Get-Uptime

Shows how long the system has been running.

Get-Variable

Retrieves PowerShell variables.

Group-Object

Groups objects by a specified property.

Import-Clixml

Imports a CLIXML file and creates corresponding objects.

Join-Path

Combines a path and a child path into a single path.

Join-String

Joins strings using a separator.

Measure-Object

Calculates statistics like count, sum, average.

Move-Item

Moves an item from one location to another.

New-Guid

Generates a new GUID value.

New-Item

Creates a new item.

New-List

Creates a new generic list object.

New-Object

Creates an instance of a .NET object.

New-PSObject

Creates a new custom PowerShell object.

New-TemporaryFile

Creates a temporary file on disk.

New-TimeSpan

Creates a time interval object.

Out-Host

Sends output directly to the console host.

Out-String

Sends output to a string instead of the console.

Rename-Item

Renames an item.

Select-Object

Selects specific properties or top/bottom items.

Select-String

Searches text using patterns or regex.

Select-Xml

Searches XML using XPath.

Set-Content

Writes or replaces content in a file.

Set-Item

Changes the value of an item to the value specified in the command.

Set-Variable

Creates or changes a variable.

Sort-Object

Sorts objects by a specified property.

Split-Path

Returns the specified part of a path.

Start-Sleep

Pauses execution for a specified time.

Update-List

Updates items in a list.

Where-Object

Filters objects based on a condition.

Write-Host

Writes text directly to the console.