Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - script to create shortcut on user desktop

Reply
 
Old 03-10-2009   #1 (permalink)
Huang


 
 

script to create shortcut on user desktop

Hi, there:

This is a Wscript question, I can't find a dedicated group for windows
scipting, so I post here.

I am a new with script and look around on Microsoft website for a solution
to my problem:


Basically I would like to use logon script with group policy in Windows
server 2003 to achieve the following goal:



1): create a shortcut in user’s desktop, the target of this shortcut is a
share folder on file server.



When I search the Microsoft website, I write the following script:



objWSHShell = CreateObject("Wscript.Shell")

strDesktop = objWSHShell.SpecialFolders("Desktop")



strShortcutName="Corporate Public Folder"

strShortcutPath="\\w2k3chsvr\public"



objShortcut=objWSHShell.creatShortcut(strDesktop + "\" + strShortcutName +
".lnk")

objShortcut.TargetPath=strShortcutPath

objShortcut.Save



I create a script file with name “logon.wsf” on a test XP machine and run
the file, however it pops up an error window saying “on jobs are define in
the file”,

Now I wonder what should be added to this scipt file.


thanks


My System SpecsSystem Spec
Old 03-11-2009   #2 (permalink)
BJ


 
 

Re: script to create shortcut on user desktop

Hello Huang,
for this issue i would use Batch/Commandline because the Shortcut you
want to deploy is always the same.

1. create the Shortcut for the Folder once on your own desktop
(Corporate Public Folder.lnk)
2. copy it once to the Logonshare of the logonserver
3. Put the following line in the common logonscript:

if not exist "%userprofile%\Desktop\Corporate Public Folder.lnk" (copy
"%LOGONSERVER%\Netlogon\Corporate Public Folder.lnk" "%userprofile%
\Desktop\Corporate Public Folder.lnk")

Best regards
BJ


Huang schrieb:
Quote:

> Hi, there:
>
> This is a Wscript question, I can't find a dedicated group for windows
> scipting, so I post here.
>
> I am a new with script and look around on Microsoft website for a solution
> to my problem:
>
>
> Basically I would like to use logon script with group policy in Windows
> server 2003 to achieve the following goal:
>
>
>
> 1): create a shortcut in users desktop, the target of this shortcut isa
> share folder on file server.
>
>
>
> When I search the Microsoft website, I write the following script:
>
>
>
> objWSHShell = CreateObject("Wscript.Shell")
>
> strDesktop = objWSHShell.SpecialFolders("Desktop")
>
>
>
> strShortcutName="Corporate Public Folder"
>
> strShortcutPath="\\w2k3chsvr\public"
>
>
>
> objShortcut=objWSHShell.creatShortcut(strDesktop + "\" + strShortcutName +
> ".lnk")
>
> objShortcut.TargetPath=strShortcutPath
>
> objShortcut.Save
>
>
>
> I create a script file with name logon.wsf on a test XP machine andrun
> the file, however it pops up an error window saying on jobs are definein
> the file,
>
> Now I wonder what should be added to this scipt file.
>
>
> thanks
My System SpecsSystem Spec
Old 03-11-2009   #3 (permalink)
Uwe Kausch


 
 

Re: script to create shortcut on user desktop

Hello Huang,

as first I found a literal problem in
"objShortcut=objWSHShell.creatShortcut", better you write
"objShortcut=objWSHShell.createShortcut".

How ever, I got your script running after some modifications inside the
script and renaming the script file to "logon.vbs". This works perfect on
my environment ...
___________________________

Set objWSHShell = WScript.CreateObject("Wscript.Shell")
strDesktop = objWSHShell.SpecialFolders("Desktop")
strShortcutName = "Corporate Public Folder"
strShortcutPath = "\\w2k3chsvr\public"

Set objShortcut = objWSHShell.CreateShortcut(strDesktop & "\" +
strShortcutName & ".lnk")
objShortcut.TargetPath=strShortcutPath
objShortcut.Save
___________________________

Best regards from Germany,
Uwe





Am 11.03.2009, 01:34 Uhr, schrieb Huang <Huang@xxxxxx>:
Quote:

> Hi, there:
>
> This is a Wscript question, I can't find a dedicated group for windows
> scipting, so I post here.
>
> I am a new with script and look around on Microsoft website for a
> solution
> to my problem:
>
>
> Basically I would like to use logon script with group policy in Windows
> server 2003 to achieve the following goal:
>
>
> 1): create a shortcut in user’s desktop, the target of this shortcut is a
> share folder on file server.
>
>
> When I search the Microsoft website, I write the following script:
>
>
> objWSHShell = CreateObject("Wscript.Shell")
>
> strDesktop = objWSHShell.SpecialFolders("Desktop")
>
>
> strShortcutName="Corporate Public Folder"
>
> strShortcutPath="\\w2k3chsvr\public"
>
>
> objShortcut=objWSHShell.creatShortcut(strDesktop + "\" + strShortcutName
> +
> ".lnk")
>
> objShortcut.TargetPath=strShortcutPath
>
> objShortcut.Save
>
>
> I create a script file with name “logon.wsf” on a test XP machine and run
> the file, however it pops up an error window saying “on jobs are define
> in
> the file”,
>
> Now I wonder what should be added to this scipt file.
>
> thanks
>


--
Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/mail/
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Re: Cannot create desktop shortcut Vista General
Create a shortcut to change user Vista account administration
Help with Script to Create and Share User Directory PowerShell
Create shared desktop shortcut Vista General
send to desktop, create shortcut?? Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46