How to use PowerShell
Windows PowerShell is more advanced successor of the Command Line. It can be used for Windows system automation and configuration. It can also access the file system, registers, processes, services, network components or selected applications.
Before the first usage it is recommended to verify whether the
PowerShell is activated in the Windows system. If not then follow the steps below:
Control panels>Programs and functions>Activate or deactivate Windows system functions => "Windows PowerShell 2.0".
If the
PowerShell is to be used for executing commands that require higher permissions then you need to run 32- or 64-bit PowerShell "as administrator" (based on the 32- or 64-bit PROMOTIC runtime type used) and execute the following command:
Set-ExecutionPolicy Unrestricted
and confirm the option "
A".
Example:
Runs the ping command and then netstat
JavaScriptVBScriptSelect and copy to clipboard
var oShell = Pm.AxGetObject("new", "WScript.Shell");
var sInvoke = "";
sInvoke = += "ping 127.0.0.1" + "\r\n";
sInvoke = += "netstat";
oShell.Run("PowerShell " + sInvoke, 1, false);
Dim oShell, sInvoke
Set oShell = Pm.AxGetObject("new", "WScript.Shell")
sInvoke = ""
sInvoke = sInvoke & "netstat"
sInvoke = sInvoke & "ping 127.0.0.1" & vbCrLf
oShell.Run "PowerShell " & sInvoke, 1, false