Get-AzBatchNodeFileContent
语法
Task_Id_Path
Get-AzBatchNodeFileContent
[-Path] <String>
-JobId <String>
-TaskId <String>
-DestinationPath <String>
-BatchContext <BatchAccountContext>
[-ByteRangeStart <Int64>]
[-ByteRangeEnd <Int64>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Task_Id_Stream
Get-AzBatchNodeFileContent
[-Path] <String>
-JobId <String>
-TaskId <String>
-DestinationStream <Stream>
-BatchContext <BatchAccountContext>
[-ByteRangeStart <Int64>]
[-ByteRangeEnd <Int64>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ComputeNode_Id_Path
Get-AzBatchNodeFileContent
[-PoolId] <String>
[-ComputeNodeId] <String>
[-Path] <String>
-DestinationPath <String>
-BatchContext <BatchAccountContext>
[-ByteRangeStart <Int64>]
[-ByteRangeEnd <Int64>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
ComputeNode_Id_Stream
Get-AzBatchNodeFileContent
[-PoolId] <String>
[-ComputeNodeId] <String>
[-Path] <String>
-DestinationStream <Stream>
-BatchContext <BatchAccountContext>
[-ByteRangeStart <Int64>]
[-ByteRangeEnd <Int64>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzBatchNodeFileContent
[[-InputObject] <PSNodeFile>]
-DestinationPath <String>
-BatchContext <BatchAccountContext>
[-ByteRangeStart <Int64>]
[-ByteRangeEnd <Int64>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzBatchNodeFileContent
[[-InputObject] <PSNodeFile>]
-DestinationStream <Stream>
-BatchContext <BatchAccountContext>
[-ByteRangeStart <Int64>]
[-ByteRangeEnd <Int64>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
说明
Get-AzBatchNodeFileContent cmdlet 获取 Azure Batch 节点文件,并将其保存为文件或流。
示例
示例 1:获取与任务关联的 Batch 节点文件并保存文件
Get-AzBatchNodeFileContent -JobId "Job01" -TaskId "Task01" -Path "StdOut.txt" -DestinationPath "E:\PowerShell\StdOut.txt" -BatchContext $Context
此命令获取名为 StdOut.txt的节点文件,并将其保存到本地计算机上的 E:\PowerShell\StdOut.txt 文件路径。
StdOut.txt 节点文件与 ID 为 ID Job01 的作业具有 ID Task01 的任务相关联。
使用 Get-AzBatchAccountKey cmdlet 将上下文分配给$Context变量。
示例 2:获取 Batch 节点文件,并使用管道将其保存到指定的文件路径
Get-AzBatchNodeFile -JobId "Job02" -TaskId "Task02" -Path "StdErr.txt" -BatchContext $Context | Get-AzBatchNodeFileContent -DestinationPath "E:\PowerShell\StdOut.txt" -BatchContext $Context
此命令使用 Get-AzBatchNodeFile cmdlet 获取 StdErr.txt 命名的节点文件。
该命令使用管道运算符将该文件传递到当前 cmdlet。
当前 cmdlet 将该文件保存到本地计算机上的 E:\PowerShell\StdOut.txt 文件路径。
StdOut.txt 节点文件与 ID 为 ID Job02 的作业具有 ID Task02 的任务相关联。
示例 3:获取与任务关联的 Batch 节点文件并将其定向到流
$Stream = New-Object -TypeName "System.IO.MemoryStream"
Get-AzBatchNodeFileContent -JobId "Job03" -TaskId "Task11" -Path "StdOut.txt" -DestinationStream $Stream -BatchContext $Context
第一个命令使用 New-Object cmdlet 创建流,然后将其存储在$Stream变量中。
第二个命令从 ID Job03 的作业的 ID Task11 的任务中获取名为 StdOut.txt 的节点文件。
该命令将文件内容定向到$Stream中的流。
示例 4:从计算节点获取节点文件并将其保存
Get-AzBatchNodeFileContent -PoolId "Pool01" -ComputeNodeId "ComputeNode01" -Path "Startup\StdOut.txt" -DestinationPath "E:\PowerShell\StdOut.txt" -BatchContext $Context
此命令从具有 ID Pool01 的池中 ID ComputeNode01 的计算节点获取节点文件 Startup\StdOut.txt。
此命令将文件保存到本地计算机上的 E:\PowerShell\StdOut.txt 文件路径。
示例 5:从计算节点获取节点文件,并使用管道保存它
Get-AzBatchNodeFile -PoolId "Pool01" -ComputeNodeId "ComputeNode01" -Path "Startup\StdOut.txt" -BatchContext $Context | Get-AzBatchNodeFileContent -DestinationPath "E:\PowerShell\StdOut.txt" -BatchContext $Context
此命令通过使用 ID ComputeNode01 的计算节点节点中的 Get-AzBatchNodeFile 获取节点文件启动\StdOut.txt。
计算节点位于 ID Pool01 的池中。
该命令将该节点文件传递到当前 cmdlet。
该 cmdlet 将文件保存到本地计算机上的 E:\PowerShell\StdOut.txt 文件路径。
示例 6:从计算节点获取节点文件并将其定向到流
$Stream = New-Object -TypeName "System.IO.MemoryStream"
Get-AzBatchNodeFileContent -PoolId "Pool01" -ComputeNodeId "ComputeNode01" -Path "startup\stdout.txt" -DestinationStream $Stream -BatchContext $Context
第一个命令使用 New-Object cmdlet 创建流,然后将其存储在$Stream变量中。
第二个命令从具有 ID Pool01 的池中 ID ComputeNode01 的计算节点中获取名为 StdOut.txt 的节点文件。
该命令将文件内容定向到$Stream中的流。
参数
-BatchContext
指定此 cmdlet 用于与 Batch 服务交互的 BatchAccountContext 实例。
如果使用 Get-AzBatchAccount cmdlet 获取 BatchAccountContext,则在与 Batch 服务交互时将使用Microsoft Entra 身份验证。 若要改用共享密钥身份验证,请使用 Get-AzBatchAccountKey cmdlet 获取填充其访问密钥的 BatchAccountContext 对象。 使用共享密钥身份验证时,默认使用主访问密钥。 若要更改要使用的密钥,请设置 BatchAccountContext.KeyInUse 属性。
参数属性
参数集
(All)
| Position: | Named |
| 必需: | True |
| 来自管道的值: | True |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-ByteRangeEnd
要下载的字节范围的末尾。
参数属性
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-ByteRangeStart
要下载的字节范围的开始。
参数属性
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-ComputeNodeId
指定包含此 cmdlet 返回的节点文件的计算节点的 ID。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
ComputeNode_Id_Path
| Position: | 1 |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
ComputeNode_Id_Stream
| Position: | 1 |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-DefaultProfile
用于与 Azure 通信的凭据、帐户、租户和订阅。
参数属性
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-DestinationPath
指定此 cmdlet 保存节点文件的文件路径。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
Task_Id_Path
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
ComputeNode_Id_Path
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
InputObject_Path
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-DestinationStream
指定此 cmdlet 写入节点文件内容的流。
此 cmdlet 不会关闭或倒退此流。
参数属性
| 类型: | Stream
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
Task_Id_Stream
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
ComputeNode_Id_Stream
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
InputObject_Stream
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
指定此 cmdlet 作为 PSNodeFile 对象获取的文件。
若要获取节点文件对象,请使用 Get-AzBatchNodeFile cmdlet。
InputObject_Path
| Position: | 0 |
| 必需: | False |
| 来自管道的值: | True |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
InputObject_Stream
| Position: | 0 |
| 必需: | False |
| 来自管道的值: | True |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-JobId
指定包含目标任务的作业的 ID。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
Task_Id_Path
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
Task_Id_Stream
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-Path
要下载的节点文件的路径。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
| 别名: | Name |
参数集
Task_Id_Path
| Position: | 2 |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
Task_Id_Stream
| Position: | 2 |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
ComputeNode_Id_Path
| Position: | 2 |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
ComputeNode_Id_Stream
| Position: | 2 |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-PoolId
指定包含此 cmdlet 获取的节点文件的计算节点的池的 ID。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
ComputeNode_Id_Path
| Position: | 0 |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
ComputeNode_Id_Stream
| Position: | 0 |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-TaskId
指定任务的 ID。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
Task_Id_Path
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
Task_Id_Stream
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters。
输出