Kaspersky
Question

Custom Tools-Remote Powershell commands

  • 27 August 2019
  • 6 replies
  • 1013 views

Badge
  • Junior Helper
  • 77 replies
Hi,

Is it possible to remotely execute powershell commands from KSC custom tools?

I found this topic but it didn't help me: https://forum.kaspersky.com/index.php?app=forums&module=forums&controller=topic&id=382442&tab=comments#comment-2751988

I need to launch some powershell commands, for example a software list like this:
Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize > D:\swlist.txt

Other example, pending updates.
$update = new-object -com Microsoft.update.Session
$searcher = $update.CreateUpdateSearcher()
$pending = $searcher.Search("IsInstalled=0")
foreach($entry in $pending.Updates)
{
Write-host "Title: " $entry.Title
Write-host "Downloaded? " $entry.IsDownloaded
Write-host "Description: " $entry.Description
foreach($category in $entry.Categories)
{
Write-host "Category: " $category.Name
}
Write-host " "
}

Thank you

6 replies

Badge
PS: these commands don't require administrator privileges
Userlevel 5
Badge +4
Hi,

Yes, that is possible. You have to add a custom tool and specify tool location.
Badge
Hi,

Yes, that is possible. You have to add a custom tool and specify tool location.


Therefore is it possible to launch a ps1 file or the command must be directly write on the field?
Thanks in advance
Userlevel 5
Badge +4
Yes, you can create a batch file to be distributed over network, but please notice, that it will be launced with Local System account.
Badge
Yes, you can create a batch file to be distributed over network, but please notice, that it will be launced with Local System account.

Do you have a link to a guide? I was not able to use it
Badge
I solved except for Ps1 file execution.

Reply