How to find out IP address or any other information within WinRM session?

This topic contains 3 replies, has 2 voices, and was last updated by Profile photo of Jonathan Warnken Jonathan Warnken 7 months, 2 weeks ago.

  • Author
    Posts
  • #38248
    Profile photo of GS
    GS
    Participant

    Hello,

    What uniquely identifiable information available which can be logged from within WinRM session? I need to be able to find out for example log IP address of client which connected to endpoint. I see how I can get username of connected user but is there any other information hidden somewhere in variables (like IP address or hostname of client etc)?

  • #38291
    Profile photo of Jonathan Warnken
    Jonathan Warnken
    Participant

    any information you collect locally can be done in the winrm session.
    wmi is a good place to get the info you are after

    $ip=get-WmiObject Win32_NetworkAdapterConfiguration|Where {$_.Ipaddress.length -gt 1} 
    $ip.ipaddress[0] 
    
    $pcinfo = get-WmiObject win32_computersystem
    $pcinfo.Name
    
  • #38296
    Profile photo of GS
    GS
    Participant

    I mean I need to know client IP not target IP.
    Client Computer1 connects to WinRM session on Server1. I want within WinRM session on Server1 to find out IP address of Computer1.

  • #38297
    Profile photo of Jonathan Warnken
    Jonathan Warnken
    Participant

    Ahh, off the top of my head I am not sure if that available via a built in command. If you have powershell logging enabled you may find the info in the event logs.

You must be logged in to reply to this topic.