Hello,
I want to catch the errorlevel of psexec or the "net localgroup" and pipe it into a textfile. What is wrong with my code?

Code:

If $ClientAdmins.IsMember('WinNT://Domain/Admins') <> 1

Shell "psexec.exe \\192.168.2.10 -u @domain\Admin -p Password -i" + " cmd /c net localgroup Administrator " + chr(34) + "Domain\Admins" + chr(34) + " /add"
$Errorcode = @ERROR + ", " + @SERROR
If (RedirectOutput("%TEMP%\@WKSTA.log", 1)) = 0
'Errorcode: $Errorcode'
EndIf

EndIf




Maik