PetersonEB
(Just in Town)
2008-07-02 08:38 PM
Creating shortcuts with WshShortcut without admin privileges

Hello all,

Can anyone tell me whether it is possible to create shortcuts in the Start Menu when not running the logon script as a local admin? I am using the WshShortcut UDF, which is running fine until I log in as a regular user. I stripped down the code and separated it and it seems to error out when using the CreateShortcut method on line 2...

 Code:
$Shell=CreateObject("WScript.Shell")
$Shortcut=$Shell.CreateShortcut("c:\test.lnk)
$Shortcut.TargetPath="c:\windows\notepad.exe"
$Shortcut.Save


I tried this same code under VBScript (modified) and it works fine. I am running it on XP, but I get the same results on 2k. Does Kix treat COM objects differently than VBS?


Mart
(KiX Supporter)
2008-07-02 08:43 PM
Re: Creating shortcuts with WshShortcut without admin privileges

You can use AdminScript Editor (ASE), RunAs, Runn As( note the double n), Kix2EXE and/or the tokenization feature that is build in in kix. This way you can relatively safe include a password and username to use when running the script that creates the shortcuts. If you do a search on one or all of them then you’ll loads of results showing you how to use it.

PetersonEB
(Just in Town)
2008-07-02 10:07 PM
Re: Creating shortcuts with WshShortcut without admin privileges

Nevermind. It looks like admin privileges are not required after all. The problem was that I was only creating the folder for the shortcuts to be placed into in some situations. The user account I have been testing happened to bypass all the functions that would have created it first. That doesn't explaining that piece of script bombing with user privileges, but oh well.

AllenAdministrator
(KiX Supporter)
2008-07-02 11:07 PM
Re: Creating shortcuts with WshShortcut without admin privileges

There are a couple of wshshortcut udfs on this board. Could you provide a link to the one you are using?