Home All Groups Group Topic Archive Search About

Inventory script question

Author
27 Apr 2009 6:35 PM
Matthew Curiale
Hello all,

I'm just wondering if it's possible to run an inventory script through a
computer startup script, rather than through a login script.

The reason for this, is that I work in an educational institution, and
receiving thousands of audits per school per day would be a bit stressful on
our servers. A once-a-month computer startup call would be preferable.

Is this sort of thing possible?

TIA,

Matthew Curiale

Author
27 Apr 2009 7:37 PM
Pegasus [MVP]
Show quote Hide quote
"Matthew Curiale" <thisis***@realaddy.com> wrote in message
news:3DC17929-8CF8-4908-8099-98D7677B692E@microsoft.com...
> Hello all,
>
> I'm just wondering if it's possible to run an inventory script through a
> computer startup script, rather than through a login script.
>
> The reason for this, is that I work in an educational institution, and
> receiving thousands of audits per school per day would be a bit stressful
> on our servers. A once-a-month computer startup call would be preferable.
>
> Is this sort of thing possible?
>
> TIA,
>
> Matthew Curiale

Sure, invoke it via the Task Scheduler at boot time. Or even better:
Maintain a semaphore file and run the script whenever the semaphore file has
not been updated for 30 days or more.
Author
27 Apr 2009 11:11 PM
Richard Mueller [MVP]
Show quote Hide quote
"Matthew Curiale" <thisis***@realaddy.com> wrote in message
news:3DC17929-8CF8-4908-8099-98D7677B692E@microsoft.com...
> Hello all,
>
> I'm just wondering if it's possible to run an inventory script through a
> computer startup script, rather than through a login script.
>
> The reason for this, is that I work in an educational institution, and
> receiving thousands of audits per school per day would be a bit stressful
> on our servers. A once-a-month computer startup call would be preferable.
>
> Is this sort of thing possible?
>
> TIA,
>
> Matthew Curiale

You should also be able to run a script remotely that retrieves information
on the computer. You can periodically run a script that inventories all
computers remotely in bulk. The computers just need to be on and
authenticated to the domain. An example is linked here:

http://www.rlmueller.net/Inventory.htm

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
Author
28 Apr 2009 1:05 PM
Matthew Curiale
Thanks for the replies Richard and Pegasus.

As an aside, we have a program called "agent.exe" that already does the
polling of machines on the network... Our problem right now is where to
place the call to the program. If we have it run at login, imagine 10 logins
per computer, per day ... Thousands of computers across 40 buildings ... The
load on the server would be ridiculous.

The script is definitely something that we'll look at in the very near
future, but for the moment, would we be able to call the agent.exe program
through the same methods (ie: using a semaphore file, through computer
startup scripts, or even a top level GPO)?

TIA ... again!

Matthew Curiale


Show quoteHide quote
"Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
message news:u%23HB$14xJHA.1092@TK2MSFTNGP06.phx.gbl...
>
> "Matthew Curiale" <thisis***@realaddy.com> wrote in message
> news:3DC17929-8CF8-4908-8099-98D7677B692E@microsoft.com...
>> Hello all,
>>
>> I'm just wondering if it's possible to run an inventory script through a
>> computer startup script, rather than through a login script.
>>
>> The reason for this, is that I work in an educational institution, and
>> receiving thousands of audits per school per day would be a bit stressful
>> on our servers. A once-a-month computer startup call would be preferable.
>>
>> Is this sort of thing possible?
>>
>> TIA,
>>
>> Matthew Curiale
>
> You should also be able to run a script remotely that retrieves
> information on the computer. You can periodically run a script that
> inventories all computers remotely in bulk. The computers just need to be
> on and authenticated to the domain. An example is linked here:
>
> http://www.rlmueller.net/Inventory.htm
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
>
Author
28 Apr 2009 1:39 PM
Pegasus [MVP]
Show quote Hide quote
"Matthew Curiale" <thisis***@realaddy.com> wrote in message
news:4C7B92EE-E3C3-4F93-8583-3E799EDF0889@microsoft.com...
> Thanks for the replies Richard and Pegasus.
>
> As an aside, we have a program called "agent.exe" that already does the
> polling of machines on the network... Our problem right now is where to
> place the call to the program. If we have it run at login, imagine 10
> logins per computer, per day ... Thousands of computers across 40
> buildings ... The load on the server would be ridiculous.
>
> The script is definitely something that we'll look at in the very near
> future, but for the moment, would we be able to call the agent.exe program
> through the same methods (ie: using a semaphore file, through computer
> startup scripts, or even a top level GPO)?
>
> TIA ... again!
>
> Matthew Curiale

If you want the load spread over the days and the weeks then you probably
have to trigger each audit from the server itself. You would need to
maintain a database of computer names and dates last polled. A poll would be
initiated in one of two ways:
a) When the poll is due and if the machine is online, or
b) If the poll is overdue and when the machine logs on.
Author
28 Apr 2009 1:47 PM
Matthew Curiale
Show quote Hide quote
"Pegasus [MVP]" <n***@microsoft.com> wrote in message
news:uT%2360aAyJHA.1712@TK2MSFTNGP03.phx.gbl...
>
> "Matthew Curiale" <thisis***@realaddy.com> wrote in message
> news:4C7B92EE-E3C3-4F93-8583-3E799EDF0889@microsoft.com...
>> Thanks for the replies Richard and Pegasus.
>>
>> As an aside, we have a program called "agent.exe" that already does the
>> polling of machines on the network... Our problem right now is where to
>> place the call to the program. If we have it run at login, imagine 10
>> logins per computer, per day ... Thousands of computers across 40
>> buildings ... The load on the server would be ridiculous.
>>
>> The script is definitely something that we'll look at in the very near
>> future, but for the moment, would we be able to call the agent.exe
>> program through the same methods (ie: using a semaphore file, through
>> computer startup scripts, or even a top level GPO)?
>>
>> TIA ... again!
>>
>> Matthew Curiale
>
> If you want the load spread over the days and the weeks then you probably
> have to trigger each audit from the server itself. You would need to
> maintain a database of computer names and dates last polled. A poll would
> be initiated in one of two ways:
> a) When the poll is due and if the machine is online, or
> b) If the poll is overdue and when the machine logs on.

We do have a database that's been started, though I'm not sure if the last
date polled is in there; I'd have to go check. The program resides on a
seperate server from the DC.

This polling can be scripted into the logon script of the machines
themselves, then? And possibly with a time field that checks "if last logon
> 30 days, execute agent.exe" ?

Matthew Curiale
Author
28 Apr 2009 2:05 PM
Pegasus [MVP]
Show quote Hide quote
"Matthew Curiale" <thisis***@realaddy.com> wrote in message
news:7D2880AC-FE50-40DC-A2D9-7D7DDAC72797@microsoft.com...
>
> "Pegasus [MVP]" <n***@microsoft.com> wrote in message
> news:uT%2360aAyJHA.1712@TK2MSFTNGP03.phx.gbl...
>>
>> "Matthew Curiale" <thisis***@realaddy.com> wrote in message
>> news:4C7B92EE-E3C3-4F93-8583-3E799EDF0889@microsoft.com...
>>> Thanks for the replies Richard and Pegasus.
>>>
>>> As an aside, we have a program called "agent.exe" that already does the
>>> polling of machines on the network... Our problem right now is where to
>>> place the call to the program. If we have it run at login, imagine 10
>>> logins per computer, per day ... Thousands of computers across 40
>>> buildings ... The load on the server would be ridiculous.
>>>
>>> The script is definitely something that we'll look at in the very near
>>> future, but for the moment, would we be able to call the agent.exe
>>> program through the same methods (ie: using a semaphore file, through
>>> computer startup scripts, or even a top level GPO)?
>>>
>>> TIA ... again!
>>>
>>> Matthew Curiale
>>
>> If you want the load spread over the days and the weeks then you probably
>> have to trigger each audit from the server itself. You would need to
>> maintain a database of computer names and dates last polled. A poll would
>> be initiated in one of two ways:
>> a) When the poll is due and if the machine is online, or
>> b) If the poll is overdue and when the machine logs on.
>
> We do have a database that's been started, though I'm not sure if the last
> date polled is in there; I'd have to go check. The program resides on a
> seperate server from the DC.
>
> This polling can be scripted into the logon script of the machines
> themselves, then? And possibly with a time field that checks "if last
> logon
> > 30 days, execute agent.exe" ?
>
> Matthew Curiale
>

If you script the polling into the logon script then you get a whopper of a
load every morning when people report for work, which is exactly what you
said you wanted to avoid.
Author
28 Apr 2009 5:28 PM
Richard Mueller [MVP]
Show quote Hide quote
"Pegasus [MVP]" <n***@microsoft.com> wrote in message
news:OhbtPpAyJHA.3968@TK2MSFTNGP06.phx.gbl...
>
> "Matthew Curiale" <thisis***@realaddy.com> wrote in message
> news:7D2880AC-FE50-40DC-A2D9-7D7DDAC72797@microsoft.com...
>>
>> "Pegasus [MVP]" <n***@microsoft.com> wrote in message
>> news:uT%2360aAyJHA.1712@TK2MSFTNGP03.phx.gbl...
>>>
>>> "Matthew Curiale" <thisis***@realaddy.com> wrote in message
>>> news:4C7B92EE-E3C3-4F93-8583-3E799EDF0889@microsoft.com...
>>>> Thanks for the replies Richard and Pegasus.
>>>>
>>>> As an aside, we have a program called "agent.exe" that already does the
>>>> polling of machines on the network... Our problem right now is where to
>>>> place the call to the program. If we have it run at login, imagine 10
>>>> logins per computer, per day ... Thousands of computers across 40
>>>> buildings ... The load on the server would be ridiculous.
>>>>
>>>> The script is definitely something that we'll look at in the very near
>>>> future, but for the moment, would we be able to call the agent.exe
>>>> program through the same methods (ie: using a semaphore file, through
>>>> computer startup scripts, or even a top level GPO)?
>>>>
>>>> TIA ... again!
>>>>
>>>> Matthew Curiale
>>>
>>> If you want the load spread over the days and the weeks then you
>>> probably have to trigger each audit from the server itself. You would
>>> need to maintain a database of computer names and dates last polled. A
>>> poll would be initiated in one of two ways:
>>> a) When the poll is due and if the machine is online, or
>>> b) If the poll is overdue and when the machine logs on.
>>
>> We do have a database that's been started, though I'm not sure if the
>> last date polled is in there; I'd have to go check. The program resides
>> on a seperate server from the DC.
>>
>> This polling can be scripted into the logon script of the machines
>> themselves, then? And possibly with a time field that checks "if last
>> logon
>> > 30 days, execute agent.exe" ?
>>
>> Matthew Curiale
>>
>
> If you script the polling into the logon script then you get a whopper of
> a load every morning when people report for work, which is exactly what
> you said you wanted to avoid.
>

If you run an inventory script remotely to query all computers in bulk, it
can be run from a client. The script will take a long time to run and will
generate some network traffic, but it will not burden any servers. Also, it
provides a snapshot taken in a short time span. You know when the inventory
is complete, and you can run it on demand whenever you wish. The only
downside is that some clients may be offline at the time, but even that can
be noted in the inventory. The example script I posted pings each computer
before attempting to connect. You could devise a scheme to run the script
repeatedly, but only query computers missed before.

If you use logon or startup scripts instead, you want a mechanism to make
sure the inventory is done once per time period. That's the purpose of the
semaphore file referred to. The trick is where to store it. Best would be to
save it somewhere where you can easily delete all the files, to trigger a
new inventory (assuming you want to run it periodically). I used to use
files named after the client computer saved in a shared folder on the
network. When the logon or startup script starts, it retrieves the NetBIOS
name of the local computer, then checks for the existance of a file with
that name (and *.txt extension) in the shared folder. If the file exists,
the script quits. Otherwise the inventory runs, the information is saved
somewhere on the network, and the file is created in the shared folder to
prevent a repeat of the inventory.

Remember that logon scripts run with the credentials of the user. You could
give the group "Domain Users" read/write permissions in the shared folder
(and where ever the inventory data is to be saved). However, make sure users
have permissions to retrieve the information you are collecting. If you use
Startup scripts, they run with the credentials of the local computer, which
has System privileges on the local computer and the credentials of the
computer object elsewhere in the domain. You can give the group "Domain
Computers" read/write permission in the shared folder (and where ever the
inventory data is to be saved).

One downside of logon/startup scripts is collecting the information
retrieved, which might be in separate files, one for each computer. Also,
you have no control over when the inventory script runs on each computer.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
Author
12 May 2009 2:14 PM
Matthew Curiale
Well, I ended up writing a VERY simple script to call the program that
writes the inventory to the database (read: 3 lines of code or so).

We've put it into the test group, and applied it as a GPO... The problem now
is that, after starting up the machine itself, it doesn't query/write to the
database. If I run a rsop and gpresult on the test machine, it says that the
script has been applied ... Yet my inventory doesn't update. Conversely, if
I run the script "as is" on a machine, it updates the inventory just fine.

Is there a way to test the startup script to see if it actually runs? Like,
anything that I can put into the code to keep the console window open before
it gets to the login screen?

TIA, again :)

Matt

Show quoteHide quote
"Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
message news:uVoWTbCyJHA.3476@TK2MSFTNGP05.phx.gbl...
>
> "Pegasus [MVP]" <n***@microsoft.com> wrote in message
> news:OhbtPpAyJHA.3968@TK2MSFTNGP06.phx.gbl...
>>
>> "Matthew Curiale" <thisis***@realaddy.com> wrote in message
>> news:7D2880AC-FE50-40DC-A2D9-7D7DDAC72797@microsoft.com...
>>>
>>> "Pegasus [MVP]" <n***@microsoft.com> wrote in message
>>> news:uT%2360aAyJHA.1712@TK2MSFTNGP03.phx.gbl...
>>>>
>>>> "Matthew Curiale" <thisis***@realaddy.com> wrote in message
>>>> news:4C7B92EE-E3C3-4F93-8583-3E799EDF0889@microsoft.com...
>>>>> Thanks for the replies Richard and Pegasus.
>>>>>
>>>>> As an aside, we have a program called "agent.exe" that already does
>>>>> the polling of machines on the network... Our problem right now is
>>>>> where to place the call to the program. If we have it run at login,
>>>>> imagine 10 logins per computer, per day ... Thousands of computers
>>>>> across 40 buildings ... The load on the server would be ridiculous.
>>>>>
>>>>> The script is definitely something that we'll look at in the very near
>>>>> future, but for the moment, would we be able to call the agent.exe
>>>>> program through the same methods (ie: using a semaphore file, through
>>>>> computer startup scripts, or even a top level GPO)?
>>>>>
>>>>> TIA ... again!
>>>>>
>>>>> Matthew Curiale
>>>>
>>>> If you want the load spread over the days and the weeks then you
>>>> probably have to trigger each audit from the server itself. You would
>>>> need to maintain a database of computer names and dates last polled. A
>>>> poll would be initiated in one of two ways:
>>>> a) When the poll is due and if the machine is online, or
>>>> b) If the poll is overdue and when the machine logs on.
>>>
>>> We do have a database that's been started, though I'm not sure if the
>>> last date polled is in there; I'd have to go check. The program resides
>>> on a seperate server from the DC.
>>>
>>> This polling can be scripted into the logon script of the machines
>>> themselves, then? And possibly with a time field that checks "if last
>>> logon
>>> > 30 days, execute agent.exe" ?
>>>
>>> Matthew Curiale
>>>
>>
>> If you script the polling into the logon script then you get a whopper of
>> a load every morning when people report for work, which is exactly what
>> you said you wanted to avoid.
>>
>
> If you run an inventory script remotely to query all computers in bulk, it
> can be run from a client. The script will take a long time to run and will
> generate some network traffic, but it will not burden any servers. Also,
> it provides a snapshot taken in a short time span. You know when the
> inventory is complete, and you can run it on demand whenever you wish. The
> only downside is that some clients may be offline at the time, but even
> that can be noted in the inventory. The example script I posted pings each
> computer before attempting to connect. You could devise a scheme to run
> the script repeatedly, but only query computers missed before.
>
> If you use logon or startup scripts instead, you want a mechanism to make
> sure the inventory is done once per time period. That's the purpose of the
> semaphore file referred to. The trick is where to store it. Best would be
> to save it somewhere where you can easily delete all the files, to trigger
> a new inventory (assuming you want to run it periodically). I used to use
> files named after the client computer saved in a shared folder on the
> network. When the logon or startup script starts, it retrieves the NetBIOS
> name of the local computer, then checks for the existance of a file with
> that name (and *.txt extension) in the shared folder. If the file exists,
> the script quits. Otherwise the inventory runs, the information is saved
> somewhere on the network, and the file is created in the shared folder to
> prevent a repeat of the inventory.
>
> Remember that logon scripts run with the credentials of the user. You
> could give the group "Domain Users" read/write permissions in the shared
> folder (and where ever the inventory data is to be saved). However, make
> sure users have permissions to retrieve the information you are
> collecting. If you use Startup scripts, they run with the credentials of
> the local computer, which has System privileges on the local computer and
> the credentials of the computer object elsewhere in the domain. You can
> give the group "Domain Computers" read/write permission in the shared
> folder (and where ever the inventory data is to be saved).
>
> One downside of logon/startup scripts is collecting the information
> retrieved, which might be in separate files, one for each computer. Also,
> you have no control over when the inventory script runs on each computer.
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
>
Author
12 May 2009 2:49 PM
Pegasus [MVP]
Show quote Hide quote
"Matthew Curiale" <thisis***@realaddy.com> wrote in message
news:O2XFjvw0JHA.3988@TK2MSFTNGP05.phx.gbl...
> Well, I ended up writing a VERY simple script to call the program that
> writes the inventory to the database (read: 3 lines of code or so).
>
> We've put it into the test group, and applied it as a GPO... The problem
> now is that, after starting up the machine itself, it doesn't query/write
> to the database. If I run a rsop and gpresult on the test machine, it says
> that the script has been applied ... Yet my inventory doesn't update.
> Conversely, if I run the script "as is" on a machine, it updates the
> inventory just fine.
>
> Is there a way to test the startup script to see if it actually runs?
> Like, anything that I can put into the code to keep the console window
> open before it gets to the login screen?
>
> TIA, again :)
>
> Matt

If your script is a batch file then this line will do the trick:
echo %date% %time% %UserName% %ComputerName% >> c:\Invent.txt

If it is a VB Script file then a simple method is to invoke it like so:
cscript //nologo c:\Matt.vbs >> c:\Invent.txt
and include something like this in the script itself:
wscript.echo date & time

Alternatively you can use the WriteLine method of the File System Object to
write the same information into your log file.
Author
12 May 2009 3:15 PM
Matthew Curiale
Set objApp = CreateObject("WScript.Shell")
objApp.Run "cmd /C \\Server\Folder$\agent.exe"
Set objApp = Nothing

This is the code that's running... It's located in a test group in our
forest. The GPO is link enabled, but not enforced.

When the machine boots up, sits at the login screen for a few seconds, I get
a command window flash by very quickly. I've used the /K switch, also... but
that hasn't changed anything. It looks like there's an error message, but I
can't see it as it closes very fast.

The script doesn't reside on the local machines, though ... So is there any
way to put a method in the vbscript itself, to append/write to a log file
somewhere?

-Matt

Show quoteHide quote
"Pegasus [MVP]" <n***@microsoft.com> wrote in message
news:OM7ybDx0JHA.4756@TK2MSFTNGP05.phx.gbl...
>
> "Matthew Curiale" <thisis***@realaddy.com> wrote in message
> news:O2XFjvw0JHA.3988@TK2MSFTNGP05.phx.gbl...
>> Well, I ended up writing a VERY simple script to call the program that
>> writes the inventory to the database (read: 3 lines of code or so).
>>
>> We've put it into the test group, and applied it as a GPO... The problem
>> now is that, after starting up the machine itself, it doesn't query/write
>> to the database. If I run a rsop and gpresult on the test machine, it
>> says that the script has been applied ... Yet my inventory doesn't
>> update. Conversely, if I run the script "as is" on a machine, it updates
>> the inventory just fine.
>>
>> Is there a way to test the startup script to see if it actually runs?
>> Like, anything that I can put into the code to keep the console window
>> open before it gets to the login screen?
>>
>> TIA, again :)
>>
>> Matt
>
> If your script is a batch file then this line will do the trick:
> echo %date% %time% %UserName% %ComputerName% >> c:\Invent.txt
>
> If it is a VB Script file then a simple method is to invoke it like so:
> cscript //nologo c:\Matt.vbs >> c:\Invent.txt
> and include something like this in the script itself:
> wscript.echo date & time
>
> Alternatively you can use the WriteLine method of the File System Object
> to write the same information into your log file.
>
Author
12 May 2009 3:45 PM
Pegasus [MVP]
Show quote Hide quote
"Matthew Curiale" <thisis***@realaddy.com> wrote in message
news:%23m$ukRx0JHA.1092@TK2MSFTNGP06.phx.gbl...
> Set objApp = CreateObject("WScript.Shell")
> objApp.Run "cmd /C \\Server\Folder$\agent.exe"
> Set objApp = Nothing
>
> This is the code that's running... It's located in a test group in our
> forest. The GPO is link enabled, but not enforced.
>
> When the machine boots up, sits at the login screen for a few seconds, I
> get a command window flash by very quickly. I've used the /K switch,
> also... but that hasn't changed anything. It looks like there's an error
> message, but I can't see it as it closes very fast.
>
> The script doesn't reside on the local machines, though ... So is there
> any way to put a method in the vbscript itself, to append/write to a log
> file somewhere?
>
> -Matt

I gave you an answer before: Use the WriteLine method.

Note that the line
objApp.Run "cmd /C \\Server\Folder$\agent.exe"
will fail if there is an embedded space in "\\Server\Folder$\agent.exe".
Author
12 May 2009 3:54 PM
Matthew Curiale
I apologize, I didn't see that last line in the previous response.
*sheepish*

I'll take a look at modding the code a little bit, and no, there are no
spaces in the folder path. The only thing is that it's a bashed folder.

Thanks Pegasus, I'll be doing this very shortly, and I'll post back here if
I need any more help/if it worked :)

-Matt

Show quoteHide quote
"Pegasus [MVP]" <n***@microsoft.com> wrote in message
news:uOLAuix0JHA.1416@TK2MSFTNGP04.phx.gbl...
>
> "Matthew Curiale" <thisis***@realaddy.com> wrote in message
> news:%23m$ukRx0JHA.1092@TK2MSFTNGP06.phx.gbl...
>> Set objApp = CreateObject("WScript.Shell")
>> objApp.Run "cmd /C \\Server\Folder$\agent.exe"
>> Set objApp = Nothing
>>
>> This is the code that's running... It's located in a test group in our
>> forest. The GPO is link enabled, but not enforced.
>>
>> When the machine boots up, sits at the login screen for a few seconds, I
>> get a command window flash by very quickly. I've used the /K switch,
>> also... but that hasn't changed anything. It looks like there's an error
>> message, but I can't see it as it closes very fast.
>>
>> The script doesn't reside on the local machines, though ... So is there
>> any way to put a method in the vbscript itself, to append/write to a log
>> file somewhere?
>>
>> -Matt
>
> I gave you an answer before: Use the WriteLine method.
>
> Note that the line
> objApp.Run "cmd /C \\Server\Folder$\agent.exe"
> will fail if there is an embedded space in "\\Server\Folder$\agent.exe".
>
Author
12 May 2009 4:00 PM
Richard Mueller [MVP]
If the script runs as a startup script, then perhaps the computer object
lacks permissions in \\server\Folder$. You could grant permissions to the
group "Domain Computers" in the share, so that the computer can run the
program. Remember, there is no user (except the local system account) when
startup scripts run.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--

Show quoteHide quote
"Matthew Curiale" <thisis***@realaddy.com> wrote in message
news:%23m$ukRx0JHA.1092@TK2MSFTNGP06.phx.gbl...
> Set objApp = CreateObject("WScript.Shell")
> objApp.Run "cmd /C \\Server\Folder$\agent.exe"
> Set objApp = Nothing
>
> This is the code that's running... It's located in a test group in our
> forest. The GPO is link enabled, but not enforced.
>
> When the machine boots up, sits at the login screen for a few seconds, I
> get a command window flash by very quickly. I've used the /K switch,
> also... but that hasn't changed anything. It looks like there's an error
> message, but I can't see it as it closes very fast.
>
> The script doesn't reside on the local machines, though ... So is there
> any way to put a method in the vbscript itself, to append/write to a log
> file somewhere?
>
> -Matt
>
> "Pegasus [MVP]" <n***@microsoft.com> wrote in message
> news:OM7ybDx0JHA.4756@TK2MSFTNGP05.phx.gbl...
>>
>> "Matthew Curiale" <thisis***@realaddy.com> wrote in message
>> news:O2XFjvw0JHA.3988@TK2MSFTNGP05.phx.gbl...
>>> Well, I ended up writing a VERY simple script to call the program that
>>> writes the inventory to the database (read: 3 lines of code or so).
>>>
>>> We've put it into the test group, and applied it as a GPO... The problem
>>> now is that, after starting up the machine itself, it doesn't
>>> query/write to the database. If I run a rsop and gpresult on the test
>>> machine, it says that the script has been applied ... Yet my inventory
>>> doesn't update. Conversely, if I run the script "as is" on a machine, it
>>> updates the inventory just fine.
>>>
>>> Is there a way to test the startup script to see if it actually runs?
>>> Like, anything that I can put into the code to keep the console window
>>> open before it gets to the login screen?
>>>
>>> TIA, again :)
>>>
>>> Matt
>>
>> If your script is a batch file then this line will do the trick:
>> echo %date% %time% %UserName% %ComputerName% >> c:\Invent.txt
>>
>> If it is a VB Script file then a simple method is to invoke it like so:
>> cscript //nologo c:\Matt.vbs >> c:\Invent.txt
>> and include something like this in the script itself:
>> wscript.echo date & time
>>
>> Alternatively you can use the WriteLine method of the File System Object
>> to write the same information into your log file.
>>
>
Author
12 May 2009 6:16 PM
Matthew Curiale
Well, the script works, but command processor v. 5.1.2600 does not support
UNC pathing. It works, if we pull the workaround from the KB, being:

"add the value DisableUNCCheck REG_DWORD and set the value to 0 x 1 (Hex)."

The example is set under HKEY_Current_User, but we obviously want this to
happen on the machine. Is there a way, in the script, to write this DWORD to
the registry, set it to 1, have the agent run, set the DWORD back to 0, and
then continue?

This is pretty much the last hurdle, but I don't want disabling UNC checking
to mess with anything else that happens in the other scripts.

Thanks!

-Matt

Show quoteHide quote
"Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
message news:eVW%23Trx0JHA.1424@TK2MSFTNGP02.phx.gbl...
> If the script runs as a startup script, then perhaps the computer object
> lacks permissions in \\server\Folder$. You could grant permissions to the
> group "Domain Computers" in the share, so that the computer can run the
> program. Remember, there is no user (except the local system account) when
> startup scripts run.
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
> "Matthew Curiale" <thisis***@realaddy.com> wrote in message
> news:%23m$ukRx0JHA.1092@TK2MSFTNGP06.phx.gbl...
>> Set objApp = CreateObject("WScript.Shell")
>> objApp.Run "cmd /C \\Server\Folder$\agent.exe"
>> Set objApp = Nothing
>>
>> This is the code that's running... It's located in a test group in our
>> forest. The GPO is link enabled, but not enforced.
>>
>> When the machine boots up, sits at the login screen for a few seconds, I
>> get a command window flash by very quickly. I've used the /K switch,
>> also... but that hasn't changed anything. It looks like there's an error
>> message, but I can't see it as it closes very fast.
>>
>> The script doesn't reside on the local machines, though ... So is there
>> any way to put a method in the vbscript itself, to append/write to a log
>> file somewhere?
>>
>> -Matt
>>
>> "Pegasus [MVP]" <n***@microsoft.com> wrote in message
>> news:OM7ybDx0JHA.4756@TK2MSFTNGP05.phx.gbl...
>>>
>>> "Matthew Curiale" <thisis***@realaddy.com> wrote in message
>>> news:O2XFjvw0JHA.3988@TK2MSFTNGP05.phx.gbl...
>>>> Well, I ended up writing a VERY simple script to call the program that
>>>> writes the inventory to the database (read: 3 lines of code or so).
>>>>
>>>> We've put it into the test group, and applied it as a GPO... The
>>>> problem now is that, after starting up the machine itself, it doesn't
>>>> query/write to the database. If I run a rsop and gpresult on the test
>>>> machine, it says that the script has been applied ... Yet my inventory
>>>> doesn't update. Conversely, if I run the script "as is" on a machine,
>>>> it updates the inventory just fine.
>>>>
>>>> Is there a way to test the startup script to see if it actually runs?
>>>> Like, anything that I can put into the code to keep the console window
>>>> open before it gets to the login screen?
>>>>
>>>> TIA, again :)
>>>>
>>>> Matt
>>>
>>> If your script is a batch file then this line will do the trick:
>>> echo %date% %time% %UserName% %ComputerName% >> c:\Invent.txt
>>>
>>> If it is a VB Script file then a simple method is to invoke it like so:
>>> cscript //nologo c:\Matt.vbs >> c:\Invent.txt
>>> and include something like this in the script itself:
>>> wscript.echo date & time
>>>
>>> Alternatively you can use the WriteLine method of the File System Object
>>> to write the same information into your log file.
>>>
>>
>
>
Author
12 May 2009 10:36 PM
Richard Mueller [MVP]
Do you refer to kb 156276? I don't see reference to version 5.1.2600. I'm
not familiar with this problem. Would it make sense to map a drive to the
share? For example:

Set objNetwork = CreateObject("Wscript.Network")
objNetwork.MapNetworkDrive "S:", "\\server\Folder$"
Set objApp = CreateObject("WScript.Shell")
objApp.Run "%comspec% /C S:\agent.exe"
objNetwork.RemoveNetworkDrive "S:"

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
Show quoteHide quote
"Matthew Curiale" <thisis***@realaddy.com> wrote in message
news:uI9nE3y0JHA.140@TK2MSFTNGP03.phx.gbl...
> Well, the script works, but command processor v. 5.1.2600 does not support
> UNC pathing. It works, if we pull the workaround from the KB, being:
>
> "add the value DisableUNCCheck REG_DWORD and set the value to 0 x 1
> (Hex)."
>
> The example is set under HKEY_Current_User, but we obviously want this to
> happen on the machine. Is there a way, in the script, to write this DWORD
> to the registry, set it to 1, have the agent run, set the DWORD back to 0,
> and then continue?
>
> This is pretty much the last hurdle, but I don't want disabling UNC
> checking to mess with anything else that happens in the other scripts.
>
> Thanks!
>
> -Matt
>
> "Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
> message news:eVW%23Trx0JHA.1424@TK2MSFTNGP02.phx.gbl...
>> If the script runs as a startup script, then perhaps the computer object
>> lacks permissions in \\server\Folder$. You could grant permissions to the
>> group "Domain Computers" in the share, so that the computer can run the
>> program. Remember, there is no user (except the local system account)
>> when startup scripts run.
>>
>> --
>> Richard Mueller
>> MVP Directory Services
>> Hilltop Lab - http://www.rlmueller.net
>> --
>>
>> "Matthew Curiale" <thisis***@realaddy.com> wrote in message
>> news:%23m$ukRx0JHA.1092@TK2MSFTNGP06.phx.gbl...
>>> Set objApp = CreateObject("WScript.Shell")
>>> objApp.Run "cmd /C \\Server\Folder$\agent.exe"
>>> Set objApp = Nothing
>>>
>>> This is the code that's running... It's located in a test group in our
>>> forest. The GPO is link enabled, but not enforced.
>>>
>>> When the machine boots up, sits at the login screen for a few seconds, I
>>> get a command window flash by very quickly. I've used the /K switch,
>>> also... but that hasn't changed anything. It looks like there's an error
>>> message, but I can't see it as it closes very fast.
>>>
>>> The script doesn't reside on the local machines, though ... So is there
>>> any way to put a method in the vbscript itself, to append/write to a log
>>> file somewhere?
>>>
>>> -Matt
>>>
>>> "Pegasus [MVP]" <n***@microsoft.com> wrote in message
>>> news:OM7ybDx0JHA.4756@TK2MSFTNGP05.phx.gbl...
>>>>
>>>> "Matthew Curiale" <thisis***@realaddy.com> wrote in message
>>>> news:O2XFjvw0JHA.3988@TK2MSFTNGP05.phx.gbl...
>>>>> Well, I ended up writing a VERY simple script to call the program that
>>>>> writes the inventory to the database (read: 3 lines of code or so).
>>>>>
>>>>> We've put it into the test group, and applied it as a GPO... The
>>>>> problem now is that, after starting up the machine itself, it doesn't
>>>>> query/write to the database. If I run a rsop and gpresult on the test
>>>>> machine, it says that the script has been applied ... Yet my inventory
>>>>> doesn't update. Conversely, if I run the script "as is" on a machine,
>>>>> it updates the inventory just fine.
>>>>>
>>>>> Is there a way to test the startup script to see if it actually runs?
>>>>> Like, anything that I can put into the code to keep the console window
>>>>> open before it gets to the login screen?
>>>>>
>>>>> TIA, again :)
>>>>>
>>>>> Matt
>>>>
>>>> If your script is a batch file then this line will do the trick:
>>>> echo %date% %time% %UserName% %ComputerName% >> c:\Invent.txt
>>>>
>>>> If it is a VB Script file then a simple method is to invoke it like so:
>>>> cscript //nologo c:\Matt.vbs >> c:\Invent.txt
>>>> and include something like this in the script itself:
>>>> wscript.echo date & time
>>>>
>>>> Alternatively you can use the WriteLine method of the File System
>>>> Object to write the same information into your log file.
>>>>
>>>
>>
>>
>
Author
19 May 2009 2:26 PM
Matthew Curiale
Hi Richard,

Apologies for the delay in a response; I haven't been working on this
project since I last posted.

I was, in fact, referring to kb156276. I just looked over it, and you're
right in saying that there is no mention of version 5.1.2600... Oddly
enough, however, it did not work with that version of the Command Processor.
I set my script to Sleep for 60 seconds, and the message that popped up was
that this version of the Processor did not support UNC pathing.

After adding the DWORD that I mentioned in the last post, and setting it to
1, the agent program ran successfully... We also upgraded to SP3. I tried to
set the DWORD value to 0 this morning, reset the inventory date, and
rebooted the machine... The script ran with no problems whatsoever, updated
the inventory, and otherwise ran without a hiccup. I also deleted the value
entirely, and still no problems. I checked the version info for the Command
Processor, and it's still at 5.1.2600. Could it have been a glitch that was
corrected with SP3?

I'm going to be checking on a non-SP3 machine a little later on ... I may
need to use the mapping script (which we looked at originally but scrapped
for this one). Slowly but surely!!

Thanks for all your help, again... I'll be letting you know what we've come
up with.

--Matt

Show quoteHide quote
"Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
message news:eXAc3I10JHA.4756@TK2MSFTNGP05.phx.gbl...
> Do you refer to kb 156276? I don't see reference to version 5.1.2600. I'm
> not familiar with this problem. Would it make sense to map a drive to the
> share? For example:
>
> Set objNetwork = CreateObject("Wscript.Network")
> objNetwork.MapNetworkDrive "S:", "\\server\Folder$"
> Set objApp = CreateObject("WScript.Shell")
> objApp.Run "%comspec% /C S:\agent.exe"
> objNetwork.RemoveNetworkDrive "S:"
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
> "Matthew Curiale" <thisis***@realaddy.com> wrote in message
> news:uI9nE3y0JHA.140@TK2MSFTNGP03.phx.gbl...
>> Well, the script works, but command processor v. 5.1.2600 does not
>> support UNC pathing. It works, if we pull the workaround from the KB,
>> being:
>>
>> "add the value DisableUNCCheck REG_DWORD and set the value to 0 x 1
>> (Hex)."
>>
>> The example is set under HKEY_Current_User, but we obviously want this to
>> happen on the machine. Is there a way, in the script, to write this DWORD
>> to the registry, set it to 1, have the agent run, set the DWORD back to
>> 0, and then continue?
>>
>> This is pretty much the last hurdle, but I don't want disabling UNC
>> checking to mess with anything else that happens in the other scripts.
>>
>> Thanks!
>>
>> -Matt
>>
>> "Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
>> message news:eVW%23Trx0JHA.1424@TK2MSFTNGP02.phx.gbl...
>>> If the script runs as a startup script, then perhaps the computer object
>>> lacks permissions in \\server\Folder$. You could grant permissions to
>>> the group "Domain Computers" in the share, so that the computer can run
>>> the program. Remember, there is no user (except the local system
>>> account) when startup scripts run.
>>>
>>> --
>>> Richard Mueller
>>> MVP Directory Services
>>> Hilltop Lab - http://www.rlmueller.net
>>> --
>>>
>>> "Matthew Curiale" <thisis***@realaddy.com> wrote in message
>>> news:%23m$ukRx0JHA.1092@TK2MSFTNGP06.phx.gbl...
>>>> Set objApp = CreateObject("WScript.Shell")
>>>> objApp.Run "cmd /C \\Server\Folder$\agent.exe"
>>>> Set objApp = Nothing
>>>>
>>>> This is the code that's running... It's located in a test group in our
>>>> forest. The GPO is link enabled, but not enforced.
>>>>
>>>> When the machine boots up, sits at the login screen for a few seconds,
>>>> I get a command window flash by very quickly. I've used the /K switch,
>>>> also... but that hasn't changed anything. It looks like there's an
>>>> error message, but I can't see it as it closes very fast.
>>>>
>>>> The script doesn't reside on the local machines, though ... So is there
>>>> any way to put a method in the vbscript itself, to append/write to a
>>>> log file somewhere?
>>>>
>>>> -Matt
>>>>
>>>> "Pegasus [MVP]" <n***@microsoft.com> wrote in message
>>>> news:OM7ybDx0JHA.4756@TK2MSFTNGP05.phx.gbl...
>>>>>
>>>>> "Matthew Curiale" <thisis***@realaddy.com> wrote in message
>>>>> news:O2XFjvw0JHA.3988@TK2MSFTNGP05.phx.gbl...
>>>>>> Well, I ended up writing a VERY simple script to call the program
>>>>>> that writes the inventory to the database (read: 3 lines of code or
>>>>>> so).
>>>>>>
>>>>>> We've put it into the test group, and applied it as a GPO... The
>>>>>> problem now is that, after starting up the machine itself, it doesn't
>>>>>> query/write to the database. If I run a rsop and gpresult on the test
>>>>>> machine, it says that the script has been applied ... Yet my
>>>>>> inventory doesn't update. Conversely, if I run the script "as is" on
>>>>>> a machine, it updates the inventory just fine.
>>>>>>
>>>>>> Is there a way to test the startup script to see if it actually runs?
>>>>>> Like, anything that I can put into the code to keep the console
>>>>>> window open before it gets to the login screen?
>>>>>>
>>>>>> TIA, again :)
>>>>>>
>>>>>> Matt
>>>>>
>>>>> If your script is a batch file then this line will do the trick:
>>>>> echo %date% %time% %UserName% %ComputerName% >> c:\Invent.txt
>>>>>
>>>>> If it is a VB Script file then a simple method is to invoke it like
>>>>> so:
>>>>> cscript //nologo c:\Matt.vbs >> c:\Invent.txt
>>>>> and include something like this in the script itself:
>>>>> wscript.echo date & time
>>>>>
>>>>> Alternatively you can use the WriteLine method of the File System
>>>>> Object to write the same information into your log file.
>>>>>
>>>>
>>>
>>>
>>
>
>