I made the base 64 encoding of a powershell script to run from the console remotely within a batch file.
You can encrypt the base 64 encoding for not trace the structure of the code?
Alternatively, there is a method to do this?
There's never going to be a 100% secure way to prevent people from reading your script code; it always has to be decrypted before it can be executed, and whoever is able to run the script is also able to decrypt it.
That said, the "compile to exe" functionality of Sapien's PowerShell Studio product creates .NET executables which contain encrypted script code, and the process to decrypt that code is pretty well obfuscated. Like I said, it's not perfect, but it would discourage all but the most determined people. So far, that's the only product I've seen which doesn't make it completely trivial to extract the original PowerShell code.
I don't know. Depends on which tool you used to compile the script to exe. If it was a malicious program, then maybe it produced infected executables of some sort. Or maybe it was a legitimate compiled EXE, but the executable triggered some heuristic analysis flag in the AV software.