Jump to content


  • 0
citizen0100

Stop Windows Process then Copy files

Question

Hi,

 

I'm new here so Hello!

 

Need some help with copying files to C:\Program Files (x86)\Desktop\ but before I do that I need to kill a process.

 

Soooo I created a batch file:

REM Check if a file exists? If not then install the new version, if it does then exit.
if exist "c:\program files (x86)\Desktop\New_Version.flag"  goto :EXIT
ELSE goto :RUN
:RUN
taskkill /im Desktop.exe
echo DesktopInfo.exe was killed
xcopy /s \\Domain.net\sccm$\Source\Desktop_R3\*.* "C:\Program Files (x86)\Desktop\" /Y
start "" "C:\Program Files (x86)\Desktop\Desktop.exe"
end
:EXIT
end

I then created a package and pushed it out but it fails, I was about to start going through the logs but I thought I'd ask here if I was actually doing this correctly as I'm totaly new to SCCM.

 

Any help would be awesome.

 

Thanks

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

You can use the PS App Deploy Toolkit to do this (http://psappdeploytoolkit.com/). It will not only kill the process but stop it from relaunching while the copy is happening. The only issue I can see is the relaunching of the application when its finished, I have never tried to do that personally but im sure it can be done.

 

I would create this as an application instead of a package with the detection method being the new file, that way it will only run on machines that it needs to run on.

Share this post


Link to post
Share on other sites

  • 0

Your using a unc path. Sccm packages cannot access these unless you add a line before mapping the location. Try this in your script....

.....

Net use \\Domain.net\sccm$\Source\Desktop_R3

xcopy /s \\Domain.net\sccm$\Source\Desktop_R3\*.* "C:\Program Files (x86)\Desktop\" /Y

......

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.