Comments (9)
Yeah, I'm a bit stumped on this one so far. I think it's a NetBIOS issue, but I
haven't tried to track it down in depth yet. See this thread for suggestions:
http://groups.google.com/group/cassia-users/browse_thread/thread/fedeaf1ea74dbbe
0
Original comment by danports
on 16 Jul 2011 at 2:49
from cassia.
i have the same problem:
asp.net application
cassia.net v2.0.0.60
enumerate servers
netbios over tcp is active
mit full domainname is koelbel.local
i use the netbios name KOELBEL
i recieved the error:
wrong domainname
Original comment by [email protected]
on 17 Jul 2011 at 6:16
from cassia.
See the first comment here:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383832(v=vs.85).aspx
Apparently the Computer Browser service (for NetBIOS) needs to be running on a
DC for the WTSEnumerateServers to work, and that service is no longer running
by default on 2008+. I think the best we can do here is document this and
suggest that people use another method to enumerate RD servers (e.g. AD/LDAP
queries).
Original comment by danports
on 15 Feb 2012 at 3:59
- Changed title: Update documentation for GetServers to indicate dependency on NetBIOS and to suggest alternatives
- Changed state: Accepted
- Added labels: Milestone-2.1, Priority-Low, Type-Enhancement
- Removed labels: Priority-Medium, Type-Defect
from cassia.
Original comment by danports
on 26 Feb 2012 at 2:19
- Added labels: Estimate-1
from cassia.
The RDS API documentation now recommends NetServerEnum for this purpose:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa370623(v=vs.85).aspx
Original comment by danports
on 19 Oct 2012 at 1:41
from cassia.
Awesome library, but I also ran into the same issue. I changed NativeMethods to
work correctly on 2008+ if you're interested in getting the change and updating
the project.
Original comment by [email protected]
on 28 Mar 2013 at 3:23
from cassia.
Justin: Sure, send me a patch and I'll take a look at it. Did you use a
different Win32 call in NativeMethods?
Original comment by danports
on 29 Mar 2013 at 1:59
from cassia.
Crashed on the same here now, found that they recomend netserverenum as noted
in the bottom here:
http://msdn.microsoft.com/en-us/library/aa383832(v=vs.85).aspx
But very nice tool when used direct on servernames.
Original comment by [email protected]
on 3 May 2013 at 12:51
from cassia.
Justin's suggestions -- documenting them here for now until I get a chance to
review the code and make some changes:
in Impl/NativeMethods.cs, line 46:
/* no longer works for Server 2008 and above
[DllImport("Wtsapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern int WTSEnumerateServers([MarshalAs(UnmanagedType.LPTStr)] string pDomainName, int reserved,
int version, out IntPtr ppServerInfo, out int pCount);
*/
//[DllImport("Wtsapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]
[DllImport("Netapi32.dll", EntryPoint = "NetServerEnum")]
public static extern Int32 NetServerEnum([MarshalAs(UnmanagedType.LPWStr)] String serverName, Int32 level, out IntPtr bufferPtr,
UInt32 prefMaxLen, ref Int32 entriesRead, ref Int32 totalEntries,
UInt32 serverType, [MarshalAs(UnmanagedType.LPWStr)] String domain,
IntPtr handle);
[DllImport("Netapi32.dll", EntryPoint = "NetApiBufferFree")]
public static extern UInt32 NetApiBufferFree(IntPtr buffer);
in Impl/NativeMethodsHelper.cs, line 142:
public static IList<WTS_SERVER_INFO> EnumerateServers(string domainName)
{
IntPtr ppServerInfo;
int count = 0;
int totalEntries = 0;
UInt32 MAX_PREFERRED_LENGTH = 0xFFFFFFFF;
//all servers
UInt32 ServerType = 0xFFFFFFFF;
//only valid up to 2008.
//if (NativeMethods.WTSEnumerateServers(domainName, 0, 1, out ppServerInfo, out count) == 0)
int result = NativeMethods.NetServerEnum(null, 100, out ppServerInfo, MAX_PREFERRED_LENGTH, ref count, ref totalEntries, ServerType, domainName, IntPtr.Zero);
if (result == 234)
{
throw new Win32Exception();
}
try
{
return PtrToStructureList<WTS_SERVER_INFO>(ppServerInfo, count);
}
finally
{
NativeMethods.WTSFreeMemory(ppServerInfo);
}
}
Original comment by danports
on 6 Sep 2013 at 1:54
from cassia.
Related Issues (20)
- TerminalServicesSession.RemoteEndPoint fails on Windows 8/Server 2012+ HOT 3
- session.applicationname throws "parameter incorrect" when no application listed HOT 1
- feature request or just info HOT 3
- cannot use the Stop-TSSesion -force on disconnected session HOT 1
- No more data is available HOT 6
- The system cannot find the file specified HOT 1
- Method to set RD server drain mode
- Add a property to ITerminalServicesSession to fetch the session's virtual IP address HOT 1
- Login To RemoteServer HOT 1
- Issues running on and connecting to W8 / Server 2012 systems: HOT 1
- Cassia is not strong named HOT 1
- rpc server unavailable error HOT 1
- Documentation does not display HOT 1
- Add Support to Get the external remote client IP HOT 1
- Set a command for reconnect HOT 3
- Not able to send message to remote terminal session. HOT 2
- Need 64 Bit Version HOT 1
- Documentation is empty HOT 1
- Access Denied error only when trying to log off a user HOT 4
- Update the Nuget package to 2.1 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cassia.