Jump to content











Photo
- - - - -

[Win7PE_SE] Adding a VBScript to startup using AddPostConfig

vbscript start run addpostconfig

  • Please log in to reply
9 replies to this topic

#1 Aeolis

Aeolis

    Frequent Member

  • .script developer
  • 145 posts
  • Location:Rio de Janeiro
  • Interests:I am just trying to learn and help.
  •  
    Brazil

Posted 24 December 2011 - 07:04 PM

Hello folks,

I have a small VBScript to start and check a service that I would like to run at startup. I have used the AddPostConfig command to add it to the startup. In my Win7PE.cfg file I see:

[postconfig]
hidenowait|Start MyService|%SystemRoot%System32Start_MyService.vbs


Inside the VBScript I have added a echo line to show it started working, but it never shows up. I think the VBScript is not even been run.

Any ideas? Was it supposed to work?

Best regards,

Aeolis

Edited by Aeolis, 24 December 2011 - 07:05 PM.


#2 homes32

homes32

    Gold Member

  • .script developer
  • 1035 posts
  • Location:Minnesota
  •  
    United States

Posted 24 December 2011 - 09:39 PM

try this instead

AddPostConfig,"Start MyService",%SystemRoot%\System32\wscript.exe,%SystemRoot%\System32\Start_MyService.vbs


regards,
Homes32

#3 Aeolis

Aeolis

    Frequent Member

  • .script developer
  • 145 posts
  • Location:Rio de Janeiro
  • Interests:I am just trying to learn and help.
  •  
    Brazil

Posted 25 December 2011 - 12:02 PM

Hello folks,

Thank you homes32. But it did not work. The VBScript did not run at all. Any ideas?

Best regards,

Aeolis

#4 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 25 December 2011 - 01:41 PM

Try

AddPostConfig,"Start MyService",wscript.exe,Start_MyService.vbs

Maybe the PostConfig process has troubles with %systemroot%.
%SystemRoot%System32 is always in the path, so not necessarily to mention.

Peter

#5 Aeolis

Aeolis

    Frequent Member

  • .script developer
  • 145 posts
  • Location:Rio de Janeiro
  • Interests:I am just trying to learn and help.
  •  
    Brazil

Posted 25 December 2011 - 02:02 PM

Hello folks,

I am directly editing the Win7PE.cfg file via the "Mount script" under Utilities. That is hat I have by now written in that file:

[postconfig]
nowait|Start
MyService|%SystemRoot%System32wscript.exe %SystemRoot%System32Start_MyService.vbs

I don't think the problem is the relative path. I have several other entries written that way (with relative paths) and they work very well. Maybe VBScripts can't be run that way. If I run the script manually after the boot process end it runs ok. Any ideas?

Best regards,

Aeolis

#6 amalux

amalux

    Platinum Member

  • Tutorial Writer
  • 2813 posts
  •  
    United States

Posted 25 December 2011 - 07:32 PM

Maybe VBScripts can't be run that way. If I run the script manually after the boot process end it runs ok. Any ideas?

With AddAutoRun, you can launch vbs or js pre-shell via (hidden) batch e.g.
AddAutoRun,test,"%PE_Programs%%ProgramFolder%test.cmd",,3

I don't know if this works with AddPostConfig.

#7 ChrisR

ChrisR

    Silver Member

  • .script developer
  • 784 posts
  •  
    France

Posted 26 December 2011 - 11:05 PM

With AddAutoRun, you can launch vbs or js pre-shell via (hidden) batch e.g.

AddAutoRun,test,"%PE_Programs%%ProgramFolder%test.cmd",,3

I don't know if this works with AddPostConfig.

I guess it also works, the autorun or postconfig sections are the same, just the order with the section autorun executed before postconfig.

To avoid going through a batch for this, I made a change in shortcuts.exe to execute directly js, vbs and now also wsf files for both sections.
I am waiting the green light from JFX, the author of shortcuts.exe before publishing on the server.
Here with "hello world" example http://www.mediafire...48vu02bn8z99ull

To use with for example
AddPostConfig,"Hello World",wscript.exe,%SystemRoot%System32HelloWorld.vbs,[StartMode]


or better, directly
AddPostConfig,"Hello World",%SystemRoot%System32HelloWorld.vbs,[StartMode]

AddPostConfig,"Hello World","%SystemDrive%Program FilesHelloWorld.vbs",[StartMode]



[postconfig]

nowait|Hello World|%SystemDrive%Program FilesHelloWorld.vbs

:cheers:

#8 amalux

amalux

    Platinum Member

  • Tutorial Writer
  • 2813 posts
  •  
    United States

Posted 27 December 2011 - 12:05 AM

To avoid going through a batch for this, I made a change in shortcuts.exe to execute directly js, vbs and now also wsf files...

Great, thanks! :thumbup:

#9 Aeolis

Aeolis

    Frequent Member

  • .script developer
  • 145 posts
  • Location:Rio de Janeiro
  • Interests:I am just trying to learn and help.
  •  
    Brazil

Posted 27 December 2011 - 10:23 PM

Hello folks,

Thank you all! Reboot.pro community is awesome!

Best regards,

Aeolis

#10 ChrisR

ChrisR

    Silver Member

  • .script developer
  • 784 posts
  •  
    France

Posted 28 December 2011 - 09:37 AM

2-Config.script with shortcuts.exe improvement is now available on the server http://w7pese.cwcodes.net/

Thank you for pointing out the issue ;)

:cheers:





Also tagged with one or more of these keywords: vbscript, start, run, addpostconfig

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users