Hi,
I have a vbscript set to run from HKLM\RunOnce the first time the machine
boots (after applying an image and sysprepping). The script's purpose is to
kick off a few silent installers based on the model of computer it is running
on. It doesn't seem to work. I don't get any errors either. When I run the
script manually it works as expected. The script also works if I set the
runonce key again and reboot. Can someone tell me what I may be doing wrong?

Re: vbscript runonce key by Pegasus

Pegasus
Mon Mar 03 12:56:12 CST 2008


"Mecha77" <Mecha77@discussions.microsoft.com> wrote in message
news:AC4F8EC8-75AF-4BAD-92BE-130EF3448F1F@microsoft.com...
> Hi,
> I have a vbscript set to run from HKLM\RunOnce the first time the machine
> boots (after applying an image and sysprepping). The script's purpose is
> to
> kick off a few silent installers based on the model of computer it is
> running
> on. It doesn't seem to work. I don't get any errors either. When I run the
> script manually it works as expected. The script also works if I set the
> runonce key again and reboot. Can someone tell me what I may be doing
> wrong?

Hard to say - you need to post your script.



Re: vbscript runonce key by Mecha77

Mecha77
Mon Mar 03 13:25:01 CST 2008

Ok here is the script...

Dim objWMI : Set objWMI = GetObject("winmgmts:")
Dim colSettingsComp : Set colSettings = objWMI.ExecQuery("Select * from
Win32_ComputerSystem")
Dim objComputer, strModel, strMfg, WshShell, oExec, strCommand



For Each objComputer in colSettings

strMfg = trim(objComputer.Manufacturer)
If strMfg ="Dell Inc." Then
'If objComputer.Manufacturer ="Dell Inc." Then
strModel = objComputer.Model
end if
Next

strModel = trim(strModel)

If strModel = "OptiPlex GX620" Then

Wscript.Echo "This is a model 620"


Elseif strModel = "OptiPlex 745" Then

Wscript.Echo "This is a model 745"

'******** Install HD Audio for GX 745
Set WshShell = CreateObject("Wscript.Shell")
strCommand = "C:\drivers\gx_745\HD_AUDIO\i386\setup.exe /s setup.iss"
Call Install(WshShell,strCommand)


Elseif strModel = "OptiPlex 755" Then

Wscript.Echo "This is a model 755"


'******** Install AMT_SOL (Serial Port Driver in Device Manager)
Set WshShell = CreateObject("Wscript.Shell")
strCommand = "C:\drivers\gx_755\amt_sol\setup.exe -S"
Call Install(WshShell,strCommand)

'******** Install AMT_HECI
Set WshShell = CreateObject("Wscript.Shell")
strCommand = "C:\drivers\gx_755\amt_HECI\setup.exe -S"
Call Install(WshShell,strCommand)

'******** Install HD Audio for GX 755
Set WshShell = CreateObject("Wscript.Shell")
strCommand = "C:\drivers\gx_755\HD_AUDIO\i386\setup.exe /s
setup.iss"
Call Install(WshShell,strCommand)


Else

wscript.echo "Model not found"
wscript.quit

End If



function Install(WshShell,strCommand)

Set oExec = WshShell.Exec(strCommand)

Do While oExec.Status = 0

Wscript.Sleep 100

Loop


end function







"Pegasus (MVP)" wrote:

>
> "Mecha77" <Mecha77@discussions.microsoft.com> wrote in message
> news:AC4F8EC8-75AF-4BAD-92BE-130EF3448F1F@microsoft.com...
> > Hi,
> > I have a vbscript set to run from HKLM\RunOnce the first time the machine
> > boots (after applying an image and sysprepping). The script's purpose is
> > to
> > kick off a few silent installers based on the model of computer it is
> > running
> > on. It doesn't seem to work. I don't get any errors either. When I run the
> > script manually it works as expected. The script also works if I set the
> > runonce key again and reboot. Can someone tell me what I may be doing
> > wrong?
>
> Hard to say - you need to post your script.
>
>
>

Re: vbscript runonce key by Pegasus

Pegasus
Mon Mar 03 14:28:06 CST 2008

Sorry, I can't tell without running it myself, which is obviously
not possible. I would do this:
- Instead of invoking the script directly, I would invoke it via
a batch file like so:
@echo off
echo %date% %time% > c:\test.log
cscript //nologo c:\MyScript.vbs >> c:\test.log
- I would then place a number of strategically placed
statements throughout the code:
wscript.echo "Line 55" (for example)

After the script has failed, c:\test.log will tell you quickly
what's going on.

"Mecha77" <Mecha77@discussions.microsoft.com> wrote in message
news:8194DC5F-EB87-4BA9-A3E3-39E66160CF80@microsoft.com...
> Ok here is the script...
>
> Dim objWMI : Set objWMI = GetObject("winmgmts:")
> Dim colSettingsComp : Set colSettings = objWMI.ExecQuery("Select * from
> Win32_ComputerSystem")
> Dim objComputer, strModel, strMfg, WshShell, oExec, strCommand
>
>
>
> For Each objComputer in colSettings
>
> strMfg = trim(objComputer.Manufacturer)
> If strMfg ="Dell Inc." Then
> 'If objComputer.Manufacturer ="Dell Inc." Then
> strModel = objComputer.Model
> end if
> Next
>
> strModel = trim(strModel)
>
> If strModel = "OptiPlex GX620" Then
>
> Wscript.Echo "This is a model 620"
>
>
> Elseif strModel = "OptiPlex 745" Then
>
> Wscript.Echo "This is a model 745"
>
> '******** Install HD Audio for GX 745
> Set WshShell = CreateObject("Wscript.Shell")
> strCommand = "C:\drivers\gx_745\HD_AUDIO\i386\setup.exe /s
> setup.iss"
> Call Install(WshShell,strCommand)
>
>
> Elseif strModel = "OptiPlex 755" Then
>
> Wscript.Echo "This is a model 755"
>
>
> '******** Install AMT_SOL (Serial Port Driver in Device Manager)
> Set WshShell = CreateObject("Wscript.Shell")
> strCommand = "C:\drivers\gx_755\amt_sol\setup.exe -S"
> Call Install(WshShell,strCommand)
>
> '******** Install AMT_HECI
> Set WshShell = CreateObject("Wscript.Shell")
> strCommand = "C:\drivers\gx_755\amt_HECI\setup.exe -S"
> Call Install(WshShell,strCommand)
>
> '******** Install HD Audio for GX 755
> Set WshShell = CreateObject("Wscript.Shell")
> strCommand = "C:\drivers\gx_755\HD_AUDIO\i386\setup.exe /s
> setup.iss"
> Call Install(WshShell,strCommand)
>
>
> Else
>
> wscript.echo "Model not found"
> wscript.quit
>
> End If
>
>
>
> function Install(WshShell,strCommand)
>
> Set oExec = WshShell.Exec(strCommand)
>
> Do While oExec.Status = 0
>
> Wscript.Sleep 100
>
> Loop
>
>
> end function
>
>
>
>
>
>
>
> "Pegasus (MVP)" wrote:
>
>>
>> "Mecha77" <Mecha77@discussions.microsoft.com> wrote in message
>> news:AC4F8EC8-75AF-4BAD-92BE-130EF3448F1F@microsoft.com...
>> > Hi,
>> > I have a vbscript set to run from HKLM\RunOnce the first time the
>> > machine
>> > boots (after applying an image and sysprepping). The script's purpose
>> > is
>> > to
>> > kick off a few silent installers based on the model of computer it is
>> > running
>> > on. It doesn't seem to work. I don't get any errors either. When I run
>> > the
>> > script manually it works as expected. The script also works if I set
>> > the
>> > runonce key again and reboot. Can someone tell me what I may be doing
>> > wrong?
>>
>> Hard to say - you need to post your script.
>>
>>
>>



Re: vbscript runonce key by Mecha77

Mecha77
Tue Mar 04 10:44:01 CST 2008

I called it from a batch file..The only thing that outputs is the date and
nothing else. This only happens after the first boot only ..If I reset the
runonce key again to run the batch file and reboot the script runs all the
way through as expected...I don't understand.

"Pegasus (MVP)" wrote:

> Sorry, I can't tell without running it myself, which is obviously
> not possible. I would do this:
> - Instead of invoking the script directly, I would invoke it via
> a batch file like so:
> @echo off
> echo %date% %time% > c:\test.log
> cscript //nologo c:\MyScript.vbs >> c:\test.log
> - I would then place a number of strategically placed
> statements throughout the code:
> wscript.echo "Line 55" (for example)
>
> After the script has failed, c:\test.log will tell you quickly
> what's going on.
>
> "Mecha77" <Mecha77@discussions.microsoft.com> wrote in message
> news:8194DC5F-EB87-4BA9-A3E3-39E66160CF80@microsoft.com...
> > Ok here is the script...
> >
> > Dim objWMI : Set objWMI = GetObject("winmgmts:")
> > Dim colSettingsComp : Set colSettings = objWMI.ExecQuery("Select * from
> > Win32_ComputerSystem")
> > Dim objComputer, strModel, strMfg, WshShell, oExec, strCommand
> >
> >
> >
> > For Each objComputer in colSettings
> >
> > strMfg = trim(objComputer.Manufacturer)
> > If strMfg ="Dell Inc." Then
> > 'If objComputer.Manufacturer ="Dell Inc." Then
> > strModel = objComputer.Model
> > end if
> > Next
> >
> > strModel = trim(strModel)
> >
> > If strModel = "OptiPlex GX620" Then
> >
> > Wscript.Echo "This is a model 620"
> >
> >
> > Elseif strModel = "OptiPlex 745" Then
> >
> > Wscript.Echo "This is a model 745"
> >
> > '******** Install HD Audio for GX 745
> > Set WshShell = CreateObject("Wscript.Shell")
> > strCommand = "C:\drivers\gx_745\HD_AUDIO\i386\setup.exe /s
> > setup.iss"
> > Call Install(WshShell,strCommand)
> >
> >
> > Elseif strModel = "OptiPlex 755" Then
> >
> > Wscript.Echo "This is a model 755"
> >
> >
> > '******** Install AMT_SOL (Serial Port Driver in Device Manager)
> > Set WshShell = CreateObject("Wscript.Shell")
> > strCommand = "C:\drivers\gx_755\amt_sol\setup.exe -S"
> > Call Install(WshShell,strCommand)
> >
> > '******** Install AMT_HECI
> > Set WshShell = CreateObject("Wscript.Shell")
> > strCommand = "C:\drivers\gx_755\amt_HECI\setup.exe -S"
> > Call Install(WshShell,strCommand)
> >
> > '******** Install HD Audio for GX 755
> > Set WshShell = CreateObject("Wscript.Shell")
> > strCommand = "C:\drivers\gx_755\HD_AUDIO\i386\setup.exe /s
> > setup.iss"
> > Call Install(WshShell,strCommand)
> >
> >
> > Else
> >
> > wscript.echo "Model not found"
> > wscript.quit
> >
> > End If
> >
> >
> >
> > function Install(WshShell,strCommand)
> >
> > Set oExec = WshShell.Exec(strCommand)
> >
> > Do While oExec.Status = 0
> >
> > Wscript.Sleep 100
> >
> > Loop
> >
> >
> > end function
> >
> >
> >
> >
> >
> >
> >
> > "Pegasus (MVP)" wrote:
> >
> >>
> >> "Mecha77" <Mecha77@discussions.microsoft.com> wrote in message
> >> news:AC4F8EC8-75AF-4BAD-92BE-130EF3448F1F@microsoft.com...
> >> > Hi,
> >> > I have a vbscript set to run from HKLM\RunOnce the first time the
> >> > machine
> >> > boots (after applying an image and sysprepping). The script's purpose
> >> > is
> >> > to
> >> > kick off a few silent installers based on the model of computer it is
> >> > running
> >> > on. It doesn't seem to work. I don't get any errors either. When I run
> >> > the
> >> > script manually it works as expected. The script also works if I set
> >> > the
> >> > runonce key again and reboot. Can someone tell me what I may be doing
> >> > wrong?
> >>
> >> Hard to say - you need to post your script.
> >>
> >>
> >>
>
>
>

Re: vbscript runonce key by mayayana

mayayana
Tue Mar 04 13:24:43 CST 2008

The batch file shouldn't make any difference.
Either way you're runnung a script. This may not
be very helpful, but it's hard for me to see how
you could not be doing *something* different
between the runs, since you seem to have narrowed
it down to an issue of the script itself never being
run on first run.

> I called it from a batch file..The only thing that outputs is the date and
> nothing else. This only happens after the first boot only ..If I reset the
> runonce key again to run the batch file and reboot the script runs all the
> way through as expected...I don't understand.
>
> "Pegasus (MVP)" wrote:
>
> > Sorry, I can't tell without running it myself, which is obviously
> > not possible. I would do this:
> > - Instead of invoking the script directly, I would invoke it via
> > a batch file like so:
> > @echo off
> > echo %date% %time% > c:\test.log
> > cscript file://nologo c:\MyScript.vbs >> c:\test.log
> > - I would then place a number of strategically placed
> > statements throughout the code:
> > wscript.echo "Line 55" (for example)
> >
> > After the script has failed, c:\test.log will tell you quickly
> > what's going on.
> >
> > "Mecha77" <Mecha77@discussions.microsoft.com> wrote in message
> > news:8194DC5F-EB87-4BA9-A3E3-39E66160CF80@microsoft.com...
> > > Ok here is the script...
> > >
> > > Dim objWMI : Set objWMI = GetObject("winmgmts:")
> > > Dim colSettingsComp : Set colSettings = objWMI.ExecQuery("Select *
from
> > > Win32_ComputerSystem")
> > > Dim objComputer, strModel, strMfg, WshShell, oExec, strCommand
> > >
> > >
> > >
> > > For Each objComputer in colSettings
> > >
> > > strMfg = trim(objComputer.Manufacturer)
> > > If strMfg ="Dell Inc." Then
> > > 'If objComputer.Manufacturer ="Dell Inc." Then
> > > strModel = objComputer.Model
> > > end if
> > > Next
> > >
> > > strModel = trim(strModel)
> > >
> > > If strModel = "OptiPlex GX620" Then
> > >
> > > Wscript.Echo "This is a model 620"
> > >
> > >
> > > Elseif strModel = "OptiPlex 745" Then
> > >
> > > Wscript.Echo "This is a model 745"
> > >
> > > '******** Install HD Audio for GX 745
> > > Set WshShell = CreateObject("Wscript.Shell")
> > > strCommand = "C:\drivers\gx_745\HD_AUDIO\i386\setup.exe /s
> > > setup.iss"
> > > Call Install(WshShell,strCommand)
> > >
> > >
> > > Elseif strModel = "OptiPlex 755" Then
> > >
> > > Wscript.Echo "This is a model 755"
> > >
> > >
> > > '******** Install AMT_SOL (Serial Port Driver in Device Manager)
> > > Set WshShell = CreateObject("Wscript.Shell")
> > > strCommand = "C:\drivers\gx_755\amt_sol\setup.exe -S"
> > > Call Install(WshShell,strCommand)
> > >
> > > '******** Install AMT_HECI
> > > Set WshShell = CreateObject("Wscript.Shell")
> > > strCommand = "C:\drivers\gx_755\amt_HECI\setup.exe -S"
> > > Call Install(WshShell,strCommand)
> > >
> > > '******** Install HD Audio for GX 755
> > > Set WshShell = CreateObject("Wscript.Shell")
> > > strCommand = "C:\drivers\gx_755\HD_AUDIO\i386\setup.exe /s
> > > setup.iss"
> > > Call Install(WshShell,strCommand)
> > >
> > >
> > > Else
> > >
> > > wscript.echo "Model not found"
> > > wscript.quit
> > >
> > > End If
> > >
> > >
> > >
> > > function Install(WshShell,strCommand)
> > >
> > > Set oExec = WshShell.Exec(strCommand)
> > >
> > > Do While oExec.Status = 0
> > >
> > > Wscript.Sleep 100
> > >
> > > Loop
> > >
> > >
> > > end function
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > "Pegasus (MVP)" wrote:
> > >
> > >>
> > >> "Mecha77" <Mecha77@discussions.microsoft.com> wrote in message
> > >> news:AC4F8EC8-75AF-4BAD-92BE-130EF3448F1F@microsoft.com...
> > >> > Hi,
> > >> > I have a vbscript set to run from HKLM\RunOnce the first time the
> > >> > machine
> > >> > boots (after applying an image and sysprepping). The script's
purpose
> > >> > is
> > >> > to
> > >> > kick off a few silent installers based on the model of computer it
is
> > >> > running
> > >> > on. It doesn't seem to work. I don't get any errors either. When I
run
> > >> > the
> > >> > script manually it works as expected. The script also works if I
set
> > >> > the
> > >> > runonce key again and reboot. Can someone tell me what I may be
doing
> > >> > wrong?
> > >>
> > >> Hard to say - you need to post your script.
> > >>
> > >>
> > >>
> >
> >
> >



RE: vbscript runonce key by CoreyThomasMCSEMCSAMCDBA

CoreyThomasMCSEMCSAMCDBA
Fri Mar 07 16:46:00 CST 2008

The problem is the sysprep. Instead of putting the script in HKLM\RunOnce,
put it under C:\Windows\Temp\bootini.cmd.

This is a batch file created by SysPrep and is only ran once after the first
boot up. I use this to set some logging and kick off an automated script to
rename a machine, join the domain, install software, etc.

-Corey Thomas
MCSE/MCSA/MCDBA


"Mecha77" wrote:

> Hi,
> I have a vbscript set to run from HKLM\RunOnce the first time the machine
> boots (after applying an image and sysprepping). The script's purpose is to
> kick off a few silent installers based on the model of computer it is running
> on. It doesn't seem to work. I don't get any errors either. When I run the
> script manually it works as expected. The script also works if I set the
> runonce key again and reboot. Can someone tell me what I may be doing wrong?