3 Replies Latest reply on Nov 15, 2018 2:22 PM by ldms_4mfe

    Execute File not Working on Provisioning

    CMulca Rookie

      Hello,

       

      So I created a batch file to setup the local administrator which would simply throw "Access Denied" errors within Windows when ran. So I created an AutoIt script that runs an elevated cmd and then run the commands which proves to work when running directly in Windows (same session I would get "Access Denied" from a sole batch).

       

      However, when I add the AutoIt file to the provisioning template and the scripts folder, to run during provisioning, it does not work. I believe it is because of UAC? The scripts copy over to the local PC just fine and if I manually run it, once provisioning is done, it prompts UAC and then the script works after authentication. So I know the .exe is ok. Also, I tried turning UAC off with reg values in the template too it would just break the install on reboot (UAC needs reboot after turning off). Our GPO requires UAC to be on so I am trying to do this prior to "Join Domain" in our template file. Any assistance is appreciated.

        • 1. Re: Execute File not Working on Provisioning
          ldms_4mfe Apprentice

          Hi CMulca,

           

          Skripts during provisioning run with the NT-Authority\System Account.

          So no UAC prompt will happen...the script has complete local admin rights.

           

          Maybe you can post your script.

           

          Regards, Marco

          • 2. Re: Execute File not Working on Provisioning
            CMulca Rookie

            A co-worker was looking at this with me and suggested we make this a "Software Distribution" task using the batch file instead. This idea worked so this is no longer a problem!

             

            However, I am still wondering why this script works but not when going through provisioning. In the future I may need to use this "Execute File" task. So in case you feel like looking a little further still, I will explain how it is setup.

             

            Here is the script:

            -----------------------------------

            Func Example()

               #RequireAdmin

               DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1) ; This disables 32bit applications from being redirected to syswow64 instead of system32 by default ;

                Run('c:\windows\system32\cmd.exe /c "C:\Windows\Temp\Scripts\ADMCMD.bat"')

            EndFunc   ;==>Example

            -------------------------------------

            This script is in the correct folder on the core server along with the batch file it references (ADMCMD.bat). Provisioning history has been saying this succeeds but in reality it does not. Both the script and the batch file successfully copy to the target PC too.

            • 3. Re: Execute File not Working on Provisioning
              ldms_4mfe Apprentice

              Sorry, I missed the reply.

               

              Is that the complete AutoIT Script?

              Because you missed a line to call the Func

               

              It must look like this:

               

              Func Example()

                 #RequireAdmin

                 DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1) ; This disables 32bit applications from being redirected to syswow64 instead of system32 by default ;

                  Run('c:\windows\system32\cmd.exe /c "C:\Windows\Temp\Scripts\ADMCMD.bat"')

              EndFunc   ;==>Example

               

              Example()