Need help with Action to copy Folder from Share to Current User Desktop

Hi All, would like to copy a folder from a network shared location to a user’s desktop. for example copying \Server\share\Folder1 to c:\users\John Doe\Desktop. I was attempting to use a current user or %userprofile% variable but they fail when I test the action scripts. Here are the scripts that I have been trying to use.

Attempt A.

waithidden cmd /c mkdir "%userprofile%\Desktop\Folder XYZ"
waithidden cmd /c copy "\\server\share\Folder XYZ" "%userprofile%\Desktop\Folder XYZ\" /Y

Attempt B.

waithidden cmd /c mkdir "c:\users\{parameter "CurrentUserName"}\Desktop\Folder XYZ"
waithidden cmd /c copy "\\server\share\Folder XYZ" "C:\Users\{parameter "CurrentUserName"}\Desktop\Folder XYZ" /Y

Both methods seem to work on the Fixlet Debugger. Any help would be greatly appreciated.
Thanks!

The BigFix client runs a Local System so it has no access to network shares.

What kind of content is in the folder you are trying to copy? There might be a different way to solve the problem.

1 Like

hmmm I wonder if this should be run as the user. The content is a simple .jar file.
Thanks for your reply Tim.

Why not make it available on a WWW server and use the clients Prfetch command to retrieve it?

1 Like

Thinking the issue was permissions related, I spent the day trying to run cmd.exe as the current user. It did not work.

override run
RunAs=currentuser
run cmd.exe  mkdir "%userprofile%\Desktop\Folder XYZ"
run cmd.exe copy /c  "\\server\share\Folder XYZ" "%userprofile%\Desktop\Folder XYZ\" /Y.   

The directory would create but the second command to copy did not work. I still think its a permission issue.

I will give y our suggestion a try next. Thanks for the tip.

I believe Override Run will only work for the next Run command – you’d need to repeat it:

override run
RunAs=currentuser
run cmd.exe  mkdir "%userprofile%\Desktop\Folder XYZ"

override run
RunAs=currentuser
run cmd.exe copy /c  "\\server\share\Folder XYZ" "%userprofile%\Desktop\Folder XYZ\" /Y

For this to work the current user will need access to the network share – are you sure that is the case?

Bill

1 Like

Ok, I was able to upload to the wwww site but having some issues copying the folder from __Download to the user desktop location using the %userprofile% variable. On a positive, Strawgate pointed out that I just had to space the two Override commands. The following action is working consistently.

override run
RunAs=currentuser
run cmd.exe mkdir “%userprofile%\Desktop\Folder XYZ”

override run
RunAs=currentuser
run cmd.exe copy /c “\server\share\Folder XYZ” “%userprofile%\Desktop\Folder XYZ” /Y

I am using information from another thread for relevance that checks for the desktop folder in the current logged on user profile. Here is the link
https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014754145

Thanks everyone!

1 Like

Thanks Dude! That was it. Thanks for responding.

Thanks for your ideas. Ultimately they helped me find a solution thinking outside the box.