Share via


Windows PE custom script at startup

Question

Sunday, December 21, 2014 6:45 PM

Hey

During OSD I am using a custom script option from SCCM to do some special tasks (e.g. BGinfo etch.) when booting in Windows PE.
This works without problems after the first start.
Unfortunately if a restart into windows PE is done the custom script is not applied.
Does anyone know a better method to include a custom script that runs directly after every start of windows PE? (and probably previously to pxe password on first start?)

Thank you

Kind Regards
Mk-maddin

All replies (6)

Monday, December 22, 2014 1:13 PM âś…Answered

You could copy your script into a folder with a name of your choosing, e.g. Tools.

When you create your boot image, check the box Add extra files to the new boot image, and provide the path to the Tools folder containing your script. Be sure to include the folder name so that it gets copied to the root of the X: drive.

Then from a Run Command Line task sequence step, enter: cscript.exe x:\tools\your script> to execute your script(s) and/or executable(s). where applicable.

You could also copy this Tools folder after the OS has been applied using a Run Command Line step by entering: xcopy x:\tools c:\tools /cheryick so that it will be available to you during the FullOS phase of the task sequence.

Note, I prefer to use **%systemdrive% **in this context as the appropriate drive letter will be used depending on the deployment phase your in: X: for WinPE and C: (usually) for FullOS.

V/R, Darrick West - Senior Systems Engineer, ConfigMgr: OSD


Sunday, December 21, 2014 7:23 PM

what are you trying to accomplish?

Have you tried to add the script to the task sequence? 


Sunday, December 21, 2014 7:48 PM

Most additional reboots in a task sequence do not boot the system into WinPE, they boot the system into the OS you are deploying -- anything starting with the Setup Windows and ConfigMgr task. Thus adding anything as a pre-start command will have limited impact.

Have you looked at MDT? They already do this and at the very least, you can model what you want to do after what they did.

Jason | http://blog.configmgrftw.com | @jasonsandys


Sunday, December 21, 2014 9:13 PM

Hey

Well I have to perform a restart into windows PE after setting BIOS settings to apply them (activate TPM).
Using the Task sequence was not the idea because my post tasks are for troubleshooting and should be performed even if the task sequence does not work at all.
What I am looking for is something like the HKLM\Software\Microsoft\Windows\CurrentVersion\Run key and a way to add it easily to win PE.

A solution I was thinking about was e.g. to use a imagex script to set the key afterwards... but since scum recreates the whole win PE if I select "update distribution point" this change is lost with every version change of win PE...


Monday, December 22, 2014 1:23 AM

I recommend to use a Frontend for those configurations that is launched via tsconfig.ini or unattend.xml. E.g. prior to the task sequence is launched.

If the Frontend operation (TPM config) requires a reboot, just reboot and PXE boot again.

/ Johan

Regards / Johan Arwidmark Twitter: @jarwidmark Blog: http://www.deploymentresearch.com FB: www.facebook.com/deploymentresearch


Monday, December 22, 2014 8:32 AM

Hey all,

first thank you for your help.
I think my request was a bit miss understandable.
Again now with more detail:

I have a WinPE Boot image that contains "Prestart command settings"

These are settings which help in troubleshooting (like BGInfo or DaRT Remote Control etc.)
They work perfect in current configuration and I do NOT want them to start from Task Sequence because they need to take affect - even if Task Sequence have failures.

Now during my task sequence (one of the first steps) I do BIOS settings which require me to perform a restart from windows PE into windows PE.

Unfortunately after this restart the "Prestart command settings" do not apply.

My question is if there is another way to set these prestart command settings?