你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Get-AzureBatchComputeNode
从池中获取 Batch 计算节点。
警告
截至 2024 年 2 月 29 日,AzureRM PowerShell 模块已正式弃用。 为了确保持续获得支持和更新,建议用户从 AzureRM 迁移到 Az PowerShell 模块。
尽管 AzureRM 模块仍可能正常运行,但它不再维护或受支持,但会根据用户的自由裁量权和风险继续使用任何继续使用模块。 有关过渡到 Az 模块的指导,请参阅我们的迁移资源。
语法
Get-AzureBatchComputeNode
[-PoolId] <String>
[-Filter <String>]
[-MaxCount <Int32>]
[-Select <String>]
-BatchContext <BatchAccountContext>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzureBatchComputeNode
[-PoolId] <String>
[[-Id] <String>]
[-Select <String>]
-BatchContext <BatchAccountContext>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzureBatchComputeNode
[[-Pool] <PSCloudPool>]
[-Filter <String>]
[-MaxCount <Int32>]
[-Select <String>]
-BatchContext <BatchAccountContext>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
说明
Get-AzureBatchComputeNode cmdlet 从池中获取 Azure Batch 计算节点。 指定 PoolID 或 Pool 参数。 指定 ID 参数以获取单个计算节点。 指定 Filter 参数以获取与开放数据协议 (OData) 筛选器匹配的计算节点。
示例
示例 1:按 ID 获取计算节点
PS C:\>Get-AzureBatchComputeNode -PoolId "Pool06" -Id "tvm-2316545714_1-20150725t213220z" -BatchContext $Context
Id : tvm-2316545714_1-20150725t213220z
Url : https://cmdletexample.westus.batch.azure.com/pools/MyPool/nodes/tvm-2316545714_1-20150725t213220z
State : Idle
StateTransitionTime : 7/25/2015 9:36:53 PM
LastBootTime : 7/25/2015 9:36:53 PM
AllocationTime : 7/25/2015 9:32:20 PM
IPAddress : 10.14.121.1
AffinityId : TVM:tvm-2316545714_1-20150725t213220z
VirtualMachineSize : small
TotalTasksRun : 1
StartTaskInformation :
RecentTasks : {}
StartTask :
CertificateReferences :
Errors :
此命令从 ID 为 Pool06 的池中获取 ID tvm-2316545714_1-20150725t213220z 的计算节点。 使用 Get-AzureRmBatchAccountKeys cmdlet 将上下文分配给$Context变量。
示例 2:从池获取所有空闲计算节点
PS C:\>Get-AzureBatchComputeNode -PoolId "Pool06" -Filter "state eq 'idle'" -BatchContext $Context
Id : tvm-2316545714_1-20150725t213220z
Url : https://cmdletexample.westus.batch.azure.com/pools/MyPool/nodes/tvm-2316545714_1-20150725t213220z
State : Idle
StateTransitionTime : 7/25/2015 9:36:53 PM
LastBootTime : 7/25/2015 9:36:53 PM
AllocationTime : 7/25/2015 9:32:20 PM
IPAddress : 10.14.121.1
AffinityId : TVM:tvm-2316545714_1-20150725t213220z
VirtualMachineSize : small
TotalTasksRun : 1
StartTaskInformation :
RecentTasks : {}
StartTask :
CertificateReferences :
Errors :
Id : tvm-2316545714_2-20150726t172920z
Url : https://cmdletexample.westus.batch.azure.com/pools/MyPool/nodes/tvm-2316545714_2-20150726t172920z
State : Idle
StateTransitionTime : 7/26/2015 5:33:58 PM
LastBootTime : 7/26/2015 5:33:58 PM
AllocationTime : 7/26/2015 5:29:20 PM
IPAddress : 10.14.121.38
AffinityId : TVM:tvm-2316545714_2-20150726t172920z
VirtualMachineSize : small
TotalTasksRun : 0
StartTaskInformation :
RecentTasks :
StartTask :
CertificateReferences :
Errors :
此命令获取 ID Pool06 的池中包含的所有空闲计算节点。 该命令使用 Filter 参数指定空闲状态。
示例 3:获取指定池中的所有计算节点
PS C:\>Get-AzureBatchPool -Id "Pool07" -BatchContext $Context | Get-AzureBatchComputeNode -BatchContext $Context
Id : tvm-2316545714_1-20150725t213220z
Url : https://cmdletexample.westus.batch.azure.com/pools/MyPool/nodes/tvm-2316545714_1-20150725t213220z
State : Idle
StateTransitionTime : 7/25/2015 9:36:53 PM
LastBootTime : 7/25/2015 9:36:53 PM
AllocationTime : 7/25/2015 9:32:20 PM
IPAddress : 10.14.121.1
AffinityId : TVM:tvm-2316545714_1-20150725t213220z
VirtualMachineSize : small
TotalTasksRun : 1
StartTaskInformation :
RecentTasks : {}
StartTask :
CertificateReferences :
Errors :
Id : tvm-2316545714_2-20150726t172920z
Url : https://cmdletexample.westus.batch.azure.com/pools/MyPool/nodes/tvm-2316545714_2-20150726t172920z
State : Idle
StateTransitionTime : 7/26/2015 5:33:58 PM
LastBootTime : 7/26/2015 5:33:58 PM
AllocationTime : 7/26/2015 5:29:20 PM
IPAddress : 10.14.121.38
AffinityId : TVM:tvm-2316545714_2-20150726t172920z
VirtualMachineSize : small
TotalTasksRun : 0
StartTaskInformation :
RecentTasks :
StartTask :
CertificateReferences :
Errors :
此命令使用 Get-AzureBatchPool cmdlet 获取 ID Pool07 的池。 该命令使用管道运算符将该池传递到当前 cmdlet。 该 cmdlet 从该池获取所有计算节点。
参数
-BatchContext
指定 此 cmdlet 用于与 Batch 服务交互的 BatchAccountContext 实例。 如果使用 Get-AzureRmBatchAccount cmdlet 获取 BatchAccountContext,则在与 Batch 服务交互时将使用 Microsoft Entra 身份验证。 若要改用共享密钥身份验证,请使用 Get-AzureRmBatchAccountKeys cmdlet 获取包含其访问密钥的 BatchAccountContext 对象。 使用共享密钥身份验证时,默认使用主访问密钥。 若要更改要使用的密钥,请设置 BatchAccountContext.KeyInUse 属性。
Type: | BatchAccountContext |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-DefaultProfile
用于与 Azure 通信的凭据、帐户、租户和订阅。
Type: | IAzureContextContainer |
Aliases: | AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Filter
指定 OData 筛选器子句。 此 cmdlet 返回与此参数指定的筛选器匹配的计算节点。 如果未指定筛选器,此 cmdlet 将返回池的所有计算节点。
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Id
指定此 cmdlet 从池中获取的计算节点的 ID。 不能指定 wild卡 字符。
Type: | String |
Position: | 1 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-MaxCount
指定要返回的最大计算节点数。 如果指定值为零(0)或更少,则 cmdlet 不使用上限。 默认值为 1000。
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Pool
将池指定为 包含计算节点的 PSCloudPool 对象。 若要获取 PSCloudPool 对象,请使用 Get-AzureBatchPool cmdlet。
Type: | PSCloudPool |
Position: | 0 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-PoolId
指定包含计算节点的池的 ID。
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Select
指定 OData select 子句。 指定此参数的值以获取特定属性,而不是所有对象属性。
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
输入
参数:池(ByValue)
参数:BatchContext (ByValue)