Powershell Script to generate AWS Inventory

Want to know about innovative and interesting ideas in Azure and automation? Check out my blog: https://manjunathrao.com/This script generates AWS Inventory----- Pre Requisites -----1. Make sure you have AWS tools for Powershell installed. You can download the same at: https://aw

1,763 times
Add to favorites
E-mail Twitter del.icio.us Digg Facebook
  • I fixed few of the error, now getting a new one
    3 Posts | Last post April 20, 2019
    • You cannot call a method on a null-valued expression.
      At line:32 char:1
      + $workbook = $excel.Workbooks.Add()
    • I ended up creating a excel file with same name in output directory, it did make some progress once I ran the script excel sheet did open up with all the header information and with multiple sheets but there was no data in it.
    • move the $workbook = line below the New-Object line, like this...
      # Creating EXCEL object
      $excel = New-Object -ComObject excel.application
      #$excel.visible = $true
      # Create a Workbook
      $workbook = $excel.Workbooks.Add()
      # Function to creat the EC2 Instance worksheet
      Also note that the script as written, while awesome, puts a lot of blank lines in some of the sheets.   If you think you don't have data, scroll down and you might find it.   That was the case for me with the EC2Instance worksheet...
  • mistake
    2 Posts | Last post April 04, 2019
    • Listing:
      # Creating a directory, overrides if any directory exists with the same name
      Write-Host "Creating a directory: C:\AWSInventory. This operation will override if you have a directory with the same name. `n" -ForegroundColor Yellow
      New-Item C:\AzureInventory -Type Directory -Force
      Path to Azure Folder not for AWS
    • Hello SID,
      Thank you for noticing the mistake in naming the file/folder. I have corrected it now. Thanks!!
  • Tags and Volume ids
    1 Posts | Last post March 17, 2019
    • I want to pull the below information can anyone help me achieve this
      'VM Name' 
      'VM Image ID' 
      'VM Instance ID' 
      'VM Instance Type' 
      'VM Private IP' 
      'VM Public IP' 
      'VM VPC ID' 
      'VM Subnet ID' 
      'VM State' 
      'VM Security Group Id'
       Volumes attached to the instance and volume ids.
  • Script would simply not work for me
    1 Posts | Last post March 09, 2019
    • I got connect to aws through access & secret key still no luck, I get weird error, hope you can help me-
      Initialize-AWSDefaults : Cannot determine credentials from supplied parameters
      At line:1 char:1
      + Initialize-AWSDefaults -ProfileName myprofile -Region us-east-1
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidArgument: (Amazon.PowerShe...igurationCmdlet:InitializeDefaultConfigurationCmdlet
         ) [Initialize-AWSDefaultConfiguration], ArgumentException
          + FullyQualifiedErrorId : ArgumentException,Amazon.PowerShell.Common.InitializeDefaultConfigurationCmdlet
      get-region : The term 'get-region' is not recognized as the name of a cmdlet, function, script file, or operable
      program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
      At line:1 char:1
      + get-region
      + ~~~~~~~~~~
          + CategoryInfo          : ObjectNotFound: (get-region:String) [], CommandNotFoundException
          + FullyQualifiedErrorId : CommandNotFoundException
  • How to include Tags In this inventory report
    3 Posts | Last post December 18, 2018
    • How do I include Tags in this inventory report for e.g) Name tag of the instance? I noticed the VM Name is not the actual Instance name but the keypair name used for this instance. 
    • Replace:  $VirtualMachineWorksheet.Cells.Item($row_counter,$column_counter++) = $EC2Instances_Iterator.Instances.keyname.tostring()
      With:     $VirtualMachineWorksheet.Cells.Item($row_counter,$column_counter++) = $EC2Instances_Iterator.Instances.Tags | ? { $_.key -eq "Name" } | select -expand Value
    • Thank you PSBegley, I really appreciate your Info here as i was searching for this long time.
      Not forgetting Manjunath Rao for this wonderfull script.
  • Virtualmachine excel worksheet comes out blank
    1 Posts | Last post October 05, 2017
    • I ran this script and it populated information on VPC. Subnet and s3 bucket worksheets in my excel file. However, the Virtualmachine worksheet was blank. Any ideas?
  • doesn't seem to work
    2 Posts | Last post September 01, 2017
    • does not generate anything?   
    • Hi Jaydo1,
      You will have to replace the credentials with your account's secret and access key.