Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > Inventory script question

Reply
Thread Tools Display Modes

Inventory script question

 
 
Matthew Curiale
Guest
Posts: n/a

 
      04-27-2009
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

 
Reply With Quote
 
 
 
 
Pegasus [MVP]
Guest
Posts: n/a

 
      04-27-2009

"Matthew Curiale" <> wrote in message
news:3DC17929-8CF8-4908-8099-...
> 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.


 
Reply With Quote
 
Richard Mueller [MVP]
Guest
Posts: n/a

 
      04-27-2009

"Matthew Curiale" <> wrote in message
news:3DC17929-8CF8-4908-8099-...
> 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
--


 
Reply With Quote
 
Matthew Curiale
Guest
Posts: n/a

 
      04-28-2009
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


"Richard Mueller [MVP]" <rlmueller-> wrote in
message news:u%23HB$...
>
> "Matthew Curiale" <> wrote in message
> news:3DC17929-8CF8-4908-8099-...
>> 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
> --
>
>


 
Reply With Quote
 
Pegasus [MVP]
Guest
Posts: n/a

 
      04-28-2009

"Matthew Curiale" <> wrote in message
news:4C7B92EE-E3C3-4F93-8583-...
> 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.


 
Reply With Quote
 
Matthew Curiale
Guest
Posts: n/a

 
      04-28-2009

"Pegasus [MVP]" <> wrote in message
news:uT%...
>
> "Matthew Curiale" <> wrote in message
> news:4C7B92EE-E3C3-4F93-8583-...
>> 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

 
Reply With Quote
 
Pegasus [MVP]
Guest
Posts: n/a

 
      04-28-2009

"Matthew Curiale" <> wrote in message
news:7D2880AC-FE50-40DC-A2D9-...
>
> "Pegasus [MVP]" <> wrote in message
> news:uT%...
>>
>> "Matthew Curiale" <> wrote in message
>> news:4C7B92EE-E3C3-4F93-8583-...
>>> 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.


 
Reply With Quote
 
Richard Mueller [MVP]
Guest
Posts: n/a

 
      04-28-2009

"Pegasus [MVP]" <> wrote in message
news:...
>
> "Matthew Curiale" <> wrote in message
> news:7D2880AC-FE50-40DC-A2D9-...
>>
>> "Pegasus [MVP]" <> wrote in message
>> news:uT%...
>>>
>>> "Matthew Curiale" <> wrote in message
>>> news:4C7B92EE-E3C3-4F93-8583-...
>>>> 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
--


 
Reply With Quote
 
Matthew Curiale
Guest
Posts: n/a

 
      05-12-2009
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

"Richard Mueller [MVP]" <rlmueller-> wrote in
message news:...
>
> "Pegasus [MVP]" <> wrote in message
> news:...
>>
>> "Matthew Curiale" <> wrote in message
>> news:7D2880AC-FE50-40DC-A2D9-...
>>>
>>> "Pegasus [MVP]" <> wrote in message
>>> news:uT%...
>>>>
>>>> "Matthew Curiale" <> wrote in message
>>>> news:4C7B92EE-E3C3-4F93-8583-...
>>>>> 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
> --
>
>


 
Reply With Quote
 
Pegasus [MVP]
Guest
Posts: n/a

 
      05-12-2009

"Matthew Curiale" <> wrote in message
news:...
> 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Active Directory Inventory Script Richard Mueller Scripting 4 10-19-2006 06:02 PM
Tips to Create a S/W inventory Script Tim H. Scripting 3 08-07-2006 12:47 PM
Re: Computer Inventory Script Needed aaron Scripting 0 03-17-2006 05:09 PM
network hardware inventory script JT Server Networking 0 12-30-2004 03:08 PM
PC Inventory Script Jeff Scripting 2 01-14-2004 02:39 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59