Jump to content


schooltech06

Package fails running simple bat file

Recommended Posts

Hi everyone,

I'm trying to push a simple batch file that will disable startup repair on windows 7. The batch file is only 2 lines but needs to run as an administrator:

bcdedit /set {default} recoveryenabled No 
bcdedit /set {default} bootstatuspolicy ignoreallfailures

I saved that as a .bat and created a package to deploy it to a collection. I set the command line option to be the name of the bat file, set it as a required package and set it to run as Administrator.

 

When it runs on the client machine, the execmgr log shows it running and exiting with error code 1. No changes are made in bcdedit. If I copy the script to the local machine, run a command prompt as admin, and run the script, it works fine. It seems like it's a permissions issue on the account that SCCM uses to run the script.

 

Are there certain SCCM accounts that should be local admins on the client computers? I have no issues when installing MSI's and EXE's using SCCM, but I can't figure this one out.

 

Any pointers anyone can offer?

 

Thanks

Share this post


Link to post
Share on other sites

I think I figured the problem. All our clients are 64-bit Windows 7. Apparently when SCCM runs a script, it uses a 32-bit command line. From what I can tell, I was calling Bcdedit and the 32-bit command line was redirecting it to C:\Windows\Syswow64 where there is no BCDEdit.

 

I found this blog entry that talks about the issue

http://madluka.wordpress.com/2012/09/24/configmgr-2012-64bit-file-system-redirection-bites-again/

 

I tried using his suggested code at the top of my batch file and the BCD file actually gets changed now.

IF "%PROCESSOR_ARCHITEW6432%"=="" GOTO native
  %SystemRoot%\Sysnative\cmd.exe /c %0 %* Exit
:native
<your script starts here>

It's still returning an exit code of 1 saying there was an error, but that could be because of the new code I added.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.