mstester Posted November 6, 2006 Share Posted November 6, 2006 Hey Guys,I want to make an application (in VB.net or c#) which will run only on a Server 2003 box, does anyone know of a way to do this? Thanks, Link to comment Share on other sites More sharing options...
EchoNoise Posted November 6, 2006 Share Posted November 6, 2006 Why not just get the program to look for the OS String... and then if it doesn't equal that it just says "nope, go away" lol Link to comment Share on other sites More sharing options...
Crispy Posted November 6, 2006 Share Posted November 6, 2006 Something like this should be helpful for C#:http://www.c-sharpcorner.com/FAQ/OSVersionUsingEnvClass.asp Link to comment Share on other sites More sharing options...
LLXX Posted November 6, 2006 Share Posted November 6, 2006 The GetVersionEx function obtains extended information about the version of the operating system that is currently running.BOOL GetVersionEx( LPOSVERSIONINFO lpVersionInformation // pointer to version information structure ); ParameterslpVersionInformationPointer to an OSVERSIONINFO data structure that the function fills with operating system version information.Before calling the GetVersionEx function, set the dwOSVersionInfoSize member of the OSVERSIONINFO data structure to sizeof(OSVERSIONINFO).Return ValuesIf the function succeeds, the return value is nonzero.If the function fails, the return value is zero. To get extended error information, call GetLastError. The function fails if you specify an invalid value for the dwOSVersionInfoSize member of the OSVERSIONINFO structure. RemarksThe GetVersionEx function supersedes the GetVersion function and is the preferred method for obtaining operating system version number information. New applications should use the GetVersionEx function rather than the GetVersion function.There you go. Link to comment Share on other sites More sharing options...
CoffeeFiend Posted November 6, 2006 Share Posted November 6, 2006 (edited) . Edited November 7, 2006 by crahak Link to comment Share on other sites More sharing options...
mstester Posted November 6, 2006 Author Share Posted November 6, 2006 hey guys cheers for the help on this, still not sure what direction to take, i was recently pointed at this piece of code which works fine Public Function OS_Version() As String Dim osInfo As OperatingSystem Dim sAns As String osInfo = System.Environment.OSVersion With osInfo Select Case .Platform Case .Platform.Win32Windows Select Case (.Version.Minor) Case 0 sAns = "Windows 95" Case 10 If .Version.Revision.ToString() = "2222A" Then sAns = "Windows 98 Second Edition" Else sAns = "Windows 98" End If Case 90 sAns = "Windows Me" End Select Case .Platform.Win32NT Select Case (.Version.Major) Case 3 sAns = "Windows NT 3.51" Case 4 sAns = "Windows NT 4.0" Case 5 If .Version.Minor = 0 Then sAns = "Windows 2000" ElseIf .Version.Minor = 1 Then sAns = "Windows XP" ElseIf .Version.Minor = 2 Then sAns = "Windows Server 2003" Else 'Future version maybe update 'as needed sAns = "Unknown Windows Version" End If End Select End Select End With Return sAns End FunctionHowever im unsure of the following bits?If .Version.Revision.ToString() = "2222A" Then ??? any ideas Link to comment Share on other sites More sharing options...
CoffeeFiend Posted November 7, 2006 Share Posted November 7, 2006 (edited) . Edited November 7, 2006 by crahak Link to comment Share on other sites More sharing options...
mstester Posted November 7, 2006 Author Share Posted November 7, 2006 Thanks crahak for clearing that up for me, just a thought though. Would it be possible to make an .msi which would check to see what version the OS is and if its not 2003 kill the installer? would this be more efficant than having the application check the OS? Link to comment Share on other sites More sharing options...
CoffeeFiend Posted November 7, 2006 Share Posted November 7, 2006 (edited) Gee. Thanks Yzöwl... At least on newsgroups, there isn't one single person with god-like powers that can nuke your entire post if they feel like it over a slight difference of personal opinion about one sentence in it. They don't usually side with the trolls either.No point in posting your section seemingly. Won't be making the error of wasting time on that anymore. I've edited all my posts in the section to reflect that. Edited November 7, 2006 by crahak Link to comment Share on other sites More sharing options...
LLXX Posted November 7, 2006 Share Posted November 7, 2006 That's nowhere close to a "solution". You're suggesting he should bypass the [very bloated] standard .NET classesFixed.Wait a moment... this is .NET so I should just get out before I start getting influenced~! Link to comment Share on other sites More sharing options...
Yzöwl Posted November 7, 2006 Share Posted November 7, 2006 Okay, I'm all for healthy debate!Unfortunately crahak's latest post was a little bit beyond what I would term healthy and has as such been removed.If you must fight, please keep it a clean.Thank you. Link to comment Share on other sites More sharing options...
jaclaz Posted November 7, 2006 Share Posted November 7, 2006 hmmm, it looks like I missed most of the fun... jaclaz Link to comment Share on other sites More sharing options...
mstester Posted November 9, 2006 Author Share Posted November 9, 2006 lol sorry to have caused a fight :sAnyways I was thinking instead of using the app to determin wheather or not its OS 'x' should I get the msi to do this, is this even possible or am I talking through my noobie hat? Link to comment Share on other sites More sharing options...
LLXX Posted November 9, 2006 Share Posted November 9, 2006 Yes, a versioncheck can be done with the MSI.See the (freely downloadable) MSI SDK documentation for more information. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now