Hello people...

I am trying to add a desktop icon that locks the workstation. I am trying to use the following without any luck.

WshShortCut()

code:
 
$DesktopPath = ReadValue ("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "Desktop")

WshShortCut($DesktopPath+"\Lock Workstation.lnk","rundll32.exe user32.dll,LockWorkStation",,,"%SystemRoot%\system32\SHELL32.dll,47")
Function WshShortCut($path,$targetpath,optional $arguments, optional $startdir, optional $iconpath)
dim $shell,$shortcut
$shell = createobject("wscript.shell")
if $shell
$shortcut = $shell.createshortcut("$path")
if $shortcut
$shortcut.targetpath = $targetpath
if $arguments
$shortcut.arguments = $arguments
endif
if $startdir
$shortcut.workingdirectory = $startdir
endif
if $iconpath
$shortcut.iconlocation = $iconpath
endif
$shortcut.save
$shortcut = 0
endif
$shell = 0
endif
exit @error
EndFunction

It creates the icon ok but when I look at properties it has nothing in the target. Just a syntax problem on my part?

[ 20. January 2003, 20:44: Message edited by: CitrixMan ]