I'm having some issues trying to deploy a batch file that will copy some powerpoint, excel, and word templates to their desktops. (We just had a rebranding)
On my test machines, the batch file runs fine for both Windows XP and Windows 7. I don't know what the problem is here as the batch files work fine without LANDesk, but when I go to distribute the task through LANDesk I get a "Package deployment failed" and a Return code 4.
Everyone has access to this share, I'm using a policy supported push, and I tried sifting through the log files with no real answer for why it isn't deploying.
I still haven't been able to find documentation on return code 4 as well.
Here's my scripting for both OS's:
::Copies files to dekstop of current user *For Windows 7
xcopy "\\networkshare\tempstorage\Templates" "%systemdrive%\users\%username%\Desktop\Templates\" /O /X /E /H /K
xcopy "\\networkshare\tempstorage\Templates" "%userprofile%\Desktop\Templates\" /O /X /E /H /K
Would appreciate any help in this matter!
Error 4 is likely coming from xcopy. MS has the xcopy exit codes documented here: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/xcopy.mspx?mfr=true
What you are doing is failing because by default the package runs as the Local System account on your machines which don't have a %username% variable so there isn't a valid path when that xcopy command runs.
You could go into the package and go to the Account section and change it to "Current User's Account". This would run it as the currently logged on user. It will however fail if no one is logged onto the machine.
What I usually do is run it as local system and copy it to the C:\users\public\public desktop so all users have it. XP has something similar in docuements and settings.
You can use the %allusersprofile% variable if it's ok to copy the shortcuts to all users. Otherwise, you might have to make it run as Current User Account as been said, but this works best in combination with a Policy Delivery Method, where the agent is configured to runthe Policy Sync at logon.