• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 291
  • Last Modified:

Client IP

I can get the system name from a client by using the %clientname% variable. Is there a way to get the client ip address in the same manner?
0
tenchulyo
Asked:
tenchulyo
  • 4
  • 3
  • 2
  • +1
1 Solution
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
The IP is not stored in a variable.  

If you explained what you needed if for - provided a scenario, a better solution may be offered.  Otherwise, you use IPCONFIG and if you need help with it, run IPCONFIG /? for a list of various options.

You can run a script that can store the IP in an environment variable... but if you can run the script, why do you need to store it in an environment variable?
0
 
acbxyzCommented:
ipconfig won't help on a terminal server. There are many more or less working solutions. A common one on lan networks is to use the clientname-variable and resolve it back via dns.
0
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
Why won't ipconfig work on terminal server... seems to work just fine.  And since we don't know why he wants the information, even if there's some way you're seeing it not work, it may be easily worked around.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
tenchulyoAuthor Commented:
I am building a script that sends a remote command (WMI/RPC) and I need to tell the script where to send the command. If I were on the same network I could use:

for /f "skip=1 tokens=2 delims=[]" %%* in (
   'ping.exe -n 1 %clientname%') Do (set "IP=%%*" & goto:exitFor1)
:exitFor1

or just use the clientname itself...

but unfortunately i'm not so I have an annoying solution to map out the IPs, but Id have to keep modifying the script every time someone new was employed here... not cool.
0
 
acbxyzCommented:
ipconfig only provides the ip address of the terminal server itself. tenchulyo asked for the client ip address.
There are solutions to this problem on the internet using event log sniffer, wmi, different power-shell modules/scripts, "add-on"-specific solutions like Citrix xenapp.

As long as we don't know which version of windows we talk about and if it is plain windows rds or citrix ica or something else, resolving the name back is the most universal.
At least on local networks every device should be listed in a dns server. With external clients usually there is no way back (firewall, nat, authentication, ...) so no problem at all.
0
 
tenchulyoAuthor Commented:
It's RDS, no addons. So are you saying there is no way around this? Would you be open to sharing one of these solutions and telling me why you would opt for it? Pros/Cons?
0
 
ktaczalaCommented:
Check out this link, looks like other people need this info too:
http://forums.thedailywtf.com/forums/t/27558.aspx
0
 
ktaczalaCommented:
0
 
tenchulyoAuthor Commented:
Thanks ktaczala,

but the last link brings me nowhere...
0
 
acbxyzCommented:
I never really tested rds/windows based ways. We only use citrix if it is remote desktop and tested a few citrix-based ways, but did it with domain lookup at the end. Sorry.
0
 
tenchulyoAuthor Commented:
I'll give it to ktaczala for the attention, but I still couldn't find it...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now