Istanbul/Turkey

26- How to run a batch file on SCCM Client

Recently, I needed to run a batch file on some SCCM clients. What I needed to do was to run a batch file at the startup of the computer. So, there would be 2 batch files. The first batch file would copy the second batch file to the startup. Also the second batch file must run whoever logs on to the computer.

First batch file name is filecopy.bat, it copies SystemStartupProc.bat to startup folder

copy /y "%~dp0SystemStartupProc.*" "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup"

 

Second batch file name is SystemStartupProc.bat, It closes a process named explorer.exe whenever user logged on 

taskkill /f /IM something.exe 

 

These 2 files are located on a shared folder named Files2Copy (W:\Sources\Packages\SystemStartupProc\Files2Copy) on the SCCM Server. 

We can create the package, give a name to it and show the path to the folder.

 

 

 

In Command Line, just type in the file's name to be run

 

 

  • Hits: 11593