Given a UNC path like \\server\share
, is there any way to determine, using the Win32 API, whether the local and remote computers are connecting using SMB or SMB2?
Asked
Active
Viewed 1.4k times
5

Zoë Peterson
- 13,094
- 2
- 44
- 64
-
Check this http://stackoverflow.com/questions/10800616/determine-protocol-of-a-network-drive – Sameer Jan 20 '14 at 11:03
3 Answers
10
After burning a paid support incident, the official answer from Microsoft is that this information isn't exposed by the driver in Windows 7. On Windows 8 it's available using WMI and the MSFT_SmbConnection class, or PowerShell's Get-SmbConnection
cmdlet.

Zoë Peterson
- 13,094
- 2
- 44
- 64
-
Win10 PowerShell's `Get-SmbConnection` cmdlet required admin shell for me. worked – wrossmck Mar 19 '18 at 16:52
0
Maybe you can find the answer in the SMB2 specification.
Server Message Block (SMB) Protocol Versions 2 and 3 specification
There should be a way to detect the version... Maybe you can try to implement a minimal part of the SMB protocol just to ask the server the protocol version?

Max
- 7,408
- 2
- 26
- 32
0
one of the easyest way to find is by taking a network trace using the wireshark (on windows) or tcptrace/tcpdump on the unix (where SMB is running). The trace output should give you the version

Aravind
- 1
-
I'm looking for something that we can detect dynamically at program startup for arbitrary servers that our customers are connecting to. Using a packet sniffer or debugger won't work. – Zoë Peterson Jan 29 '14 at 16:51