Skip to content

Commit 2a98e76

Browse files
authored
Merge pull request #20 from mcarpendale/AddThroughputAndTags
Added Throughput and tag changes
2 parents 2aae297 + 35b543c commit 2a98e76

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

CBS-AWS-Solutions/collect-aws-ebs-disk-information/Get-AWS-EBS-Volume-Information.ps1

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
<#
22
Get-AWS-EBS-Volume-Information.ps1
3-
Version: 1.0
3+
Version: 1.1
44
Authors: David Stamen @ Pure Storage
5+
Edited: Mike Carpendale @ Pure Storage
56
#>
67

78
# Get all regions
8-
$Regions = (Get-AWSRegion).Region
9+
$Regions = (Get-AWSRegion).Region #comment this line if you want target specific regions
10+
# Define specific regions you may want to target
11+
#$Regions = @("ap-southeast-1", "us-west-2") #uncomment this line if you dont want to run this across all regions
912

1013
# Get all Volumes in each region
1114
$Volumes = foreach ($Region in $Regions) {
@@ -23,7 +26,7 @@ $VolumeDetailsOutArray = @()
2326
#The computer loop you already have
2427
foreach ($Volume in $Volumes) {
2528
#Construct an object for the Collection
26-
$myobj = "" | Select-Object "Region","AvailabilityZone","VolumeType","Size","Iops","VolumeId","Name","Device","PlatformDetails","InstanceId","State","InstanceState","InstanceType"
29+
$myobj = "" | Select-Object "Region","AvailabilityZone","VolumeType","Size","Iops","Throughput","VolumeId","Name","Device","PlatformDetails","InstanceId","State","InstanceState","InstanceType","Tags"
2730

2831
#Fill the object with the values mentioned above
2932
if ($Volume.State -eq "available") {
@@ -33,8 +36,11 @@ foreach ($Volume in $Volumes) {
3336
$myobj.Region = $Volume.AvailabilityZone.Substring(0,$Volume.AvailabilityZone.Length-1)
3437
$myobj.AvailabilityZone = $Volume.AvailabilityZone
3538
$myobj.Iops = $Volume.Iops
39+
$myobj.Throughput = $Volume.Throughput # Add this line to get Throughput
3640
$myobj.Size = $Volume.Size
3741
$myobj.Name = ($Volume.Tags | ? {$_.Key -EQ "Name"}).Value | Out-String -Stream
42+
# Add Tags to the object as a single string (key-value pairs)
43+
$myobj.Tags = ($Volume.Tags | ForEach-Object { "$($_.Key)=$($_.Value)" }) -join "; "
3844

3945
#Add the objects to the Volume Out Arrays
4046
$VolumeDetailsOutArray += $myobj
@@ -59,8 +65,10 @@ foreach ($Volume in $Volumes) {
5965
$myobj.Region = $Volume.AvailabilityZone.Substring(0,$Volume.AvailabilityZone.Length-1)
6066
$myobj.AvailabilityZone = $Volume.AvailabilityZone
6167
$myobj.Iops = $Volume.Iops
68+
$myobj.Throughput = $Volume.Throughput # Add this line to get Throughput
6269
$myobj.Size = $Volume.Size
63-
$myobj.Name = ($Volume.Tags | ? {$_.Key -EQ "Name"}).Value | Out-String -Stream
70+
# Add Tags to the object as a single string (key-value pairs)
71+
$myobj.Tags = ($Volume.Tags | ForEach-Object { "$($_.Key)=$($_.Value)" }) -join "; "
6472

6573
#Add the objects to the Volume Out Arrays
6674
$VolumeDetailsOutArray += $myobj

0 commit comments

Comments
 (0)