0

I'm trying to connect to amazon windows instance using powershell. I'm following the steps from the below link:

I cannot make this to work. I'm new Amazon CLI, I've been struggling for the past few days to connect to my windows instance which is already running.

I keep getting the same error each time. Am I missing out something?

enable-psremoting -force
set-item wsman:\localhost\Client\TrustedHosts -value "*" -force
$password = convertto-securestring -asplaintext -force -string "MY_PASSWORD_GOES_HEREr"
$credential = new-object -typename system.management.automation.pscredential -argumentlist "MY_USERNAME", $pa
ssword
$session = new-pssession x.x.x.x -credential $credential

new-pssession : [x.x.x.x] Connecting to remote server x.x.x.x failed with the following error message : WinRM cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet. For more information, see the about_Remote_Troubleshooting Help topic. At line:1 char:12 + $session = new-pssession x.x.x.x -credential $credential + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin gTransportException + FullyQualifiedErrorId : WinRMOperationTimeout,PSSessionOpenFailed

5
  • Yes thats right i'm trying to connect to the Public Ip. should i connect to private ip?? Commented Jun 19, 2017 at 10:16
  • No public IP is correct. What configuration have you done to the EC2 instance? -- Are the firewall rules setup to allow remote connections? Have you enabled PSRemoting on the instance itself? What entries have you got in the security groups that instance has setup? The SO Question lists steps to run on the instance, have you run them? The second link firstly create and updates a Security Group, have you done that? Commented Jun 19, 2017 at 10:17
  • I'm unable to create and update the security group it gives the below errorPS C:\Program Files (x86)\AWS Tools\PowerShell\AWSPowerShell> ec2-create-group -d “WinRM Group” WinRM-Group ec2-create-group : The term 'ec2-create-group' 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 + ec2-create-group -d “WinRM Group” WinRM-Group Commented Jun 19, 2017 at 10:20
  • I have created a new rule which will allow the remote connections by following the steps from this link:infrasightlabs.com/… Commented Jun 19, 2017 at 10:22
  • when i get-service winrm it shows its running but when i try to check winrm quickconfig . it gives me the error :PS C:\Program Files (x86)\AWS Tools\PowerShell\AWSPowerShell> winrm qc winrm : The term 'winrm' 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 + winrm qc Commented Jun 19, 2017 at 10:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.