Use a startup script to call a local scrip to execute.....

M

Momo

We've encountered a strange problem lately in devloping a vbs script
which writes a text file and an event log to a server. We have this
script run via GPO on computer startup.

What we've found is that if the computer is in a subnet diff than the
server the script cannot write the text file or event logs.
Also if we put the script on a network share on a diff subnet it also
cannot right to the server. It only works is a. if the computer and
server are on the same subnet or b. the script is executed locally on
the computer.

What we've deceided to do is have a GPO startup vbs script that copies
the vbs scipt to each computers c:\temp than run it from there.

But what I'm not sure of is how to write the startup script so that it
calls the vbs script thats been copies to c:\temp so that it'll execute
the script in the context of the local computer.

I've tried using a batch fille ie.

copy script.vbs c:\temp
wscript script.vbs


but this did'nt seem to work can anyone help PLEaase...........
 
F

frank

I recommend using %temp% environment variable rather than hardcoding c:\temp
which may not exist on many machines. So your code would look like:

copy script.vbs %temp%\script.vbs
wscript %temp%\script.vbs

-frank
 
M

Momo

Thanks for the reply.......

But if I wanted to write it using vbs can you suggest how i can write
it please not really sure........ since never really done vbs
programming....
 
A

Andrew Mitchell

Momo said:
We've encountered a strange problem lately in devloping a vbs script
which writes a text file and an event log to a server. We have this
script run via GPO on computer startup.

What we've found is that if the computer is in a subnet diff than the
server the script cannot write the text file or event logs.
Also if we put the script on a network share on a diff subnet it also
cannot right to the server. It only works is a. if the computer and
server are on the same subnet or b. the script is executed locally on
the computer.

What we've deceided to do is have a GPO startup vbs script that copies
the vbs scipt to each computers c:\temp than run it from there.

But what I'm not sure of is how to write the startup script so that it
calls the vbs script thats been copies to c:\temp so that it'll execute
the script in the context of the local computer.

I've tried using a batch fille ie.

copy script.vbs c:\temp
wscript script.vbs


but this did'nt seem to work can anyone help PLEaase...........

copy script.vbs %temp%
cscript %temp%\script.vbs
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top