/build/static/layout/Breadcrumb_cap_w.png

SCCM 32bit launcher issue (having issue on 64-bit machine)

Hello,

I am using SCCM 2012 and having issues reading/enumerating registry keys on 64-bit machines.

For example, when I launch my vbs via SCCM, it cannot find HKLM\Software\Microsoft\WIndows\CurrentVersion\Uninstall registry keys. I understand that SCCM is a 32-bit app and that is why there is re-direction issue. I have searched on the web and found out that %windir%\sysnative\cscript.exe install.vbs works (But, this fails the app to install on a 32-bit machine)

My install.vbs works very well when I launch it as myself/even as SYSTEM using psexec. I am having issue only when launching from SCCM

Is there a way that I can fix this? Please let me know

Thanks

0 Comments   [ + ] Show comments

Answers (3)

Answer Summary:
Calling VBScript from this batch script will work. Run the bat script from SCCM and that should take care of it IF EXIST "%WINDIR%\SYSNATIVE\CSCRIPT.EXE" ( "%WINDIR%\SYSNATIVE\CSCRIPT.EXE" "%~dp0Script.vbs" ) ELSE ( CSCRIPT.EXE "%~dp0Script.vbs" )
Posted by: rad33k 7 years ago
Fourth Degree Brown Belt
1

Top Answer

I think that rileyz thought about a BAT script to call your VBS as 64bit process on a x64 machine or 32bit process on a x86 machine.
Something like this:
IF EXIST "%WINDIR%\SYSNATIVE\CSCRIPT.EXE" (
"%WINDIR%\SYSNATIVE\CSCRIPT.EXE" "%~dp0Script.vbs"
) ELSE (
CSCRIPT.EXE "%~dp0Script.vbs"
)

Mentioned 'check box to set the biteness execution of the application in SCCM' refers to SCCM APPLICATIONS only - it does not exist in PACKAGES (Packages are started in 32bit environment only).

Another option is to adjust VBS to switch __ProviderArchitecture to 64bit in case of 32 bit execution on 64bit OS. See examples:
http://www.gunnalag.com/2014/06/05/accessing-64bit-registry-keys-via-32bit-scripting-languages-2/
https://david.gardiner.net.au/2007/03/listing-installed-applications-on-vista.html

Comments:
  • Hi Rad33k,
    I have tried the first part of your suggestion. But, when I launch a batch script to call vbscript, the batch itself is running 32-bit and it cannot find a sysnative folder at all. So that does not seem to work for me.
    I will try the second part and see if it works for me

    Do you know if I can call a function on dll using vbscript? I have tried searching, but, could not find. Specifically, i am trying to call wow64redire tion function on kernel32.dll.

    Please let me know
    Thanks - techsurfer 7 years ago
    • Hi,
      'sysnative' call works only for 32bit process on 64bit OS. It allows to reach native part of the OS which is 64bit in such case. General idea of provided batch example is to call native cscript.exe in case of 32bit execution and standards csript.exe if started as 64bit process.
      Maybe I missed something in the script logic but I see only following situations:
      1. If you run this batch as 64bit process on 64 bit OS it will go to ELSE statement, as SYSNATIVE does not exist for 64bit process (IF is evaluated to FALSE)
      2. If you run this batch as 32bit process on 64 bit OS it will go to SYSNATIVE call, so it will start your script as 64bit (IF is evaluated to TRUE)
      3. If you run this batch as 32bit process on 32 bit OS it will go to ELSE statement, as SYSNATIVE does not exist on 32bit OS (IF is evaluated to FALSE)

      Regading DLL calls in VBS I've never used it for my custom DLLs (but all of us are using it while creating common objects like FSO, Shell etc.). For nor standards DLLs I used only Rundll32.exe <DLLMudle>,Function[params].
      I heard something that if DLL is registered you can use CreateObject("DLLs_ProgID") like for common VBS objects and then try to call methods implemneted into this module - I tried it once and it didn't work for tested DLL (maybe it was caused by the type of the DLL file I used in my test :) - rad33k 7 years ago
      • I was doing the same bat script and it did not work. I fixed the bracket part and now Seems like the running vbscript from bat file is working. I will let everyone know if it is successful in further tests as well

        Thanks - Now I dont need to deal with the dll function part :) - techsurfer 7 years ago
      • Good to hear that :)
        For me, provided example works like a charm so this is quite interesting why it did not work in your SCCM test ;-) - rad33k 7 years ago
Posted by: rileyz 7 years ago
Red Belt
0

Humm, isn't there a check box to set the biteness execution of the application in SCCM, sorry don't have a console up. But hope you get what I mean. Try and fix the issue via SCCM configs.

If that doesn't fix it, then you can script around the problem, just as a hash example. You could create a batch file to detect  %windir%\sysnative\cscript.exe, if its here then launch it with script, otherwise fall back to %windir%\cscript.exe and launch it.

Pretty poor pseudo code, but the gist is there!


Comments:
  • There is a check for OS detection. But, then I would have two create two different programs for a single app.
    I have tried the detection methods as you said, but, since sccm is already running as 32-bit, if one OS version works, the other does not. Meaning first works on 64-bit (fails on 32-bit) and vice versa
    Not sure how everyone is doing it - techsurfer 7 years ago
Posted by: Maidens 7 years ago
Third Degree Blue Belt
0

Taking a slightly different approach, it might be an idea to look at creating SCCM Task Sequence (TS) for your Office install/uninstall. This allows you to target a mixture of Applications, Packages and script based installs with the added benefit of setting specific conditions for individual tasks within the sequence. I myself ran into some issue with Office 2013 deployments a while back, which was resolved by using TS for greater manipulation which worked a treat....

Anyway many ways to skin a cat but thought it was worth mentioning :)


Comments:
  • Thanks for the comment. There are few workarounds that i have such as wow64fileredirection using kernel32.dll in wise script (which includes task sequence) .
    I am trying to find a good workaround that I can consistently use so that the package/application creation could be automated.

    I am feeling pretty dumb that I am unable to work a script through SCCM which otherwise works fine. Thanks - techsurfer 7 years ago
    • No worries. Yeah SCCM frustration, been there loads, feel your pain......with your workarounds and installation variables, I would defo consider breaking everything down into individual tasks within the TS and using variables to target specific requirements. However appreciate it may involve a bit more of additional effort from your script, but once its functioning your TS will be bulletproof....

      Best of luck! - Maidens 7 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ