Discussion:
Inventory script question
(too old to reply)
Matthew Curiale
2009-04-27 18:35:18 UTC
Permalink
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
Pegasus [MVP]
2009-04-27 19:37:52 UTC
Permalink
Post by 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
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.
Richard Mueller [MVP]
2009-04-27 23:11:25 UTC
Permalink
Post by 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
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
--
Matthew Curiale
2009-04-28 13:05:15 UTC
Permalink
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
Post by Richard Mueller [MVP]
Post by 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
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
http://www.rlmueller.net/Inventory.htm
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
Pegasus [MVP]
2009-04-28 13:39:18 UTC
Permalink
Post by 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
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.
Matthew Curiale
2009-04-28 13:47:19 UTC
Permalink
Post by Pegasus [MVP]
Post by 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
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
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
Post by Pegasus [MVP]
30 days, execute agent.exe" ?
Matthew Curiale
Pegasus [MVP]
2009-04-28 14:05:07 UTC
Permalink
Post by Matthew Curiale
Post by Pegasus [MVP]
Post by 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
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
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
Post by Pegasus [MVP]
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.
Richard Mueller [MVP]
2009-04-28 17:28:46 UTC
Permalink
Post by Pegasus [MVP]
Post by Matthew Curiale
Post by Pegasus [MVP]
Post by 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
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
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
Post by Pegasus [MVP]
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
--
Matthew Curiale
2009-05-12 14:14:09 UTC
Permalink
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
Post by Richard Mueller [MVP]
Post by Pegasus [MVP]
Post by Matthew Curiale
Post by Pegasus [MVP]
Post by 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
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
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
Post by Pegasus [MVP]
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
--
Pegasus [MVP]
2009-05-12 14:49:29 UTC
Permalink
Post by 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
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.
Matthew Curiale
2009-05-12 15:15:02 UTC
Permalink
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
Post by Pegasus [MVP]
Post by 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
echo %date% %time% %UserName% %ComputerName% >> c:\Invent.txt
cscript //nologo c:\Matt.vbs >> c:\Invent.txt
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.
Pegasus [MVP]
2009-05-12 15:45:28 UTC
Permalink
Post by 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
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".
Matthew Curiale
2009-05-12 15:54:19 UTC
Permalink
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
Post by Pegasus [MVP]
Post by 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
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".
Richard Mueller [MVP]
2009-05-12 16:00:43 UTC
Permalink
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
--
Post by 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
Post by Pegasus [MVP]
Post by 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
echo %date% %time% %UserName% %ComputerName% >> c:\Invent.txt
cscript //nologo c:\Matt.vbs >> c:\Invent.txt
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.
Matthew Curiale
2009-05-12 18:16:40 UTC
Permalink
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
Post by 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
--
Post by 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
Post by Pegasus [MVP]
Post by 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
echo %date% %time% %UserName% %ComputerName% >> c:\Invent.txt
cscript //nologo c:\Matt.vbs >> c:\Invent.txt
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.
Richard Mueller [MVP]
2009-05-12 22:36:47 UTC
Permalink
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
--
Post by Matthew Curiale
Well, the script works, but command processor v. 5.1.2600 does not support
"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
Post by 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
--
Post by 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
Post by Pegasus [MVP]
Post by 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
echo %date% %time% %UserName% %ComputerName% >> c:\Invent.txt
cscript //nologo c:\Matt.vbs >> c:\Invent.txt
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.
Matthew Curiale
2009-05-19 14:26:06 UTC
Permalink
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
Post by 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
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
--
Post by 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,
"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
Post by 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
--
Post by 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
Post by Pegasus [MVP]
Post by 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
echo %date% %time% %UserName% %ComputerName% >> c:\Invent.txt
cscript //nologo c:\Matt.vbs >> c:\Invent.txt
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.
Loading...