Procedure Execution Log

I would like to run a procedure on an endpoint. The procedure would use the subprocess command to run a CMD or Powershell command on the endpoint. I would like the output of the command to be printed in the Execution log of on the endpoint. Is this possible and how can it be done?

Hi @minntech,

Please try these existing scripts and let us know if it suffice your needs

https://scripts.itarian.com/frontend/web/topic/run-a-powershell-command
https://scripts.itarian.com/frontend/web/topic/run-the-windows-commands-on-the-endpoint

Kind Regards,
PremJK

Yes thats the one that I am using. I am changing the powershell command to:
If ((Get-BitLockerVolume -MountPoint “C”).KeyProtector -like “*”) {(Get-BitLockerVolume -MountPoint “C”).KeyProtector}

When I run this in powershell on a PC I get an ouput of the data, but when I run it from Itarian procedure it doesnt record anything in the execution log.

So I got this working, again it came down to finding the correct combination of quotes around the entire command and specific options within the command. I still dont understand python logic when it comes to quotes. Any references on this to make this a bit easier?

This is what ended up finally working for me:
ps_command=r’’‘Import-Module Bitlocker; If ((Get-BitLockerVolume -MountPoint ‘C’).KeyProtector -like ‘*’) {(Get-BitLockerVolume -MountPoint ‘C’).KeyProtector}’’’