Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Computer Start up script

3 views
Skip to first unread message

Troy Bruder

unread,
Jan 7, 2004, 12:13:28 PM1/7/04
to
Hello,

I need some help with a computer startup script... I have a script that
copies some files from a network location to the local workstation...
Script runs great manually using CSCRIPT. I now want this to kick off via a
GPO.. I've assigned it as a Computer Startup script, but cannot seem to get
the command line right?

Should the command line be: %systemroot%\system32\cscript.exe and the
parameter the name of my vbs file??

- OR -

Should I create a batch file, that in turn calls "cscript scriptname.vbs"??

Thanks,
Troy


Richard Mueller [MVP]

unread,
Jan 7, 2004, 3:58:22 PM1/7/04
to
Troy Bruder wrote:

Hi,

Group Policy is only applied to clients with W2k or above, and all such
clients support *.vbs logon and startup scripts. There is no need to launch
the vbs with a batch file on these clients. The startup script specified in
GPO can be scriptname.vbs.

To assign the script, edit the GPO for the domain/OU in question, navigate
to Computer Configuration, Windows Settings, Scripts, and click on Startup.
I click on "Show Files..", then in the folder that opens I paste the *.vbs
file and select it. On the Scripts dialog box the file name will show. There
is no command line, although if you click "Edit..." you can specify
parameters. Whether the script is launched with cscript or wscript depends
on how the client is configured to handle *.vbs extensions.

If any of your clients are NT or Win9x, GPO doesn't help. There is no way to
have a startup script. For these older clients, the logon script must be
specified on the Profile tab of the user in AD Users & Computers in a W2k
network. The logon script must be a *.bat file, but it can simply launch the
*.vbs. Reply if you need to know how to do this.

--
Richard
Microsoft MVP Scripting and ADSI
HilltopLab web site - http://www.rlmueller.net
--


Troy Bruder

unread,
Jan 8, 2004, 8:47:18 AM1/8/04
to
Thanks Richard...... The real is problem is this... I develop my scripts
using CSCRIPT... As such, I often include WScript.Echo commands to see what
is going on... When executing these from a GPO, by default they execute
with WSCRIPT, so my WScript.Echo commands now translate into dialog boxes
which the user has to click on..

As long as I remember to remove the WScript.Echo commands from the script,
it works fine using WScript... But leave just one of them in there, and the
users sees a dialog box they need to respond to.

Troy


"Richard Mueller [MVP]" <rlmuelle...@ameritech.NOSPAM.net> wrote in
message news:%23A%23UoFW1...@TK2MSFTNGP12.phx.gbl...

Richard Mueller [MVP]

unread,
Jan 8, 2004, 1:58:37 PM1/8/04
to
Hi,

Sometimes I want to alert the user to something from a logon script.
However, I usually use the WshShell object's Popup method so I can have the
message time out. Users can get pretty upset when they return from fetching
a cup of coffee to find that my silly message has stopped the logon process
and inconvenienced them. For example, in the snippet below, if the drive
mapping fails I display a message, but it times out after 10 seconds and the
script continues:

Set objShell = CreateObject("Wscript.Shell")
objNetwork = CreateObject("Wscript.Network")
intTimeout = 10
strTitle = "Logon Script"

On Error Resume Next
Err.Clear
objNetwork.MapNetworkDrive "K:", "\\MyServer\MyShare"
If Err.Number <> 0 Then
Err.Clear
On Error GoTo 0
strText = "Cannot map drive K:"
strText = strText & vbCrLf & "Logon continues"
intConstants = vbOKOnly + vbExclamation
intAns = objShell.Popup(strText, intTimeout, strTitle, intConstants)
End If
On Error GoTo 0

See the WSH documentation for details on the Popup method.

--
Richard
Microsoft MVP Scripting and ADSI
HilltopLab web site - http://www.rlmueller.net
--

"Troy Bruder" <N0-Spam-t...@aptconsulting.com> wrote in message
news:O6Nev3e1...@TK2MSFTNGP09.phx.gbl...

Troy Bruder

unread,
Jan 9, 2004, 8:00:31 AM1/9/04
to
I like that! Thanks Richard!

Troy


"Richard Mueller [MVP]" <rlmuelle...@ameritech.NOSPAM.net> wrote in

message news:uTlwfnh1...@TK2MSFTNGP12.phx.gbl...

Dan

unread,
Jan 13, 2004, 10:28:37 PM1/13/04
to
Richard, sorry to but in here, but when I try to run a
script like you describe below, a script error box pops up
on startup with the message "The file cannot not be found'?
I am using the below:
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\\printserver\prin
share"
WshNetwork.SetDefaultPrinter "\\printserver\printshare"
Any ideas?
Thanks

>.
>

Richard Mueller [MVP]

unread,
Jan 14, 2004, 1:55:51 PM1/14/04
to
Hi,

It sounds like the logon script file could not be found. How do you specify
the logon script (or, if not as a logon script, how you you run it)? Do you
specify on the Profile tab of the user properties in AD Users & Computers,
or through Group Policy? What client OS?

Win9x and NT client logon scripts must be a *.bat file (or *.cmd or *.exe on
NT), which can launch a VBScript program (as long as DSClient or WSH is
installed on the client, to provide VBScript). If you use the Profile tab in
ADUC, the default location is the NetLogon share. You will get the error you
see if the logon script is not found in this folder. The local path for the
NetLogon share is by default:

c:\winnt\sysvol\sysvol\<your DNS domain name>\scripts

where <your DNS domain name> is something like "MyDomain.com".

If you use Group Policy, use the GPO editor to paste the script in the
correct folder. Otherwise, it is too hard to navigate to the correct
location, which is similar to:

c:\winnt\sysvol\sysvol\<your DNS domain name>\policies\<policy
GUID>\user\scripts\logon

In NT domains, the default path is:

c:\winnt\system32\repl\import\scripts

In all cases these folders are replicated to all DC's in the domain. If you
use a batch file to launch a VBScript, that might account for the "file not
found" message, as it can be tricky to get a syntax that will work on any
DC. I use

wscript %0\..\NetLogon.vbs

This will launch the VBScript program in the file NetLogon.vbs, which is in
the NetLogon share. The batch file with this command must also be in the
NetLogon share. The path "%0\..\" refers to the folder where the batch file
resides, which is the NetLogon share, no matter which DC authenticates the
user.

In rare cases on older clients where the VBScript logon script is launched
by a batch file, the client uses the temporary drive Z: to point to the
NetLogon share, but the drive is unmapped before the VBScript can launch.
The error in this case is something like "the path Z:\NetLogon.vbs not
found". There are ways to minimize the risk of this happening, but I don't
think this is your problem.

If this doesn't help, provide more detail.

--
Richard
Microsoft MVP Scripting and ADSI
HilltopLab web site - http://www.rlmueller.net
--

"Dan" <anon...@discussions.microsoft.com> wrote in message
news:556901c3da4e$7f4294c0$7d02...@phx.gbl...

Al Dunbar [MS-MVP]

unread,
Jan 17, 2004, 5:51:51 PM1/17/04
to
What I do in a similar situation is to have the main script .Run another
vbscript in a separate instance to display a message. The main script
returns immediately and continues with the logon script with virtually no
delay. If the message is something that we require the user to see, it is
displayed with a MSGBOX. If it is just some notification that might be
useful to them if they happen to see it, we user a timed .popup. Whether or
not the user actually sees the message, his logon proceeds without delay,
resulting in minimal inconvenience.

/Al

"Troy Bruder" <N0-Spam-t...@aptconsulting.com> wrote in message

news:eD$gRCr1D...@TK2MSFTNGP12.phx.gbl...

nnever (at) katamail. com

unread,
Jan 30, 2004, 6:10:18 PM1/30/04
to
I put a vbs script in the start up execution folder in an NT system. It shows the
birthdays of the next 3 days.
I wonder what it could happen if I write a script that checks if the current user is the
administrator and in that case changes something in the access list.
In many firms like banks and insurances the administrator of the local domain is often
someone who has a high rank in the hierarchy but knows a little of computers.

Il giorno Wed, 7 Jan 2004 14:58:22 -0600, "Richard Mueller [MVP]"
<rlmuelle...@ameritech.NOSPAM.net> ha scritto:

--
Giovanni Cenati (Aosta, Italy)
Write to user "nnever" and domain "@katamail.com"

0 new messages