Error when trying to run Get-CimInstance on remote machine

This topic contains 4 replies, has 2 voices, and was last updated by Profile photo of Christopher Michael Christopher Michael 4 months ago.

  • Author
    Posts
  • #49291
    Profile photo of Christopher Michael
    Christopher Michael
    Participant

    I just picked up Learn Powershell Toolmaking in a month of lunches and have ran into a snag. Chapter 4 wants me to run a command:

    Get-CimInstance -ClassName Win32_OperatingSystem -ComputerName

    When I run this I get an error message

    "PS C:\Windows\system32> Get-CimInstance -ClassName win32_operatingsystem -ComputerName sac-4175
    WARNING: [WSManNetworkFailureDetected] The network connection to sac-4175 has been interrupted. Attempting to reconnect for up to 4 minutes"

    I have made sure PSRemoting is turned on. The weird thing is this is a new issue. I didn't have this issue previeiously and am not sure what changed. It works fine in my VM that is running on the same domain, and even using the same image but my local desktop PC gets this error. I am not sure where to look

  • #49295
    Profile photo of Richard Siddaway
    Richard Siddaway
    Moderator

    This message indicates that there is a network problem between your machine and the remote machine. Can you create a PowerShell remoting session to the remote machine. can you ping it? What version of PowerShell is running on the remote machine?

    • #49297
      Profile photo of Christopher Michael
      Christopher Michael
      Participant

      I can ping it, i am actually connecting to my local machine but using the computername instead of local host. Localhost works fine, computername doesn't. The response ping I get looks like its ipv6 but it does get a response

      When trying to open a PSSession I get an error:

      [sac-4175] Connecting to remote server sac-4175 failed with the following error message : The WinRM client received an
      HTTP status code of 403 from the remote WS-Management service. For more information, see the
      about_Remote_Troubleshooting Help topic.
      + CategoryInfo : OpenError: (sac-4175:String) [], PSRemotingTransportException
      + FullyQualifiedErrorId : -2144108273,PSSessionStateBroken

  • #49347
    Profile photo of Richard Siddaway
    Richard Siddaway
    Moderator

    What happens if you do this

    Get-CimInstance -ClassName Win32_OperatingSystem -ComputerName $env:COMPUTERNAME

  • #49356
    Profile photo of Christopher Michael
    Christopher Michael
    Participant

    So I got pissed off and reinstalled Windows. That seemed to fix the problem.

You must be logged in to reply to this topic.