I've created a batch for copying a folder that carry one execution file and a vbs file.
the vbs file is used to make shortcut of the execution file to target user desktop.
When I try the batch locally on a machine, it works fine!
However, I try to deploy it via LANDesk and strange result came out.
The shortcut can't located in user desktop but located in root drive C:
I've no idea what it is happening... ???
Any advise? thanks!
p.s. the vbs is attachd for your reference.
By default we use LocalSystem to run packages which can cause issues when copying to user profiles.
In the properties of the package change the Account to use to the logged on user, and try it again. Alternatively, you can use the All Users folder with LocalSystem and that should work as well.
I made a function that will restart your vbscript as the logged in user. It's pretty slick. Just call it at the start of the script and it should always run as the logged in user. I typically wouldn't do that, as if I wanted the entire script to run as the logged in user, I would just do as described and change the package to do that. What I use this for is more when I have some parts that I want to run as system. For instance, if you had a script that needed to write to the HKLM and HKCU hives, your script would fail if you ran the entire thing as the user, (if the user wasn't an Administrator). So I would run the script as the system account but do a couple tasks as the logged in user. So instead of having the function call the script, I might have it call the script and pass some command line variables that tell the script that it's already done part of the work. Then I check for that and skip ahead 20 lines or so. I hope that makes sense.
'Force the script to run as the local user. Useful for LANDesk.
Set oShell = WScript.CreateObject("WScript.Shell")
eUserProfile = oShell.ExpandEnvironmentStrings("%UserProfile%")
eProgramFiles = oShell.ExpandEnvironmentStrings("%ProgramFiles%")
eWinDir = oShell.ExpandEnvironmentStrings("%WinDir%")
If right(eUserProfile,12) = "LocalService" Or Right(eUserProfile, 13) = "systemprofile" Then
oShell.Run """" & eProgramFiles & "\LANDesk\LDClient\startasuser.exe"" " & eWinDir & "\System32\wscript.exe " & """" & WScript.ScriptFullName & """",0,True
ForceLocalUser = True
ForceLocalUser = False