< Back

Get-CBEnvironment

Mon Jan 13, 2020 3:22 am

NAME Get-CBEnvironment



SYNOPSIS

Gets environments from CloudBolt.





SYNTAX

Get-CBEnvironment -Session <Object> [-PageSize <Int32>] [<CommonParameters>]



Get-CBEnvironment -Session <Object> -ID <Int32> [<CommonParameters>]





DESCRIPTION

The `Get-CBEnvironment` function gets environments from CloudBolt. Pass the session for the target CloudBolt

instance to the `Session` parameter (use `New-CBSession` to create a session). All environments are returned.

CloudBolt pages result sets, and the `Get-CBEnvironment` function makes one request per page of results. You can

control how many environments to include in each page with the `PageSize` parameter. The default is CloudBolt's

default page size. When getting all environments, CloudBolt only returns the environment's name and ID.



`Get-CBEnvironment` can also return a specific environment. Pass its ID to the `ID` parameter. You can also pipe

environment objects (any object with an `ID` property) or IDs to `Get-CBEnvironment`. When getting a specific

environment, CloudBolt returns all information about an environment.





PARAMETERS

-Session <Object>

The session/connecton to the CloudBolt instance to use. Use `New-CBSession` to create a session object.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ID <Int32>

The ID of the environment to get.



Required? true

Position? named

Default value 0

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-PageSize <Int32>

The page size. CloudBolt pages all lists of objects. The `Get-CBEnvironment` function will make an HTTP

request for every page of results so that all environments get returned. The default page size is 10.



Required? false

Position? named

Default value $defaultPageSize

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Get-CBEnvironment -Session $session



Demonstrates how to get all environments from CloudBolt. When getting all environments, CloudBolt only returns

each environment's ID and name.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Get-CBEnvironment -Session $session -PageSize ([int16]::MaxValue)



Demonstrates how to increase the number of results per page/request to the CloudBolt API. The larger the number,

the greater the strain on CloudBolt but the fewer requests will be made.









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Get-CBEnvironment -Session $session -ID 1



Demonstrates how to get a specific environment from CloudBolt.









-------------------------- EXAMPLE 4 --------------------------



PS C:\\>$environments | Get-CBEnvironment -Session $session



Demonstrates that you can pipe environment objects to `Get-CBEnvironment`. Each object must have an `ID` property.









-------------------------- EXAMPLE 5 --------------------------



PS C:\\>@( 1, 2, 3) | Get-CBEnvironment -Session $session



Demonstrates that you can pipe IDS to `Get-CBEnvironment`.











RELATED LINKS