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.Workbook s.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...
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" -ForegroundColo r Yellow New-Item C:\AzureInvento ry -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!!
I want to pull the below information can anyone help me achieve this 'Region' '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. Tags
I got connect to aws through access & secret key still no luck, I get weird error, hope you can help me- Error- Initialize-AWSDefaults : Cannot determine credentials from supplied parameters At line:1 char:1 + Initialize-AWSD efaults -ProfileName myprofile -Region us-east-1 + ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~ + CategoryInfo : InvalidArgument : (Amazon.PowerSh e...igurationCm dlet:Initialize DefaultConfigur ationCmdlet ) [Initialize-AWS DefaultConfigur ation], ArgumentExcepti on + FullyQualifiedE rrorId : ArgumentExcepti on,Amazon.Power Shell.Common.In itializeDefault ConfigurationCm dlet 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:Str ing) [], CommandNotFound Exception + FullyQualifiedE rrorId : CommandNotFound Exception Thx
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_coun ter,$column_cou nter++) = $EC2Instances_I terator.Instanc es.keyname.tost ring() With: $VirtualMachine Worksheet.Cells .Item($row_coun ter,$column_cou nter++) = $EC2Instances_I terator.Instanc es.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.
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?
Hi Jaydo1, You will have to replace the credentials with your account's secret and access key.