Why does Get-EC2PasswordData return "The parameter is invalid"?

I use powershell to call Get-EC2PasswordData as follows:

$instances = (Get-EC2Instance -Filter @($envFilter, $stateFilter)).Instances $instances | Foreach-object { $instID = $_.InstanceId Write-Host Getting password to $instID... $password = Get-EC2PasswordData -InstanceId $instID -PemFile "c:\my.pem" -Decrypt Write-Host Username/Password for $_.PrivateIpAddress is Administrator/$password } 

And I get the following:

 Getting password to i-3e961280 ... Get-EC2PasswordData : Value cannot be null. Parameter name: s At C:\temp\CIS-aws-volumes\copyToMachine.ps1:12 char:17 + $password = Get-EC2PasswordData -InstanceId $instID -PemFile "c:\docs\ssh\ci ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (Amazon.PowerShe...swordDataCmdlet:GetEC2PasswordDataCmdlet) [Get-EC2 PasswordData], ArgumentNullException + FullyQualifiedErrorId : InvalidOperationException,Amazon.PowerShell.Cmdlets.EC2.GetEC2PasswordDataCmdlet Username/Password for 10.185.30.124 is Administrator/ 

What is "Get-EC2PasswordData: The value cannot be empty." I mean? I do not pass any null values.

+5
source share
1 answer

Turns off the answer because the password is not yet available. You just need to wait a while until the machine appears. You will also find that you also cannot get the Windows administrator password in the console, though (although ti gives a much more intuitive message).

If you have been waiting for a long time, probably because your Ec2ConfigService is not configured on the computer to reset the password. You may need to change "C: \ Program Files \ Amazon \ Ec2ConfigService \ Settings \ config.xml". There you will find a piece next to this:

 <Plugin> <Name>Ec2SetPassword</Name> <State>Disabled</State> </Plugin> 

Change "Disabled" to "Enabled":

 <Plugin> <Name>Ec2SetPassword</Name> <State>Enabled</State> </Plugin> 

I wanted to post this on the Internet somewhere, so the next guy who Googles “Get-EC2PasswordData: Value can't be null” might find something useful.

+6
source

Source: https://habr.com/ru/post/1236099/


All Articles