How to tell difference between windows Vista/7 and windows 2000/XP in a logon script
I have a problem. I need to create a shared shutdown script for 2000/XP machines and Vista/7 machines to install and configure software. It's easy enough to install the appropriate x86/x64 msi because I can use the %processor_architecture% variable. The problem comes when pre-configuring the program settings data, due to the change in application data storage location. In 2000/XP this was %ALLUSERSPROFILE%\Application Data\PROGRAM-NAME\ .... Usually C:\Documents and Settings\All Users\Application Data\PROGRAM-NAME\ In Vista/7 this has become just %ALLUSERSPROFILE%\PROGRAM-NAME .... Usually just C:\ProgramData\PROGRAM-NAME\ How can I tell whether the script is running on 2000/XP or Vista/7 ??
April 26th, 2011 2:25am

Hi Johnny, There is simple way to know whether the script is running on Windows 2000, Windows XP, Windows Vista and Windows 7. Just find 4 computers to test with the script. :)Thanks and Regards Scorpio_Milo MCTS: Windows Vista | Exchange Server 2007 MCITP: Enterprise Support Technician MCITP: Server & Enterprise Administrator Microsoft Infrastructure Consultant Enterprise Service: Solution Architect Contact me My Blog
Free Windows Admin Tool Kit Click here and download it now
April 26th, 2011 3:00am

Could you use a query like "if %allusersprofile%==C:\ProgramData"?
April 26th, 2011 3:33am

Thanks Scorpio? 4 ribbons! Were they all gained making similarly helpful comments? Thanks Eirik nice idea and that would normally work but unfortunately on our network not all of the clients are installed to the default partition.
Free Windows Admin Tool Kit Click here and download it now
April 28th, 2011 5:45am

Hi Johnny, If you run the variable %ALLUSERSPROFILE% on Windows XP, it opens C:\Documents and Settings\All Users. I assume Windows XP is installed on C: drive. If you run the variable %ALLUSERSPROFILE% on Windows 7, it opens C:\ProgramData directly. I assume Windows 7 is installed on C: drive. You need to use different variable\path in Windows XP\2000 and in Windows 7\Vista. To confirm whether the script works on all Windows XP\2000 and Windows 7\Vista, the easiest way will be running the script on 4 computers with different OS version manually and separately as Scorpio_Milo suggested. You can also check the OS version on the client first, after that, choose relative variable\path for different OS. Please submit a new thread in the script forum to ask for the script you need. Refer to the following link: The Official Scripting Guys Forum! http://social.technet.microsoft.com/Forums/en-US/ITCG/threads Thanks. NinaPlease remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
April 28th, 2011 10:18pm

There are several places where you can get the info, but you would then have to extract the essence for use with your script. Examples: reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion" /v ProductName wmic os get caption systeminfo | findstr /c:"OS Name:" ver
Free Windows Admin Tool Kit Click here and download it now
May 2nd, 2011 8:44am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics