Get SQL Server IP Address

  • Comments posted to this topic are about the item Get SQL Server IP Address

    ¤ §unshine ¤

  • Hi all!

    I suggest a little add on to this 'IP-script' as follows:

    OR upper (ipLine) like '%IPv4 ADDRESS%'

    Cheers,

    Bertil F

  • If you're running SQL Server 2005 or above you can use this (some shops disable xp_cmdshell):

    Select

    client_net_address,local_net_address

    from sys.dm_exec_connections

    where session_id=@@SPId;

    Limitation: You only get IP addresses if you're connective via TCP/IP. If you're local and using Shared Memory then those attributes don't exist. If you turn off Shared Memory (or any protocols except for TCP/IP) via Server Configuration Manager you will always get IP address for any connection using this technique.



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • Awesome!Thanks!

    ¤ §unshine ¤

  • Select

    client_net_address,local_net_address

    from sys.dm_exec_connections

    where session_id=@@SPId;

    - This works

    Yours does not on our cluster evironment (NULL)

    create table #temp (ipLine varchar(200))

    insert #temp

    exec master..xp_cmdshell 'ipconfig'

  • Hi

    How i can get all remote servers IP add and host name ? you have any updated script?

  • Thanks for the script Sunshine.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply