Jump to content

Can A Sript Be Run From Runonceex


Recommended Posts

Hi everyone this is probably a simple question and obvious

but here goes

can i run a vb script from a runonceex.cmd

I have tried this to perform a drive mapping

but it does not work

I can use the script after in std os mode

i have placed the drive map script after everything except norton internet security 2005

here is my runonceex.cmd

cmdow @ /HID
@Echo Off

SET PP=%SystemDrive%\Install\

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY% /V TITLE /D "Installing Programs" /f

'Note The Words All Pcs Means this installation should be made on all pcs


'All Asus P5ad2 Motherboard Pcs
'Installs The Chipset drivers this needs a reboot hence the -b switch(must be installed before any other drivers
REG ADD %KEY%\001 /VE /D "Intel Chipset Software Installation" /f
REG ADD %KEY%\001 /V 1 /D "%PP%Intelchipset\INFINST_AUTOL.EXE -A -b -s " /f
'this allows the previous program to finish any odd bits before loading the network drivers
'REG ADD %KEY%\002 /VE /D "Running A Sleep Program for 30 seconds " /f
'REG ADD %KEY%\002 /V 1 /D "%PP%sleep\sleep.EXE 30 " /f

REG ADD %KEY%\010 /VE /D "Marvel Yukon network Card Driver Installation" /f
REG ADD %KEY%\010 /V 1 /D "%PP%YukonNetworkDrivers\SetupYukonWin.exe /S /V\"/LIME %WINDIR%\YukonInstall.log REBOOT=ReallySuppress /qn"\"/f

'All Asus P5ad2 Motherboard Pcs

'All pcs
REG ADD %KEY%\020 /VE /D "Microsoft.Net Framework V2" /f
REG ADD %KEY%\020 /V 1 /D "%PP%MicrosoftNet2\dotnetfx.exe /q:a /c:\"install /q"\" /f

'All Asus P5ad2 Motherboard Pcs
REG ADD %KEY%\035 /VE /D "Cmi 9880 high definition audio package" /f
REG ADD %KEY%\035 /V 1 /D "%PP%CMIaudio\setup.exe /S" /f

REG ADD %KEY%\040 /VE /D "Catalyst Control centre & all Drivers" /f
REG ADD %KEY%\040 /V 1 /D "%PP%Ati\6-2_xp-2k_dd_ccc_wdm_enu_30152\setup.exe /s /w:wait " /f

REG ADD %KEY%\050 /VE /D "Windows Media Player Installation" /f
REG ADD %KEY%\050 /V 1 /D "%PP%WindowsMediaPlayer10\mpsetupedp.msi /qb" /f

REG ADD %KEY%\060 /VE /D "Nero burning v6" /f
REG ADD %KEY%\060 /V 1 /D "%PP%Applications\Nero\Nero-6.6.0.18_no_yt.exe /silent /noreboot /no_ui /sn=****-****-****-****-****-**** /write_sn" /f

'All Pcs
REG ADD %KEY%\070 /VE /D "Microsoft office xp pro" /f
REG ADD %KEY%\070 /V 1 /D "%PP%Applications\OfficeXP\SETUP.EXE " /f

REG ADD %KEY%\080 /VE /D "Adobe Reader 7.07 Installation" /f
REG ADD %KEY%\080 /V 1 /D "%PP%AdobeReader7\reader707.exe " /f

REG ADD %KEY%\090 /VE /D "Active Sync 4.1" /f
REG ADD %KEY%\090 /V 1 /D "%PP%ActiveSync41\setup.exe /S /v\"/qn INSTALLDIR=c:\MySyncDirectory"\" /f

REG ADD %KEY%\100 /VE /D "Map Drive z shop folder" /f
REG ADD %KEY%\100 /V 1 /D "%PP%MapZDrive.vbs " /f

REG ADD %KEY%\105 /VE /D "Running A Sleep Program for 30 seconds " /f
REG ADD %KEY%\105 /V 1 /D "%PP%sleep\sleep.EXE 60 " /f

'try this for norton internet security
REG ADD %KEY%\110 /VE /D "Norton Internet Security 2005" /f
REG ADD %KEY%\110 /V 1 /D "%PP%Norton\SYMSETUP.EXE /qn /norestart" /f

EXIT

and here is my script .vbs

Dim WSHNetwork
Set WSHNetwork = WScript.CreateObject("WScript.Network")

WSHNetwork.MapNetworkDrive "z:", "\\SHOPTILL\Shop Folder"

any ideas? thanks :D:D

Edited by gratz
Link to comment
Share on other sites


I use winrar to make a sfx file.

I have modified your VBS script so it will delete it self after it has ran.

Save As Gratz_MapDrive.vbs

Dim Act, Fso, WSHNetwork, VbsFile
Set WSHNetwork = WScript.CreateObject("WScript.Network")
Set Fso = CreateObject("Scripting.FileSystemObject")
Set Act = CreateObject("Wscript.Shell")
VbsFile = Act.ExpandEnvironmentStrings("%SystemDrive%\Gratz_MapDrive.vbs")
WSHNetwork.MapNetworkDrive "z:", "\\SHOPTILL\Shop Folder"
If Fso.FileExists(VbsFile) Then Fso.DeleteFile(VbsFile) End If

This is the SFX code

;The comment below contains SFX script commands

Path=.\%Systemdrive%\
Setup=Wscript.exe %Systemdrive%\Gratz_MapDrive.vbs
Silent=1
Overwrite=1

I have made this a SFX for you, I have not tested this, but in therory it should work.

To modify the script use Winrar

1:\ extract the file to your desktop

2:\ edit the VBS script

3:\ rename the Gratz_MapDrive.vbs in the SFX to Gratz_MapDrive_Old.vbs

4:\ add you edited Gratz_MapDrive.vbs

5:\ after you have added the edited Gratz_MapDrive.vbs then delete Gratz_MapDrive_Old.vbs

Edited by gunsmokingman
Link to comment
Share on other sites

I run tons of VBscript from RunOnceEx. Here is a little piece of my VBscript that I run from cmdlines.txt to set it up:

If fs.FileExists(OEM & "\060_VPN.vbs") Then
ws.RegWrite strKeyPath & "060\", "VPN software" , "REG_SZ"
ws.RegWrite strKeyPath & "060\1", OEM & "\060_VPN.vbs", "REG_SZ"
End If
If fs.FileExists(OEM & "\070_VMwareTools.vbs") Then
ws.RegWrite strKeyPath & "070\", "VMware Tools" , "REG_SZ"
ws.RegWrite strKeyPath & "070\1", OEM & "\070_VMwareTools.vbs", "REG_SZ"
End If

There's no need to make an SFX or compile it or anything. The only real limitation is with cmdlines.txt. From there you must specify cscript.exe.

Edited by RogueSpear
Link to comment
Share on other sites

I run my script from Cmdlines also but do not use Csript, I have them work from a hta. this gives me a interface to work with. I have a cmd file that start the hta that has my script in it. The SFX makes it act like a exe, then it clean up the vbs after it has ran. But RogueSpear is correct so that would also be another method.

Hta from 13 minute to reboot

Edited by gunsmokingman
Link to comment
Share on other sites

I run tons of VBscript from RunOnceEx. Here is a little piece of my VBscript that I run from cmdlines.txt to set it up:

Just a bit confused!

do I remove my entry from runonceex.cmd and then put this entry in cmdlines.txt

with my script instead?

Link to comment
Share on other sites

It depend on when you need it to run. For mapping drives I would assume you need it after the install is completed, so the RunOnceEx.cmd would be the best time. Use the SFX file that I posted as that will delete

the vbs file after it has ran.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...