Microsoft Windows Vista Community Forums - Vistaheads
Recommended Download



Welcome to the Microsoft Windows Vista Community Forums - Vistaheads, YOUR Largest Resource for Windows Vista related information.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so , join our community today!

If you have any problems with the registration process or your account login, please contact us.

Driver Scanner

Detect Vista in Logon Script

microsoft.public.windows.vista.administration accounts passwords






Speedup My PC
Reply
  #1 (permalink)  
Old 04-04-2007
=?Utf-8?B?RGF2ZQ==?=
 

Posts: n/a
Detect Vista in Logon Script
How can we detect for Windows Vista in our Logon Script? Previously we could
use OSVER.exe or even a 3rd party app OSVER61.exe to detect all versions of
windows through Server 2003. When OSVER is run on Vista it returns nothing,
not even unknown, just nothing. Is there a way to detect if a user is
running Vista or not? Maybe a newer version of OSVER, or another command
that we can run in a batch file? TIA
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-05-2007
JerryM \(ID\)
 

Posts: n/a
Re: Detect Vista in Logon Script
Just like before, Control panel -System

"Dave" <Dave@discussions.microsoft.com> wrote in message
newsAC8245A-41B5-460E-8C1E-7AD8B9DA043D@microsoft.com...
> How can we detect for Windows Vista in our Logon Script? Previously we
> could
> use OSVER.exe or even a 3rd party app OSVER61.exe to detect all versions
> of
> windows through Server 2003. When OSVER is run on Vista it returns
> nothing,
> not even unknown, just nothing. Is there a way to detect if a user is
> running Vista or not? Maybe a newer version of OSVER, or another command
> that we can run in a batch file? TIA


Reply With Quote
  #3 (permalink)  
Old 04-05-2007
 

Posts: n/a
Re: Detect Vista in Logon Script

"Dave" <Dave@discussions.microsoft.com> wrote in message
newsAC8245A-41B5-460E-8C1E-7AD8B9DA043D@microsoft.com...
> How can we detect for Windows Vista in our Logon Script? Previously we
> could
> use OSVER.exe or even a 3rd party app OSVER61.exe to detect all versions
> of
> windows through Server 2003. When OSVER is run on Vista it returns
> nothing,
> not even unknown, just nothing. Is there a way to detect if a user is
> running Vista or not? Maybe a newer version of OSVER, or another command
> that we can run in a batch file? TIA


When I was writing my logon scripts, I checked for environment variables.
Ex - if %os%==Windows_NT then do winxp stuff (as we have no nt4 or even 2k
pro machines on the network, this worked properly)

For Vista, I noticed that the %os% variable is the same, so I had to check
something else, but I needed to do this before my xp check, so now I do
something like this...

if "%allusersprofile%"=="C:\ProgramData" goto WinVista
if %os%==Windows_NT goto WinXP
::
::if it gets here, assume 9x base
::
exit
::
:Winvista
@Echo Windows Vista Operating System Detected
goto fin
::
:winxp
@Echo Windows XP Operating System Detected
::
:fin

This is an example of a script I use daily, and I've not yet had a problem
with it detecting the wrong OS.

Hope this helps.

D


Reply With Quote
  #4 (permalink)  
Old 04-05-2007
=?Utf-8?B?RGF2ZQ==?=
 

Posts: n/a
Re: Detect Vista in Logon Script
D,

Thank you, that's EXACTLY what I was looking for.

-Dave

"D" wrote:

>
> "Dave" <Dave@discussions.microsoft.com> wrote in message
> newsAC8245A-41B5-460E-8C1E-7AD8B9DA043D@microsoft.com...
> > How can we detect for Windows Vista in our Logon Script? Previously we
> > could
> > use OSVER.exe or even a 3rd party app OSVER61.exe to detect all versions
> > of
> > windows through Server 2003. When OSVER is run on Vista it returns
> > nothing,
> > not even unknown, just nothing. Is there a way to detect if a user is
> > running Vista or not? Maybe a newer version of OSVER, or another command
> > that we can run in a batch file? TIA

>
> When I was writing my logon scripts, I checked for environment variables.
> Ex - if %os%==Windows_NT then do winxp stuff (as we have no nt4 or even 2k
> pro machines on the network, this worked properly)
>
> For Vista, I noticed that the %os% variable is the same, so I had to check
> something else, but I needed to do this before my xp check, so now I do
> something like this...
>
> if "%allusersprofile%"=="C:\ProgramData" goto WinVista
> if %os%==Windows_NT goto WinXP
> ::
> ::if it gets here, assume 9x base
> ::
> exit
> ::
> :Winvista
> @Echo Windows Vista Operating System Detected
> goto fin
> ::
> :winxp
> @Echo Windows XP Operating System Detected
> ::
> :fin
>
> This is an example of a script I use daily, and I've not yet had a problem
> with it detecting the wrong OS.
>
> Hope this helps.
>
> D
>
>
>

Reply With Quote
  #5 (permalink)  
Old 04-05-2007
 

Posts: n/a
Re: Detect Vista in Logon Script

"Dave" <Dave@discussions.microsoft.com> wrote in message
news:325968FA-2FA5-4115-9E84-35D21E54B2DD@microsoft.com...
> D,
>
> Thank you, that's EXACTLY what I was looking for.
>
> -Dave
>
> "D" wrote:
>
>>
>> "Dave" <Dave@discussions.microsoft.com> wrote in message
>> newsAC8245A-41B5-460E-8C1E-7AD8B9DA043D@microsoft.com...
>> > How can we detect for Windows Vista in our Logon Script? Previously we
>> > could
>> > use OSVER.exe or even a 3rd party app OSVER61.exe to detect all
>> > versions
>> > of
>> > windows through Server 2003. When OSVER is run on Vista it returns
>> > nothing,
>> > not even unknown, just nothing. Is there a way to detect if a user is
>> > running Vista or not? Maybe a newer version of OSVER, or another
>> > command
>> > that we can run in a batch file? TIA

>>
>> When I was writing my logon scripts, I checked for environment variables.
>> Ex - if %os%==Windows_NT then do winxp stuff (as we have no nt4 or even
>> 2k
>> pro machines on the network, this worked properly)
>>
>> For Vista, I noticed that the %os% variable is the same, so I had to
>> check
>> something else, but I needed to do this before my xp check, so now I do
>> something like this...
>>
>> if "%allusersprofile%"=="C:\ProgramData" goto WinVista
>> if %os%==Windows_NT goto WinXP
>> ::
>> ::if it gets here, assume 9x base
>> ::
>> exit
>> ::
>> :Winvista
>> @Echo Windows Vista Operating System Detected
>> goto fin
>> ::
>> :winxp
>> @Echo Windows XP Operating System Detected
>> ::
>> :fin
>>
>> This is an example of a script I use daily, and I've not yet had a
>> problem
>> with it detecting the wrong OS.
>>
>> Hope this helps.
>>
>> D
>>
>>
>>


Dave,

Glad to help out.

Doug


Reply With Quote
  #6 (permalink)  
Old 04-05-2007
youyang
 

Posts: n/a
Re: Detect Vista in Logon Script
Hi, here is the code I used in my batch File:

ECHO *Detecting Windows Version...

VER | findstr /i "5.1.2600" > nul
IF %ERRORLEVEL% EQU 0 GOTO XP


VER | findstr /i "5.2.3790" > nul
IF %ERRORLEVEL% EQU 0 GOTO 2003

VER | findstr /i "6.0.6000" > nul
IF %ERRORLEVEL% EQU 0 GOTO VISTARTM

:XP
ECHO *Windows XP
REM TODO
GOTO EOF

:2003
ECHO *Windows Server 2003
REM TODO
GOTO EOF

:VISTARTM
ECHO *Windows Vista RTM


--
Thanks
*
大家有时间听一下《雪花》
"Dave" <Dave@discussions.microsoft.com> wrote in message
newsAC8245A-41B5-460E-8C1E-7AD8B9DA043D@microsoft.com...
> How can we detect for Windows Vista in our Logon Script? Previously we
> could
> use OSVER.exe or even a 3rd party app OSVER61.exe to detect all versions
> of
> windows through Server 2003. When OSVER is run on Vista it returns
> nothing,
> not even unknown, just nothing. Is there a way to detect if a user is
> running Vista or not? Maybe a newer version of OSVER, or another command
> that we can run in a batch file? TIA


Reply With Quote
  #7 (permalink)  
Old 04-05-2007
=?Utf-8?B?RGF2ZQ==?=
 

Posts: n/a
Re: Detect Vista in Logon Script
Thanks Youyang, I'll keep this one in mind also.

We might be pushing our luck here, but does anyone have an idea on how to
determine the "flavor" of Windows Vista? We probably don't want to run the
same commands for our users who have Vista Home vs. Business/Ultimate.

-Dave

"youyang" wrote:

> Hi, here is the code I used in my batch File:
>
> ECHO *Detecting Windows Version...
>
> VER | findstr /i "5.1.2600" > nul
> IF %ERRORLEVEL% EQU 0 GOTO XP
>
>
> VER | findstr /i "5.2.3790" > nul
> IF %ERRORLEVEL% EQU 0 GOTO 2003
>
> VER | findstr /i "6.0.6000" > nul
> IF %ERRORLEVEL% EQU 0 GOTO VISTARTM
>
> :XP
> ECHO *Windows XP
> REM TODO
> GOTO EOF
>
> :2003
> ECHO *Windows Server 2003
> REM TODO
> GOTO EOF
>
> :VISTARTM
> ECHO *Windows Vista RTM
>
>
> --
> Thanks
> *
> 大家有时间听一下《雪花》
> "Dave" <Dave@discussions.microsoft.com> wrote in message
> newsAC8245A-41B5-460E-8C1E-7AD8B9DA043D@microsoft.com...
> > How can we detect for Windows Vista in our Logon Script? Previously we
> > could
> > use OSVER.exe or even a 3rd party app OSVER61.exe to detect all versions
> > of
> > windows through Server 2003. When OSVER is run on Vista it returns
> > nothing,
> > not even unknown, just nothing. Is there a way to detect if a user is
> > running Vista or not? Maybe a newer version of OSVER, or another command
> > that we can run in a batch file? TIA

>
>

Reply With Quote
  #8 (permalink)  
Old 04-05-2007
 

Posts: n/a
Re: Detect Vista in Logon Script
I don't have Vista home on a machine nearby, but on Vista Business (and
probably Ultimate and Enterprise), there are 2 variables - USERDOMAIN and
USERDNSDOMAIN. So, using the info I orginally posted, and assuming you were
on a domain, you could do something like...

if %userdomain%==mydomain goto vistabiz

or even...

if "%userdomain%"=="" goto nodomain
::do vista business stuff here...
::
goto fin
:nodomain
::system not on domain, so assume vista home
::
:fin

One thing you can do to see what environment variables to use would be to
open a command prompt and type in SET and hit enter. If you have a Vista
Home machine near you, compare the variables to see what is on the Vista
Home machine that might not be on the Business machine, or vice versa, and
then use that variable in your script.

Also, you could talk to whomever is resonsible for imaging and deploying
machines in your location and ask them to set the machines up with a global
environment variable via the default user registry, but I think you'd be
better off looking at the existing environment variables.

Again, hope this helps.

Doug

"Dave" <Dave@discussions.microsoft.com> wrote in message
news4B7C136-F21F-40E6-A9C0-4E2BE79BF1B6@microsoft.com...
> Thanks Youyang, I'll keep this one in mind also.
>
> We might be pushing our luck here, but does anyone have an idea on how to
> determine the "flavor" of Windows Vista? We probably don't want to run
> the
> same commands for our users who have Vista Home vs. Business/Ultimate.
>
> -Dave
>
> "youyang" wrote:
>
>> Hi, here is the code I used in my batch File:
>>
>> ECHO *Detecting Windows Version...
>>
>> VER | findstr /i "5.1.2600" > nul
>> IF %ERRORLEVEL% EQU 0 GOTO XP
>>
>>
>> VER | findstr /i "5.2.3790" > nul
>> IF %ERRORLEVEL% EQU 0 GOTO 2003
>>
>> VER | findstr /i "6.0.6000" > nul
>> IF %ERRORLEVEL% EQU 0 GOTO VISTARTM
>>
>> :XP
>> ECHO *Windows XP
>> REM TODO
>> GOTO EOF
>>
>> :2003
>> ECHO *Windows Server 2003
>> REM TODO
>> GOTO EOF
>>
>> :VISTARTM
>> ECHO *Windows Vista RTM
>>
>>
>> --
>> Thanks
>> ?
>> ????????????
>> "Dave" <Dave@discussions.microsoft.com> wrote in message
>> newsAC8245A-41B5-460E-8C1E-7AD8B9DA043D@microsoft.com...
>> > How can we detect for Windows Vista in our Logon Script? Previously we
>> > could
>> > use OSVER.exe or even a 3rd party app OSVER61.exe to detect all
>> > versions
>> > of
>> > windows through Server 2003. When OSVER is run on Vista it returns
>> > nothing,
>> > not even unknown, just nothing. Is there a way to detect if a user is
>> > running Vista or not? Maybe a newer version of OSVER, or another
>> > command
>> > that we can run in a batch file? TIA

>>
>>



Reply With Quote
  #9 (permalink)  
Old 04-06-2007
GTS
 

Posts: n/a
Re: Detect Vista in Logon Script
D
One minor suggestion. Rather than hard coding the drive letter (which
fails on my dual boot xp/vista machine with Vista on D I would do it this
way.

if "%allusersprofile%"=="%HOMEDRIVE%\ProgramData" goto WinVista


> When I was writing my logon scripts, I checked for environment variables.
> Ex - if %os%==Windows_NT then do winxp stuff (as we have no nt4 or even 2k
> pro machines on the network, this worked properly)
>
> For Vista, I noticed that the %os% variable is the same, so I had to check
> something else, but I needed to do this before my xp check, so now I do
> something like this...
>
> if "%allusersprofile%"=="C:\ProgramData" goto WinVista
> if %os%==Windows_NT goto WinXP
> ::
> ::if it gets here, assume 9x base
> ::
> exit
> ::
> :Winvista
> @Echo Windows Vista Operating System Detected
> goto fin
> ::
> :winxp
> @Echo Windows XP Operating System Detected
> ::
> :fin
>
> This is an example of a script I use daily, and I've not yet had a problem
> with it detecting the wrong OS.
>
> Hope this helps.
>
> D
>


Reply With Quote
  #10 (permalink)  
Old 04-09-2007
 

Posts: n/a
Re: Detect Vista in Logon Script
That's a good idea, but in an AD domain based environment, that might not
work as many admins populate the map home drive (letter) to (path) which
then sets the %homedrive% variable. But, like I said it's a good idea to
not code the drive letter. Instead, and I believe this is what you had
meant to say, was to use %systemdrive%

Thanks for the tip though

Doug
"GTS" <x@y.net> wrote in message
news:ukSD3o$dHHA.4688@TK2MSFTNGP04.phx.gbl...
> D
> One minor suggestion. Rather than hard coding the drive letter (which
> fails on my dual boot xp/vista machine with Vista on D I would do it
> this way.
>
> if "%allusersprofile%"=="%HOMEDRIVE%\ProgramData" goto WinVista
>
>
>> When I was writing my logon scripts, I checked for environment variables.
>> Ex - if %os%==Windows_NT then do winxp stuff (as we have no nt4 or even
>> 2k pro machines on the network, this worked properly)
>>
>> For Vista, I noticed that the %os% variable is the same, so I had to
>> check something else, but I needed to do this before my xp check, so now
>> I do something like this...
>>
>> if "%allusersprofile%"=="C:\ProgramData" goto WinVista
>> if %os%==Windows_NT goto WinXP
>> ::
>> ::if it gets here, assume 9x base
>> ::
>> exit
>> ::
>> :Winvista
>> @Echo Windows Vista Operating System Detected
>> goto fin
>> ::
>> :winxp
>> @Echo Windows XP Operating System Detected
>> ::
>> :fin
>>
>> This is an example of a script I use daily, and I've not yet had a
>> problem with it detecting the wrong OS.
>>
>> Hope this helps.
>>
>> D
>>

>



Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why doesn't this mapping script work in Vista? mark1210 microsoft.public.windows.vista.networking sharing 5 04-05-2007 19:21
Vista services WMI script Richard Stallmann microsoft.public.windows.vista.general 0 03-22-2007 00:56
RE: Logon Script =?Utf-8?B?SlJN?= microsoft.public.windows.vista.general 0 02-28-2007 17:44
RE: Vista and Mapping Drives via script =?Utf-8?B?UmljaGFyZCBEYXZpcw==?= microsoft.public.windows.vista.general 0 02-28-2007 17:43
nvidia vista drivers don't detect hardware =?Utf-8?B?bWlrZWU=?= microsoft.public.windows.vista hardware devices 12 02-10-2007 15:03




All times are GMT +1. The time now is 21:24.




Driver Scanner - Free Scan Now

Vistaheads.com is part of the Heads Network. See also XPHeads.com , Win7Heads.com and Win8Heads.com.


Design by Vjacheslav Trushkin for phpBBStyles.com.
Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.6.0 RC 2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120