Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to determine if PC is XP By Login Script 1

Status
Not open for further replies.

detroit

MIS
Sep 13, 2002
160
CA
I need a quick and dirty way to find out by running a command in the login script to determine if XP Pro is running on the PC logging into the domain so I can apply a patch to it.

ANy help would be appreciated.

Detroit
 

Here is some quick code to determine if the OS is running Windows XP Professional:
Code:
     Set oSystem = GetObject("winMgmts:\\" & sCurrentPC)
     Set cComputers = oSystem.ExecQuery("SELECT * FROM Win32_OperatingSystem")

     For Each rComputer In cComputers
          sOSType = rComputer.Caption
     Next

     If sOSType = "Microsoft Windows XP Professional" Then
          MsgBox "This is a Windows XP Professional operating system."
     Else
          MsgBox "This is not a Windows XP Professional operating system."
     End If

Let me know if you have any questions. Peace out in the D ;-)


------------------------------------------------------------------------------
nobody knows everything about IT, so make a point to help your fellow members

-= j@ckle =-
 
Hi,

If you do the default install, and are 100% sure that you have no 9x boxes on the system, a very quick and dirty way is to check the environment variable %WINDIR%

If it equals C:\WINDOWS then you have XP (or 9x/Me) if C:\WINNT it is WinNT or 2000.

Looking for a more reliable method though as this is too prone to errors.

John
 
Unfortunately, we started to install 2K in the Windows directory, so that kills the other idea...

j@ckle, I don't have the foggiest idea what you were doing. Was that something run on the workstation end? I need to run it in my server scripts to see if XP Pro is installed and if it is, install a reg hack that needs to be installed.

Thanks to all, and still looking.....

Detroit
 
VER | find "XP" > nul
IF %errorlevel% EQU 0 GOTO s_win_XP

VER | find "2000" > nul
IF %errorlevel% EQU 0 GOTO s_win_2000

VER | find "NT" > nul
IF %errorlevel% EQU 0 GOTO s_win_NT
 
Hi,

Got one: Go to and download the latest version. You will find that this becomes useful for many other tricky scripting tasks as well.

From then on it is simply a matter of checking the @PRODUCTTYPE variable in a script.
Something like this:

Code:
; Copy to notepad, paste and save as InstallPatch.kix
IF @PRODUCTTYPE = "Windows XP Professional" Then
  ; Trigger installer
  Run "Install.exe"
EndIf

The command to run it will be similar to

g:\scripts\Kix32 g:\scripts\installpatch.kix

depending upon the location of scripts on your network, and it can be executed from your existing script.

John
 

What type of logon scripts are your using. I use VBS logon scripts. The script I listed above is VBScript that you can paste in your logon script.

When your logon script runs, it will determine if the client is a WinXP Pro workstation. If yes, then display "Is WinXP workstation", if no, then display "Is not WinXP Workstation".

To test copy the code into a text file. Rename the extension to .vbs, then double-click. It will give you an answer based on the OS.

Sorry for any confusion. Sometimes I automatically assume people know what I'm talking about...


------------------------------------------------------------------------------
nobody knows everything about IT, so make a point to help your fellow members

-= j@ckle =-
 
John,

Upgrades to XP from Win2k have c:\winnt as their %windir%
 
I'm using the VER example by bcastner and it works like a charm.

Thanks to all, especially bcastner....

Detroit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top