How to run klmover remotely on hosts where klnagent is protected by a password [Kaspersky Security Center]
Problem
In Kaspersky Security Center Network Agent (klnagent) 15.1 and more recent versions, klmover tool requires klnagent uninstallation password to re-connect a managed host to another Administration Server: https://support.kaspersky.com/ksc/15.1/227839
If the password is not set in the policy, it is not required to be specified in command line via the parameter: -nauninstpwd
If klmover is executed directly through a Command Prompt, the parameter will work as expected. However, if klmover is started by a .bat file, the uninstall password cannot be passed to command line properly.
Solution
echo command
Qwerty12 is the klnagent uninstallation password and 192.168.1.221 is the IP address of KSC Server.
echo Qwerty12|"C:\Program Files (x86)\Kaspersky Lab\NetworkAgent\klmover.exe" -address 192.168.1.221
Do not add spaces before | , such command will fail!
cmd doesn't parse quotes and spaces in echo properly: If klmover is started from cmd and the password contains characters requiring quotes, klmover should be run from Powershell.
Powershell has a Start-Process command, allowing to run a process as a different user, in this case it can be used in a batch script:
cd "C:\Program Files (x86)\Kaspersky Lab\NetworkAgent\" C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -Command "Start-Process powershell '-Command echo <password>|.\klmover.exe -address <address>' -Verb RunAs"
Example:
cd "C:\Program Files (x86)\Kaspersky Lab\NetworkAgent\" C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -Command "Start-Process powershell '-Command echo Qwerty12|.\klmover.exe -address 192.168.1.221' -Verb RunAs"
Text file
Alternative method is to save the password in a text file password.txt
Remember about the option Copy entire folder to the installation package when uploading the installation package, otherwise, password.txt will not be copied to target hosts.
"C:\Program Files (x86)\Kaspersky Lab\NetworkAgent\klmover.exe" -address 192.168.1.221 < password.txt
In this case, special symbols in the password can be passed correctly to klmover as command line parameter.
Previous versions of klmover are not compatible with klmover in klnagent 15.
0 Comments
Recommended Comments
There are no comments to display.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now