Closed jblesener closed 5 years ago
Thanks for your contribution. I like all your fixes of my Readme. With the Client IP display I am unsure. In my experience 90% of the returned clients show are already resolved to names and only a few are showing as IP addresses. Could you test your code change in a real environment ? What where the results and what type of NAS you used for that ?
Hmm, very strange. My tests with modified code shows ClientIP is an IP address 100% of the time. Initial test is 25 servers (4 Windows, 15 NetApp, 6 Panzura) with 1627 sessions but I can test with more.
If I pull up the sessions with compmgmt.msc, 99% do show up as DNS entries but I suspect it's doing a reverse lookup similar to how FileShareUtils does. Original API docs for sesiX_cname in SESSION_INFO_X just say Unicode string specifying the name of the computer that established the session but I did find some talk where people say it returns an IP.
Maybe we could just do a DNS query if the server returns a non-IP?
Yes, I get the same results in my tests on NetApp and Windows Servers with many sessions: In ClientIP 100% IP addresses and in the Client field there are about 10% IPs left of some special clients where reverse name resolution does not work. I try to release a new version asap with your changes. Thank you very much for your contribution and your feedback on real world use of my module.
No problem, thanks for writing the module as it's been very useful!
Fixed some typos in the Readme and added client IP to the Get-NetSessions output. Reasoning behind preserving client IP if DNS resolution works is that some interesting information may be there that is lost by only presenting the DNS name. Examples: DHCP leases changing, stale DNS records, etc.