beckhoff TE1000 — 6.18 Write-MdpTransferObject

TcXaeMgmt Version 7.X | Write-MdpTransferObject ---------- ---------- ------ ----------------- NIC ApplyNetworkSettings 0 Success (no data) Executes the operation with a custom timeout of 60 seconds and a polling interval of 500 ms. Example 6 # Multi-field operation using a hashtable - keys match the DTO constructor parameters (case- insensitive):

PS> Write-MdpTransferObject -Module FileSystemObject -MethodName 'CopyFile' -Value @{ >> SourcePath = 'C:\TwinCAT\Boot\OldConfig.xml' >> DestinationPath = 'C:\TwinCAT\Boot\Backup\OldConfig.xml' >> Flags = 1 >> } -Quiet -Confirm:$false ModuleType MethodName Status StatusDescription Output ---------- ---------- ------ ----------------- ------ FileSystemObject CopyFile 0 Success (no data) Copies a file on the target using a hashtable to specify multiple input fields. The hashtable keys (SourcePath, DestinationPath, Flags) are matched to the FsoCopyFileInput constructor parameters. This works on all PowerShell hosts (5.1+, 7.x).

Example 7 # Multi-field operation using a JSON string - parsed and mapped to the DTO constructor: PS> $json = '{"SourcePath":"C:\\TwinCAT\\Boot\\Config.xml","DestinationPath":"C:\\Backup\ \Config.xml","Flags":1}' PS> Write-MdpTransferObject -Module FileSystemObject -MethodName 'CopyFile' -Value $json -Quiet - Confirm:$false ModuleType MethodName Status StatusDescription Output ---------- ---------- ------ ----------------- ------ FileSystemObject CopyFile 0 Success (no data) Uses a JSON object string as input. JSON keys are matched case-insensitively to the DTO constructor parameters. Note: backslashes in file paths must be escaped as in JSON.

Example 8 # Multi-field operation using a pre-constructed typed DTO: PS> $dto = [TwinCAT.Mdp.FsoCopyFileInput]::new('C:\Source\File.txt', 'C:\Dest\File.txt', 1) PS> Write-MdpTransferObject -Module FileSystemObject -MethodName 'CopyFile' -Value $dto -Quiet - Confirm:$false ModuleType MethodName Status StatusDescription Output ---------- ---------- ------ ----------------- ------ FileSystemObject CopyFile 0 Success (no data) Passes a fully typed IMdpTransferInput DTO directly. This is the most explicit form and avoids any runtime type resolution. Use Get-MdpModules -ServiceObjects to discover the input type for each operation.

Example 9 # Reading structured output - operations that return data expose an Output property: PS> $result = Write-MdpTransferObject -Module FileSystemObject -MethodName 'Dir' -Value 'C: \TwinCAT\Boot\*' -Quiet -Confirm:$false PS> $result.Output Entries TotalSize Path ------- --------- ---- {file1, file2} 4096 C:\TwinCAT\Boot When the operation returns structured output (IMdpTransferOutput), the result's Output property is a PSObject with the DTO's public properties exposed as NoteProperties. TE1000 95 Version: 1.5.0