Get-AzBatchNodeFileContent

取得 Batch 節點檔案。

Syntax

Get-AzBatchNodeFileContent
   -JobId <String>
   -TaskId <String>
   [-Path] <String>
   -DestinationPath <String>
   [-ByteRangeStart <Int64>]
   [-ByteRangeEnd <Int64>]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzBatchNodeFileContent
   -JobId <String>
   -TaskId <String>
   [-Path] <String>
   -DestinationStream <Stream>
   [-ByteRangeStart <Int64>]
   [-ByteRangeEnd <Int64>]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzBatchNodeFileContent
   [-PoolId] <String>
   [-ComputeNodeId] <String>
   [-Path] <String>
   -DestinationPath <String>
   [-ByteRangeStart <Int64>]
   [-ByteRangeEnd <Int64>]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzBatchNodeFileContent
   [-PoolId] <String>
   [-ComputeNodeId] <String>
   [-Path] <String>
   -DestinationStream <Stream>
   [-ByteRangeStart <Int64>]
   [-ByteRangeEnd <Int64>]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzBatchNodeFileContent
   [[-InputObject] <PSNodeFile>]
   -DestinationPath <String>
   [-ByteRangeStart <Int64>]
   [-ByteRangeEnd <Int64>]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzBatchNodeFileContent
   [[-InputObject] <PSNodeFile>]
   -DestinationStream <Stream>
   [-ByteRangeStart <Int64>]
   [-ByteRangeEnd <Int64>]
   -BatchContext <BatchAccountContext>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

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 Job01 之作業標識碼 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 Job02 之作業標識碼 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 之作業的標識碼Task11的工作,取得名為 StdOut.txt的節點檔案。 命令會將檔案內容導向$Stream中的數據流。

範例 4:從計算節點取得節點檔案並加以儲存

Get-AzBatchNodeFileContent -PoolId "Pool01" -ComputeNodeId "ComputeNode01" -Path "Startup\StdOut.txt" -DestinationPath "E:\PowerShell\StdOut.txt" -BatchContext $Context

此命令會從具有ID Pool01之集區中標識碼 ComputeNode01 的計算節點取得 Node 檔案 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

此命令會從標識碼為 ComputeNode01 的計算節點使用 Get-AzBatchNodeFile 來取得節點檔案 Startup\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 之集區中標識碼 ComputeNode01 的計算節點,取得名為 StdOut.txt的節點檔案。 命令會將檔案內容導向$Stream中的數據流。

參數

-BatchContext

指定 此 Cmdlet 用來與 Batch 服務互動的 BatchAccountContext 實例。 如果您使用 Get-AzBatchAccount Cmdlet 來取得 BatchAccountContext,則與 Batch 服務互動時,將會使用 Microsoft Entra 驗證。 若要改用共用密鑰驗證,請使用 Get-AzBatchAccountKey Cmdlet 來取得已填入其存取密鑰的 BatchAccountContext 物件。 使用共用金鑰驗證時,預設會使用主要存取金鑰。 若要變更要使用的密鑰,請設定 BatchAccountContext.KeyInUse 屬性。

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

-ByteRangeEnd

要下載的位元組範圍結尾。

Type:Nullable<T>[Int64]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ByteRangeStart

要下載的位元組範圍開頭。

Type:Nullable<T>[Int64]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ComputeNodeId

指定計算節點的標識碼,其中包含這個 Cmdlet 傳回的節點檔案。

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

-DefaultProfile

用於與 azure 通訊的認證、帳戶、租用戶和訂用帳戶。

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DestinationPath

指定此 Cmdlet 儲存節點檔案的檔案路徑。

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

-DestinationStream

指定此 Cmdlet 寫入節點檔案內容的數據流。 此 Cmdlet 不會關閉或倒轉此資料流。

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

-InputObject

指定此 Cmdlet 取得的檔案,做為 PSNodeFile 物件。 若要取得節點檔案物件,請使用 Get-AzBatchNodeFile Cmdlet。

Type:PSNodeFile
Position:0
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-JobId

指定包含目標工作的作業識別碼。

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

-Path

要下載之節點檔案的路徑。

Type:String
Aliases:Name
Position:2
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PoolId

指定集區的標識碼,其中包含包含這個 Cmdlet 取得之節點檔案的計算節點。

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

-TaskId

指定工作的識別碼。

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

輸入

String

PSNodeFile

BatchAccountContext

輸出

Void