IPB

Google Frontpage Forums Unattended CD/DVD Guide
 
Reply to this topicStart new topic
> Feature request: remove need for workstations service, replace OS verification routine
HolgerHops
post Aug 9 2008, 06:10 AM
Post #1





Group: Members
Posts: 2
Joined: 30-November 03
Member No.: 10205



First I would like to thank you for this great script.

On my computer the workstation service is disabled, so the script hangs when it tries to figure out the OS version.

Problem lies here:
CODE
:: Find host OS - based on code posted by Yzöwl on MSFN.org
SET HostOS=Unknown
FOR /F "DELIMS=" %%I IN ('NET CONFIG WORK^|FIND /I " Windows "') DO (
ECHO %%I|FIND "2000">NUL 2>&1&&(SET HostOS=2000&GOTO :HOSD)
ECHO %%I|FIND "2002">NUL 2>&1&&(SET HostOS=XP&GOTO :HOSD)
ECHO %%I|FIND "2003">NUL 2>&1&&(SET HostOS=2003&GOTO :HOSD)
ECHO %%I|FIND /I "Vista">NUL 2>&1&&(SET HostOS=Vista&GOTO :HOSD)
)

as this code relies on the workstation service to function properly.

This Code should do the same, but doesn't rely on the workstation service:
CODE
FOR /F "DELIMS=" %%I IN ('ver') DO (
ECHO %%I|FIND "2000">NUL 2>&1&&(SET HostOS=2000&GOTO :HOSD)
ECHO %%I|FIND "XP">NUL 2>&1&&(SET HostOS=XP&GOTO :HOSD)
ECHO %%I|FIND "2003">NUL 2>&1&&(SET HostOS=2003&GOTO :HOSD)
ECHO %%I|FIND /I "VISTA">NUL 2>&1&&(SET HostOS=Vista&GOTO :HOSD)
)
Go to the top of the page
 
+Quote Post
Yzöwl
post Oct 31 2008, 08:56 AM
Post #2


MSFN Master
Group Icon

Group: Super Moderator
Posts: 2749
Joined: 13-October 04
Member No.: 33618
OS: none
Country Flag


Sorry to add to a topic which has lay here silently for a couple of months but the reason for using that particular method was that VER returns only the version of the command interpreter not the running Operating System!
Go to the top of the page
 
+Quote Post
Tomalak
post Oct 31 2008, 03:58 PM
Post #3


Member
**

Group: Members
Posts: 122
Joined: 24-January 06
Member No.: 86085
Country Flag


QUOTE (Yzöwl @ Oct 31 2008, 04:56 PM) *
Sorry to add to a topic which has lay here silently for a couple of months but the reason for using that particular method was that VER returns only the version of the command interpreter not the running Operating System!

Hm, for me (German Windows XP Pro) it displays "Microsoft Windows XP [Version 5.1.2600]". So is it possible that someone runs another command interpreter with his OS (let's say the Win 2000 version of cmd.exe with Win XP), misleading the mentioned code to assume the wrong OS? Shouldn't happen on a clean source though...
In the end it's just a matter of taste - the wish to have hfslip working even with disable workstation service may also not be that common.
Go to the top of the page
 
+Quote Post
Yzöwl
post Oct 31 2008, 04:37 PM
Post #4


MSFN Master
Group Icon

Group: Super Moderator
Posts: 2749
Joined: 13-October 04
Member No.: 33618
OS: none
Country Flag


First thing I'd be interested in is why anyone would see the need to disable that service. By doing so, not only would you be unable to connect to any shared file or print resources on a network you'd also in effect not be able to use several other dependent services. Although I'm sure that some 'extreme home users' may have disabled it, using the batch scripting methods employed with HFSLIP it is still the best command interpreter independent method of determining the OS.

My suggestion without deliberately trying to find an alternative solution would be to incorporate a check for the services status first, if it isn't running then choose an alternate course of action to achieve your goal.
CODE
Net start|Find "Work"


As an alternative idea, you could use the attached executable I've created.
CODE
For /f "delims=" %%# In ('NTOS.exe') Do Set "HostOS=%%#"
The possible returned values are:
  • <empty>
    Best found with If Not Defined HostOS
    This will indicate an unknown or non-NT based OS
  • NT 3.51
  • NT 4.0
  • 2000
  • XP
  • 2003
  • Vista
    This will be returned for Windows Vista or 2008


I hope it comes in useful to those of you requiring it!
Attached File(s)
Attached File  NTOS.zip ( 238.35K ) Number of downloads: 7
 
Go to the top of the page
 
+Quote Post

Google Frontpage Forums Unattended CD/DVD Guide

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 7th January 2009 - 11:57 PM
All trademarks mentioned on this page are the property of their respective owners
MSFN is not affiliated with Microsoft
Copyright © 2001-2008 msfn.org
Privacy Policy