Create a GPO Startup Script to check OS version and then run an installer package

So I need a script connected to a GPO that will run when our laptops startup.  it should check if the OS version is X64 or X32 and then run the installer of X32 or X64 depending on the outcome of the OS verification part of the script.  I have created a script below and placed in the net logon folder in a sub folder that contains both my script and the installer packages.  So I have the installer files for x32 and x64 as well as the "osverify.bat" file within the samew folder "\\company.com\netlogon\namcredentialinstall" I added the script to GPO and set GPO to deploy on this OU for my test machine.  After bootup the installer had not run.  What have I got wrong?

Thanks



@echo off

if {%PROCESSOR_ARCHITEW6432%} EQU {} (
  set TRUE_ARCH=%PROCESSOR_ARCHITECTURE%
   start /b /wait NAMCredentialProvider.exe
   goto Done
) else (
  set TRUE_ARCH=%PROCESSOR_ARCHITEW6432%
  start /b /wait NAMCredentialProvider64.exe
  goto Done
)
echo Processor Architecture is %PROCESSOR_ARCHITECTURE%

:Done
timeout 15
exit
Twhite0909Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michael ChisholmCommented:
First did you do a gpupdate /force and then reboot. then do a gpresult /z and verify of the gpo applies correctly and is not filtered out.

let me know the results
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Michael ChisholmCommented:
On a side note the script will only need to check if the systems is 64bit. If it is not then the 32 script will run.
0
David Johnson, CD, MVPOwnerCommented:
I would use wmi filtering see my article on WMI Filtering in AD you would want a client os laptop x86 and client os laptop x64 filter
0
ON-DEMAND: 10 Easy Ways to Lose a Password

Learn about the methods that hackers use to lift real, working credentials from even the most security-savvy employees in this on-demand webinar. We cover the importance of multi-factor authentication and how these solutions can better protect your business!

Twhite0909Author Commented:
Im new to scripting and adding them to GPO so I could be doing something wrong here.  I ran the GPUPDATE /FORCE then GPRESULTS /Z and I don't see it in here skipped or applied.  Ive added screenshots of the following


The .bat script
The GPO Location
 The GPO Startup settings under "machine"

What am I doing wrong?
0
Twhite0909Author Commented:
Woops I have attached the pics below.  My GPO is called "TWTEST"
Batch-Script.PNG
GPO.PNG
Machine-Startup-Location.PNG
0
Twhite0909Author Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for Twhite0909's comment #a40944171

for the following reason:

gfdgfh
0
David Johnson, CD, MVPOwnerCommented:
PROCESSOR_ARCHITECTURE=AMD64 is the proper environmental variable.
where you got %PROCESSOR_ARCHITEW6432% from I have absolutely NO idea.


@echo off
IF (%Processor_Architecture% EQU "AMD64" (
rem    start /b /wait NAMCredentialPriver64.exe
echo Doing x64 install
	goto Done
 ) Else (
rem start /b /wait NAMCredentialPriver.exe
echo doing x86 install
)
:done
echo Processor_Architecture is %processor_Architecture%
timeout 15

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.