Jump to content

How to run bat files remotely [KSC for Windows]


Recommended Posts

Advice and Solutions (Forum Knowledgebase) Disclaimer. Read before using materials.

This article is about Kaspersky Security Center for Windows (KSC for Windows)

Sometimes it is necessary to execute batch files on managed hosts. When doing so, keep the following information in mind.

To execute batch file on remote hosts:

  1. Create an installation package based on a file
  2. Create a remote installation task for that Installation package
  3. Assign the task to a target hosts and start it

During task execution NAgent will run the file using a 32-bit cmd.exe process (C:\Windows\SysWOW64\cmd.exe) under LocalSystem account.

Limitations

Some commands and programs

  • don't support execution under LocalSystem account.
  • are not recognized as internal (external) for 32-bit cmd, thus can not be started from 32-bit cmd.exe process.

To execute batch file using 64-bit cmd.exe process:

  1. Add simlink to 64-bit cmd.exe in the script
  2. Run all cmdlets using this simlink
     
Example
REM the following creates simlink named cmdin64.exe to C:\Windows\System32\cmd.exe
cmd.exe /c mklink cmdin64.exe "C:\Windows\System32\cmd.exe"
REM next line starts uwfmgr.exe with , which is not recognized as internal or external for 32-bit cmd.exe
cmdin64.exe /c uwfmgr.exe

Or

Use x64 versions of commands. For example, to import reg.file you need to create the following bat file:

Example
echo off
 
reg add <reg file> /reg:64

You can find x64 versions of the commands online.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...