Get-AzureBatchPoolNodeCounts
Gets Batch node counts per node state grouped by pool id.
Warning
The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.
Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.
Syntax
Get-AzureBatchPoolNodeCounts
-BatchContext <BatchAccountContext>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzureBatchPoolNodeCounts
[-PoolId <String>]
-BatchContext <BatchAccountContext>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzureBatchPoolNodeCounts
[-Pool <PSCloudPool>]
-BatchContext <BatchAccountContext>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzureBatchPoolNodeCounts
[-MaxCount <Int32>]
-BatchContext <BatchAccountContext>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The Get-AzureBatchPoolNodeCounts cmdlet allows customers to get back node counts per node state grouped by pool. Possible node states are creating, idle, leavingPool, offline, preempted, rebooting, reimaging, running, starting, startTaskFailed, unknown, unusable and waitingForStartTask. The cmdlet takes PoolId or Pool parameter to filter only pool with pool id specified.
Examples
Example 1
PS C:\> $batchContext = Get-AzureRmBatchAccountKeys -AccountName "contosobatch"
PS C:\> Get-AzureBatchPoolNodeCounts -BatchContext $batchContext
PoolId Dedicated LowPriority
------ --------- -----------
contosopool1 Creating: 1, Idle: 1, Rebooting: 1, Running: 5, Total: 8 Total: 0
contosopool2 Idle: 1, Rebooting: 1, Total: 2 Total: 0
List node counts per node state for pools under current batch account context.
Example 2
PS C:\> Get-AzureBatchPoolNodeCounts -BatchContext $batchContext -PoolId "contosopool1"
PoolId Dedicated LowPriority
------ --------- -----------
contosopool1 Creating: 1, Idle: 1, Rebooting: 1, Running: 5, Total: 8 Total: 0
PS C:\> $poolnodecounts = Get-AzureBatchPoolNodeCounts -BatchContext $batchContext -PoolId "contosopool1"
PS C:\> $poolnodecounts.Dedicated
Creating : 1
Idle : 1
LeavingPool : 0
Offline : 0
Preempted : 0
Rebooting : 1
Reimaging : 0
Running : 5
Starting : 0
StartTaskFailed : 0
Total : 8
Unknown : 0
Unusable : 0
WaitingForStartTask : 0
PS C:\> Get-AzureBatchPool -Id "contosopool1" -BatchContext $batchContext | Get-AzureBatchPoolNodeCounts -BatchContext $batchContext
PoolId Dedicated LowPriority
------ --------- -----------
contosopool1 Creating: 1, Idle: 1, Rebooting: 1, Running: 5, Total: 8 Total: 0
Show node counts per node state for a pool given pool id.
Parameters
-BatchContext
The BatchAccountContext instance to use when interacting with the Batch service. If you use the Get-AzureRmBatchAccount cmdlet to get your BatchAccountContext, then Microsoft Entra authentication will be used when interacting with the Batch service. To use shared key authentication instead, use the Get-AzureRmBatchAccountKeys cmdlet to get a BatchAccountContext object with its access keys populated. When using shared key authentication, the primary access key is used by default. To change the key to use, set the BatchAccountContext.KeyInUse property.
Type: | BatchAccountContext |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure.
Type: | IAzureContextContainer |
Aliases: | AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MaxCount
Specifies the maximum number of pools to return. The default value is 10.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Pool
Specifies the PSCloudPool for which to get node counts.
Type: | PSCloudPool |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-PoolId
The id of the pool for which to get node counts.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Inputs
Parameters: Pool (ByValue)
Parameters: BatchContext (ByValue)