Topic: Run Command After PENetwork in Win10PE SE  (Read 779 times)

0 Members and 1 Guest are viewing this topic.

Run Command After PENetwork in Win10PE SE
« on: May 01, 2017, 01:22:34 AM »

kckennedy

  • Apprentice
  • *
  • Date Registered: Apr 2017
  • Posts: 4
I've been searching for a while now, something that should be extremely simple, how to run a command after PENetwork loads?  What happened to running things from startnet.cmd?  All I can find is create a plug-in?  I don't understand how to do that, no one is giving thorough instructions, and the Winbuilder itself is not intuitive for an old Microsoft guy.  Please help before I loss my mind completely. :)

Re: Run Command After PENetwork in Win10PE SE
« Reply #1 on: May 01, 2017, 02:43:34 PM »

kckennedy

  • Apprentice
  • *
  • Date Registered: Apr 2017
  • Posts: 4
OK, so as we so often do, let's answer our own question...
Add to your project under \Workbench\Common\PENetwork_Include a file called PeNetwork_After.cmd and any other support files you need.

My whole build:
-Add folders to antivirus exceptions:
   D:\WinPESE (WinBuilder working folder)
   D:\W10P1607 (Windows 10 Source Files - extracted from iso)
-Run WinBuilder.exe as administrator
-Run "Update WinPESE (Exact and Secure)" under Utils, uncheck "Preserve Plugin Settings", click the "Update (Download + Copy)" button
-Click the Source button at top and browse to Windows 10 source files (D:\W10P1607) and click OK
-Select "Extract Wim Folders" under Utils (make sure Script button is selected at top), and click the "Gooooooo" button.
-Run GetWaikTools under Utils (click Lauch and select ADK Tools for Win10 and Dism for Windows 10)
-Under Build, "CdDrive - X: -Y:" check/enable the "Run ALL programs from RAM" checkbox.
-Under Tweaks, uncheck Wallpaper, check "Remove Watermark"
-Under Components, PENetwork, disable the "Startup countdown" button
-Add files to D:\WinPE10SE\Workbench\Common\PENetwork_Include
 myexecutable.exe
 PeNetwork_After.cmd with "start myexecutable.exe"
-Under Drivers, select "Original NET drivers" and enable all checkboxes.
-Play
Will be using with WDS as an imaging solution.

Re: Run Command After PENetwork in Win10PE SE
« Reply #2 on: May 25, 2017, 10:52:17 AM »

Tony4219

  • Chef
  • ***
  • Date Registered: Mar 2015
  • Posts: 132
... to run a command after PENetwork finishes ...


When I had to do a delay at startup,  I began with info from the Winbuilder help file, but I found a bunch of things that did not work reliably. What did work (found it by reading the forum postings) was to add the "Lancelot et al" delay (the method to delay something after Winbuilder/WPEX  (Windows 10 PE) completely finishes booting up including PENetwork.  You can't really tell when it is done, so they used a control to adjust the number of seconds of delay.  See long discussion at TheOven http://theoven.org/index.php?topic=627.0 from 2013 covers LOT of autorun-at-bootup probs.  Using "Add_Shortcut,AutoRun" requires Autorun plugin be Enabled; that worked only some of the time.

See the  UltraVNC plugin v23 on Yomi server by Galapo at  http://yomi.cwcodes.net/    They added a Delay in order to autorun EXE at boot via CMDfile by Lancelot, Galapo, et al.  This delays running any EXE  by an adjustable number of seconds.  Amazing. And it does work, but it is complicated, because you will have to fit it into your plugin.

Good luck.

« Previous Edit: Today at 11:01:21 AM by Tony4219, Reason: last edit: attachment too big, even zipped  »

Having said that, the following additions are what I added to a plugin for TrayStatus.exe to allow selectable delay:


// From UltraVNC plugin v23 on Yomi server by Galapo.  Add these to your plugin to add 'Lancelot et al' Delay

// ATTACHMENTS NEEDED:          THIS ALSO REQUIRES ATTACHMENTS in 'Folder' of sleep.7z and ckill.7z
//  (extract both from UltraVNC plugin v23)

//Additions needed to Interface and Process sections:


[Interface]
Startup_Shortcut_CheckBox=" Autorun at startup",1,3,200,122,122,18,True
Startup_Delay_TextLabela=Delay,1,1,198,143,27,18,8,Normal
Startup_Delay_NumberBox=pNumberBox1,1,2,227,141,40,22,20,0,0,
Startup_Delay_TextLabelb=Seconds,1,1,271,143,41,18,8,Normal
pBevel1=pBevel1,1,12,194,116,127,50


[Process]
//------- start of delay section ------------------------------- put at end of Process section
echo,"Processing Delay section ..."
//        From UltraVNC plugin v23 on Yomi server by Galapo. Delay added to autorun EXE at boot via CMDfile by Lancelot, Galapo, levicitus777, yaab, et al.
//        Merely replaced EXEname and used 1st icon instead of 2nd for my (Tony4219: TrayStatus) plugin. You can't argue with success.
//        Tony4219: TO RE-USE, REPLACE "TrayStatus" with name of your EXE.
//        Up/Down textbox number incrementer is INCREDIBLE.  Kudos to the Winbuilder author(s).
If,%Startup_Shortcut_CheckBox%,Equal,True,Begin
  If,%Startup_Delay_NumberBox%,Equal,0,Add_Shortcut,AutoStart,,%PE_Programs%\%ProgramFolder%\TrayStatus.exe,"TrayStatus",%PE_Programs%\%ProgramFolder%
  Else,Begin
    //Double cmd files used to increase compatibility between projects (shells) so 1st shell minimizes (without need of hiderun which truely not needed for this case). Thanks yaab reminding this idea :>:>.
    FileCreateBlank,%Target_Prog%\%ProgramFolder%\DelayStart.cmd
    TxtAddLine,%Target_Prog%\%ProgramFolder%\DelayStart.cmd,"cd /d #$p~dp0",Append
    TxtAddLine,%Target_Prog%\%ProgramFolder%\DelayStart.cmd,"@echo off",Append
    TxtAddLine,%Target_Prog%\%ProgramFolder%\DelayStart.cmd,"start #$q%ProgramTitle% %Startup_Delay_NumberBox% seconds Delayed Startup#$q /min .\DelayStartup.cmd",Append
    TxtAddLine,%Target_Prog%\%ProgramFolder%\DelayStart.cmd,"Exit",Append
    FileCreateBlank,%Target_Prog%\%ProgramFolder%\DelayStartup.cmd
    TxtAddLine,%Target_Prog%\%ProgramFolder%\DelayStartup.cmd,"@echo off",Append
    TxtAddLine,%Target_Prog%\%ProgramFolder%\DelayStartup.cmd,"Echo killing TrayStatus if exists",Append
    TxtAddLine,%Target_Prog%\%ProgramFolder%\DelayStartup.cmd,"ckill.exe TrayStatus",Append
    TxtAddLine,%Target_Prog%\%ProgramFolder%\DelayStartup.cmd,"ckill.exe TrayStatus",Append
    TxtAddLine,%Target_Prog%\%ProgramFolder%\DelayStartup.cmd,"ckill.exe TrayStatus",Append
    TxtAddLine,%Target_Prog%\%ProgramFolder%\DelayStartup.cmd,"ckill.exe TrayStatus",Append
    TxtAddLine,%Target_Prog%\%ProgramFolder%\DelayStartup.cmd,"cls",Append
    TxtAddLine,%Target_Prog%\%ProgramFolder%\DelayStartup.cmd,"Echo Waiting %ProgramTitle% %Startup_Delay_NumberBox% seconds for probably network initialization...",Append
    TxtAddLine,%Target_Prog%\%ProgramFolder%\DelayStartup.cmd,"Sleep.exe %Startup_Delay_NumberBox%",Append
    TxtAddLine,%Target_Prog%\%ProgramFolder%\DelayStartup.cmd,"Echo killing TrayStatus if exists",Append
    TxtAddLine,%Target_Prog%\%ProgramFolder%\DelayStartup.cmd,"ckill.exe TrayStatus",Append
    TxtAddLine,%Target_Prog%\%ProgramFolder%\DelayStartup.cmd,"ckill.exe TrayStatus",Append
    TxtAddLine,%Target_Prog%\%ProgramFolder%\DelayStartup.cmd,"ckill.exe TrayStatus",Append
    TxtAddLine,%Target_Prog%\%ProgramFolder%\DelayStartup.cmd,"ckill.exe TrayStatus",Append
    TxtAddLine,%Target_Prog%\%ProgramFolder%\DelayStartup.cmd,"cls",Append
    TxtAddLine,%Target_Prog%\%ProgramFolder%\DelayStartup.cmd,"Echo Starting TrayStatus",Append
    TxtAddLine,%Target_Prog%\%ProgramFolder%\DelayStartup.cmd,"Start TrayStatus",Append
    TxtAddLine,%Target_Prog%\%ProgramFolder%\DelayStartup.cmd,"Exit",Append
    //--
    ExtractFile,%scriptfile%,Folder,sleep.7z,%Target_Prog%\%ProgramFolder%
    ShellExecute,Hide,%Tools%\7z.exe,"e #$q%Target_Prog%\%ProgramFolder%\sleep.7z#$q -y -o#$q%Target_Prog%\%ProgramFolder%#$q Sleep\sleep-%SourceArch%.exe"
    FileRename,%Target_Prog%\%ProgramFolder%\sleep-%SourceArch%.exe,%Target_Prog%\%ProgramFolder%\sleep.exe
    Call,FileDelete,%Target_Prog%\%ProgramFolder%\sleep.7z
    //--
    ExtractFile,%scriptfile%,Folder,ckill.7z,%Target_Prog%\%ProgramFolder%
    ShellExecute,Hide,%Tools%\7z.exe,"e #$q%Target_Prog%\%ProgramFolder%\ckill.7z#$q -y -o#$q%Target_Prog%\%ProgramFolder%#$q ckill\ckill-%SourceArch%.exe"
    FileRename,%Target_Prog%\%ProgramFolder%\ckill-%SourceArch%.exe,%Target_Prog%\%ProgramFolder%\ckill.exe
    Call,FileDelete,%Target_Prog%\%ProgramFolder%\ckill.7z
    //--
    Add_Shortcut,AutoStart,,%PE_Programs%\%ProgramFolder%\DelayStart.cmd,"TrayStatus",%PE_Programs%\%ProgramFolder%,,%PE_Programs%\%ProgramFolder%\TrayStatus.exe,1
  End
End
//------- /\ end of delay section ----------------------------------------------------- end of Lancelot et al DELAY function


« Last Edit: May 25, 2017, 01:02:23 PM by Tony4219 »

Re: Run Command After PENetwork in Win10PE SE
« Reply #3 on: June 25, 2017, 03:12:28 AM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 7052
Hi Tony4219, kckennedy

Utils\PC Packed (Plugin Creator Packed)

have delay option for a while.
Reply 75 - Feb 12 2017 - http://theoven.org/index.php?topic=178.msg22839#msg22839


Utils\PC Packed
-> Hit Options Button
-> Enable "Add Startup Option"
----> Enable "Delay"
1) .....
2) .....
3) Gooo


=====>
This will create a plugin without messing with codes,
 with "Startup" and "Delay" options,
  which together are most useful for post penetwork things.

:turtle:

Re: Run Command After PENetwork in Win10PE SE
« Reply #4 on: June 26, 2017, 04:18:26 AM »

Tony4219

  • Chef
  • ***
  • Date Registered: Mar 2015
  • Posts: 132
Thanks!  :thumbsup: I did not realize that.

Re: Run Command After PENetwork in Win10PE SE
« Reply #5 on: July 10, 2017, 06:03:44 AM »

whiggs

  • Jr. Chef
  • **
  • Date Registered: Jul 2015
  • Posts: 25
Or, what you can do is, after the Winpe is compiled and built, there is a script called TheOven_Startup_CD.cmd in the root of whatever media you built and in the root of the directory containing the build files.  That is the script which launches upon the WinPE first loading up, so you can just put whatever commands you want to in that file....

Re: Run Command After PENetwork in Win10PE SE
« Reply #6 on: July 11, 2017, 01:35:01 AM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 7052
TheOven_Startup_CD.cmd in the root of whatever media you built and in the root of the directory containing the build files.

Use TheOven_Startup.cmd in the root of whatever media

When you add
TheOven_Startup.cmd
file to one of your drive (most popular usb drive)


Use TheOven_Startup_CD.cmd in the root of CD
Plugin Adds 'TheOven_Startup_CD.cmd' to your CD (ISO)

This way in some future
 you can update your ISO quickly
  without ReBuilding project.



See topics :
Portable Finder Startup - http://theoven.org/index.php?topic=1891
Portable Finder Startup CD - http://theoven.org/index.php?topic=1900

:turtle:

 

Powered by EzPortal