Logon script (VB) to create shortcut on desktop to "Startup" folder for user session

Hi

We have a terminal server, and used to have a VB script (that, as part of group policy, would run when the user logged in) to create a "Startup" folder on their desktop.  The folder was actually a shortcut to their user session 'startup' folder.  We found many users were too computer illiterate to navigate to the 'startup' in the program files directory, and then try to figure out how to drag and drop programs there, so with the folder on the desktop, they could drag 'messenger', 'outlook', etc. into it and when they logged on it would open them up.

Due to a domain controller crash, we lost most of the data, and i'd like to find that script again.  Could anyone help please?
Mystical_IceAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

darknothCommented:
Here's a piece of code that will create the shortcut for you.  I don't know how you would add it to your logon script.

Option Explicit
 
Function MakeShortcut(sShortcut, sTarget, sWorking, sIcon, sArgs, sDesc)
	Dim objShell, objShortcut, objWorkingDirectory, objArguments, objDescription
 
	Set objShell = WScript.CreateObject("WScript.Shell")
 
 
	Set objShortcut = objShell.CreateShortcut(sShortcut)
	objShortcut.TargetPath = sTarget
	If sIcon <> "" Then objIconLocation = sIcon
	objWorkingDirectory = sWorking
	If sArgs <> "" Then objArguments = sArgs
	If sDesc <> "" Then objDescription = sDesc
 
	objShortcut.Save
 
	Set objDescription = Nothing
	Set objArguments = Nothing
	Set objWorkingDirectory = Nothing
	Set objShortcut = Nothing
	Set objShell = Nothing
End Function
 
'
' Main
'
 
Dim arrArguments(), intCounter
 
If Wscript.Arguments.Count = 0 Then
	WScript.Echo "This script creates a shortcut in a location specified at runtime "
	WScript.Echo "by command line parameters."
	WScript.Echo
	WScript.Echo "Script requires the shortcut, targetpath, and workingdirectory"
	WScript.Echo "parameters from the command line."
	WScript.Echo
	WScript.Echo "The iconlocation, arguments and description parameters are optional."
	WScript.Echo
	WScript.Echo "   cscript //nologo makeshortcut.vbs targetpath workingdir " & _ 
		"[ iconlocation arguments description]"
	WScript.Echo
Else
	For intCounter = 0 to Wscript.Arguments.Count - 1
		Redim Preserve arrArguments(intCounter)
		arrArguments(intCounter) = Wscript.Arguments(intCounter)
	Next
	DoJob()
End If
 
Sub DoJob()
 
	Dim strShortcut, strTarget, strWorkingDir, strIconLoc, strArguments, strDescription
	Dim intRetVal
 
	strShortcut = arrArguments(0)
	strTarget = arrArguments(1)
	strWorkingDir = arrArguments(2)
	strIconLoc = ""
	strArguments = ""
	strDescription = ""
 
	If intCounter > 3 Then
		strIconLoc = arrArguments(3)
		If intCounter > 4 Then strArguments = arrAgruments(4)
		If intCounter > 5 Then strDescription = arrArguments(5)
	End If
 
	intRetVal = MakeShortcut(strShortcut, strTarget, strWorkingDir, strIconLoc, _
		strArguments, strDescription)
 
End Sub

Open in new window

0
rejoinderCommented:
Mine is a little shorter but will add the shortcut onto the desktop as requested.

Set objShell = CreateObject("Wscript.Shell") 
strUserProfile = objShell.ExpandEnvironmentStrings("%USERPROFILE%")
Set objShortCut = objShell.CreateShortcut(strUserProfile & "\Desktop\Startup Folder.lnk")
objShortCut.TargetPath = "%Userprofile%\Start Menu\Programs\Startup"
objShortCut.Description = "Drag and drop files here to launch them at startup."
objShortCut.Save

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
firemanf29Commented:
OK.  I'm the lazy one.  Download xxmklink.exe from  http://www.xxcopy.com/download/xxmklink.zip and place in the netlogon folder on your DC.

Add the following to your login script (BAT or CMD file) on one line.

if not exist "%Userprofile%\Desktop\Startup Folder.lnk" %logonserver%\netlogon\xxmklink.exe "%Userprofile%\Desktop\Startup Folder.lnk" "%Userprofile%\Start Menu\Programs\Startup" " " "%Userprofile%\Start Menu\Programs\Startup" "Startup Folder" 1
if not exist "%Userprofile%\Desktop\Startup Folder.lnk" %logonserver%\netlogon\xxmklink.exe "%Userprofile%\Desktop\Startup Folder.lnk" "%Userprofile%\Start Menu\Programs\Startup" " " "%Userprofile%\Start Menu\Programs\Startup" "Startup Folder" 1 

Open in new window

0
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

firemanf29Commented:
The above will only create the shortcut if the shortcut does not already exist for that user.
0
firemanf29Commented:
Oh.  That can also be placed in teh System Startup folder on a specific server if you only want it to affect that server.
0
Mystical_IceAuthor Commented:
Thanks guys - much appreciated.  Since you all had a solution, I divided the points, but gave more points to rejoinder, since i ended up using his.

Thanks again
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.