вот вроде рабочий вариант
Код:
Func _power($value)
local $PowerShell = Run(@ComSpec & " /c " &$value, @SystemDir, @SW_HIDE , $STDERR_MERGED + $STDIN_CHILD)
local $out="", $err=""
StdinWrite($PowerShell)
While 1
$line = StdoutRead($PowerShell)
If @error Then ExitLoop
If $line <> "" Then
$out&=_StringOEM2ANSI($line)
EndIf
Wend
if $out="" then
$out=""
While 1
$err = StderrRead($PowerShell)
If @error Then ExitLoop
If $line <> "" Then
$out&=_StringOEM2ANSI($err)
EndIf
Wend
endif
If $PowerShell Then ProcessClose($PowerShell)
if $out <> "" then Return $out
EndFunc