Jump to content

Recommended Posts

Posted

How to handle the result from powershell with autoit.

Thought the powershell result would be an array and tried _ArrayDisplay, but nothing happens.

$x = RunWait ( @ComSpec & ' /k @powershell -c "Get-CimInstance -Namespace root/Microsoft/Windows/DeviceGuard -ClassName Win32_DeviceGuard"', @SystemDir )
_ArrayDisplay($x)

 

Posted

You can pipe the output of the CMD command to a file. Then you can read the file to get the results.

$x = RunWait ( @ComSpec & ' /k @powershell -c "Get-CimInstance -Namespace root/Microsoft/Windows/DeviceGuard -ClassName Win32_DeviceGuard" > c:\logfile.txt ', @SystemDir )

 
  • Moderators
Posted

Must it be in PS, since you're running it in AutoIt anyway? Natively, you would do something like this:

#include <MsgBoxConstants.au3>

Local $sString = ""
Local $oWMI = ObjGet("winmgmts:\\.\root\Microsoft\Windows\DeviceGuard")
Local $oItems = $oWMI.ExecQuery("SELECT * FROM Win32_DeviceGuard")
    For $sItem In $oItems
        For $sProperty In $sItem.Properties_
            $sString &= $sProperty.Name & ": " & $sProperty.Value & @CRLF
        Next
    Next

MsgBox($MB_SYSTEMMODAL, "DeviceGuard Class Names and Values", $sString)

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

  • 2 weeks later...
Posted (edited)

I would pipe your powershell wmi queries through bash so you can 'cowsay | lolcat' the output to the console, and obfuscate the whole command just to be a dick about it.

 

Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...