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
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
--
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...
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
"Richard Mueller [MVP]" <rlmuelle...@ameritech.NOSPAM.net> wrote in
message news:uTlwfnh1...@TK2MSFTNGP12.phx.gbl...
>.
>
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
"Troy Bruder" <N0-Spam-t...@aptconsulting.com> wrote in message
news:eD$gRCr1D...@TK2MSFTNGP12.phx.gbl...
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"