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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script to know whether OS is 32bit or 64bit

Status
Not open for further replies.

sxmont

IS-IT--Management
Sep 25, 2003
46
US
I have the following script:
@echo off

if not "%computername%" == "remote" (
\\mbplwfile\audit$\Logon.vbs
)

if "%computername%" == "remote" (
c:\WINDOWS\syswow64\cscript.exe \\mbplwfile\audit$\Logon.vbs
)

This script is ran via GP to all users to track their logon times and from which computer they are doing this from, which is the logon.vbs. However, the computer "remote" is a Server200364bit system and thus I needed to change the location of the cscript.exe to the syswow64 folder. The above works fine. NOW, I have a bunch of new Win764bit systems, so how I make this script run to change the location of the cscript for all Win764bit systems. I feel as though I am on the right track, but I am not a script expert and any help or guidance would be much appreciated.
 
What about something like this ?
IF EXIST c:\WINDOWS\syswow64\cscript.exe ...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
so you are saying if the syswow64 directory exists. I am not sure if that would work..
 
depends which context your script has actually been executed under, ;-)
this might help

strTemp1 = WshShell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%")
strTemp2 = WshShell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITEW6432%")
'
Select Case UCase(StrTemp1)
Case "X86"
GlobalArchitecture = HW_X86
If strComp (strTemp2, "AMD64", vbTextCompare)=0 Then
GlobalArchitectureIsX86under64Bit = True
Else
GlobalArchitectureIsX86under64Bit = False
End if
Case "X64"
GlobalArchitectureIsX86under64Bit = False
GlobalArchitecture = HW_X64
Case "AMD64"
GlobalArchitectureIsX86under64Bit = False
GlobalArchitecture = HW_X64
Case "IA64"
GlobalArchitectureIsX86under64Bit = False
GlobalArchitecture = IA64
End Select



I Hear, I Forget
I See, I Remember
I Do, I Understand

Ronald McDonald
 
I don't know how to incorporate that info to make sure the logon.vbs script works... Do you know what I mean by that?
 
when you say logon.vbs script works? what do you mean?
the code i provided should enable to you to determine two things?
1. is this box running a 64bit OS
2. has this vbscript been executed to run under a 64bit context
based on those two pieces of information you could do?
a) execute various functions etc in your script based on the client being 64bit?
b) choose to re-launch your script in a true 64bit context, e.g. the 32bit launched script runs WshShell.Run("%systemroot%\sysnative?\cscript.exe " & Wscript.ScriptFullName & " dont forget the parameters"????

what else are you meaning trying to do 'sxmont'?



I Hear, I Forget
I See, I Remember
I Do, I Understand

Ronald McDonald
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top