Link to home
Start Free TrialLog in
Avatar of dgriffit55
dgriffit55Flag for United States of America

asked on

Need help writing a script...PLZZZZ

Hi,
I am hoping someone can assist me.  I am wanting to write a script to create a shortcut for a program called ExamView Player and place it either on the desktop or in the start menu / programs.

I basically will be having a shortcut from the server the program will reside on.  So, I figure it will be some sort of net use command or something like that.

I have never wrote a script before, but I am excited to try.

Thanks in advance.

Bob
Avatar of Shift-3
Shift-3
Flag of United States of America image

It would be easiest to create the shortcut manually and place it on a network share.  Then copy it with a batch script like the one below.

If you actually want to create the shortcut with a script then you'll need to use a vbscript like the one in this article:
http://www.microsoft.com/technet/scriptcenter/resources/qanda/jun07/hey0607.mspx


@echo off
 
if not exist "%userprofile%\desktop\ExamView Player.lnk" (
 xcopy "\\server\share\ExamView Player.lnk" "%userprofile%\desktop\" /C /H /R /Y
)
 
if not exist "%userprofile%\start menu\programs\ExamView Player.lnk" (
 xcopy "\\server\share\ExamView Player.lnk" "%userprofile%\start menu\programs\" /C /H /R /Y
)

Open in new window

Avatar of dgriffit55

ASKER

I have the program on the server and the folder shared.  

Now I am just trying to figure out a way to add the shortcut to the student logins or something instead of adding the shortcuts manually which is very difficult to get access to the computers in the lab classroom during the quarter.

So, this script will work if I save it as a batch file?

Thanks.

Bob
ASKER CERTIFIED SOLUTION
Avatar of Shift-3
Shift-3
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This is cool stuff.  Where do I store the .cmd file once it is created?  I believe I go to the startup scripts section of the GPM to link to the file, but not sure where I should store the script file.

Thanks again.

Bob
I think I found out where to add the script to the logon script area by following the unique ID of the existing student policy.  Then I opened the student policy and linked the script within the logon properties to add a script.  However, it is asking for script parameters.  Do I keep that blank?

I feel as if I am almost there.

Thanks again.

Bob
Yes, this script doesn't need any parameters.
Ok, I created the script as you have it & made the changes needed.

shortcut name = ExamView 5.2
netshare = \\ServerName\ExamView52

Saved it as ExamView52Shortcut.cmd

Then added it to the C:\WINDOWS\SYSVOL\sysvol\domainname\Policies\{xxxxx-xxxxxxx-xxxx-xxxxx}\
User\Scripts\Logon

Then opened up Group Policy Management & edited Student Policy - Group Policy Object Editor - User Configuration - Windows Settings - Scripts - Logon

Does this sound correct?

Remember, my very first time dealing with scripts.

Thanks again.

Bob



I am trying to do this from a Windows 2003 Server - Standard Edition to Windows XP Pro w/ SP2 clients.

Does the WSH already exist for Windows XP Pro systems?

Thanks again.

Bob
What does the   /C /H /R /Y  mean?

Bob


 
That should work.

Batch scripts will run just fine on XP.

See here for a reference on XCOPY switches:
http://www.ss64.com/nt/xcopy.html

I am not sure where I need to proceed, but I know I am very close to getting this to work.  I have tried the cmd file on my own system locally and it worked like a charm, now I need to figure out how to push it from the server to the client.

I believe I have the script in the correct place on the server & the Group Policy Management working correctly too, because when I logon to a client computer for the script to run on I get the following Error in the computers Event Viewer.

Type: Error
Source: UserInit
Event ID: 1000

"Could not execute the following script \\domainname\SysVol\domainname\scripts\ExamView52Shortcut.cmd.  Access is denied."

Any ideas how to correct this?

Thanks again for everything.

Bob
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Great answer.  Will refer to Shift-3 again for scripting questions.
Thanks again.