Executes a Powershell command string. Returns standard Powershell command output, error output, error codes and error descriptions.
Prerequisites
The TLuaPowershell library uses WinRS (Windows Remote Shell) to connect to a Windows Remote Management enabled device.
Information from Microsoft regarding WinRM/WinRS:
"Windows Remote Management (WinRM) is the Microsoft implementation of WS-Management Protocol, a standard Simple Object Access Protocol (SOAP)-based, firewall-friendly protocol that allows hardware and operating systems, from different vendors, to interoperate.
You can use WinRM scripting objects, the WinRM command-line tool, or the Windows Remote Shell command line tool WinRS to obtain management data from local and remote computers that may have baseboard management controllers (BMCs). If the computer runs a Windows-based operating system version that includes WinRM, the management data is supplied by Windows Management Instrumentation (WMI)."
To enable WinRM on a device, type the following in a command prompt:
winrm /quickconfig
You can execute Powershell commands, or run scripts but remember that the commands or scripts that are executed using WinRS must have no user interface dependencies. You cannot for example execute commands that prompts you to "press any key" at the local console, or require any other interactive response.
In This Chapter |