Last active
September 11, 2023 16:27
-
-
Save Rugby-Ball/6629b57fc02a3161d3592e293a1eec4d to your computer and use it in GitHub Desktop.
Pull an Inventory of all FSx across all regions. Export to a CSV file. #Utility #Public #AWS #Inventory #File_System #AWS_FSx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#FSx-List-ALL-Regions.ps1 | |
<# | |
Description: Pull an Inventory of all FSx across all regions. Export to a CSV file. | |
Written: Ed Walsh | |
PowerShell.Core tested: Yes | |
MS-Graph: No | |
Version: 1.1 | |
Create Date: 9/11/2023 | |
Revised Date: 9/11/2023 | |
#> | |
##Check if c:\temp exists, if it doesnt create it. | |
If (-not(Test-Path -Path "c:\temp")) | |
{ New-Item -ItemType Directory -Force -Path C:\temp } | |
Import-module -name AWSpowershell.NetCore | |
$Out = @() | |
Get-EC2Region -RegionToCall us-east-1 <# -RegionToCall used because of https://github.com/aws/aws-tools-for-powershell/issues/46 #> | Foreach-Object { | |
$region = $_.RegionName | |
$Out += Get-FSXFileSystem -region $region | Select-Object @{n="AWS-Acct";e={$_.OwnerId}}, @{n="Region";e={$region}}, ResourceARN, @{n="Name";e={ ($_.Tags | where Key -eq "Name").Value } }, CreationTime, VpcId, DNSName, FileSystemId, FileSystemType, Lifecycle, @{n="NetworkInterfaceIds";e={[String]::Join('; ',$_.NetworkInterfaceIds)}}, StorageType, @{n="Storage-Capacity-GB";e={$_.StorageCapacity} }, @{n="ThroughputCapacity_MBs";e={$_.WindowsConfiguration.ThroughputCapacity} }, @{n="SubnetIds";e={[String]::Join('; ',$_.SubnetIds)}}, @{n="Aliases";e={$_.WindowsConfiguration.aliases.name} }, @{n="AutomaticBackupRetentionDays";e={$_.WindowsConfiguration.AutomaticBackupRetentionDays} }, @{n="CopyTagsToBackups";e={$_.WindowsConfiguration.CopyTagsToBackups} }, @{n="DailyAutomaticBackupStartTime";e={$_.WindowsConfiguration.DailyAutomaticBackupStartTime} }, @{n="WeeklyMaintenanceStartTime";e={$_.WindowsConfiguration.WeeklyMaintenanceStartTime} }, @{n="DeploymentType";e={$_.WindowsConfiguration.DeploymentType} }, @{n="DnsIps";e={$_.WindowsConfiguration.SelfManagedActiveDirectoryConfiguration.DnsIps} }, @{n="Domain";e={$_.WindowsConfiguration.SelfManagedActiveDirectoryConfiguration.DomainName} }, @{n="OrganizationalUnitDistinguishedName";e={$_.WindowsConfiguration.SelfManagedActiveDirectoryConfiguration.OrganizationalUnitDistinguishedName} }, @{n="UserName";e={$_.WindowsConfiguration.SelfManagedActiveDirectoryConfiguration.UserName} }, @{n="FileSystemAdministratorsGroup";e={$_.WindowsConfiguration.SelfManagedActiveDirectoryConfiguration.FileSystemAdministratorsGroup} } | |
} | |
$Out | Export-Csv -NoTypeInformation -Path c:\temp\FSx-List-ALL-Regions-$(get-date -f yyyyMMdd-hhmm-tt).csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment