<< Click to Display Table of Contents >>
Powershell Inline |
MiniRobotLanguage (MRL)
PWE. Command
Powershell Script End
Intention
This command is used to end a block with VB-Script. It is always used paired with VBS.
The statements between a VBS. and a VBE. are ignored by the SPR-Preprocessor.
They are also ignored by the "Pretty-Printer" in the Editor.
VBS. and VBE. enable you, to include a VB-Script or Java-Script Code inline into the SPR-Script. You can use it to check for System-Objects (See Sample 2 below), or you can use it to call WMI-Functions.
You can also transfer Variable-Content into VB-Script-Variables (see example 1 below). And use them in your VB-Script.
And with VBE. you can get a single result value from the VB-Script back into your SPR-Script (see example 2 below).
This Sample-Script shows how to get Parameters into the Powerscript and how to get the result out to the SPR.
' This is the Powershell-Call with the Parameters
PWS.||Theo|Peter und Franz|Ralf|Heribert|Jürgen
param ($var1, $var2, $var3, $var4, $var5)
Write-host "var1 =" $var1
Write-host "var2 =" $var2
Write-host "var3 =" $var3
Write-host "var4 =" $var4
Write-host "var5 =" $var5
PWE.$$OUT
' Display the Output from the Powershell in a Messagebox
MBX.$$OUT
ENR.
The Output from the Script looks like this:
Syntax
PWS.
...
PWE.[P1][|[P2]
Parameter Explanation for VBE
P1 - (out,optional) - will hold to the result of the Powerscript (STDOUT).
P2 - (out,optional) - will Get some Error-Information as far as its not in P1.
Like Commandline-Errors.
This is a Errormessage like you can get it in P2.
Example
'**********************************************
' PWS./PWE. - Sample
' with Parameters
'**********************************************
' This is the Powershell-Call with the Parameters
PWS.||Theo|Peter und Franz|Ralf|Heribert|Jürgen
param ($var1, $var2, $var3, $var4, $var5)
Write-host "var1 =" $var1
Write-host "var2 =" $var2
Write-host "var3 =" $var3
Write-host "var4 =" $var4
Write-host "var5 =" $var5
PWE.$$OUT
' Display the Output from the Powershell in a Messagebox
MBX.$$OUT
ENR.
'**********************************************
' PWS./PWE. - Sample
' Get and say the BIOS-Version 2 times.
'**********************************************
PWS.
param( [string]$strComputer = "." )
$colItems = get-wmiobject -class "Win32_BIOS" -namespace "root\CIMV2" -computername $strComputer
foreach ($objItem in $colItems)
{
write-host "Name : " $objItem.Name
write-host "Version : " $objItem.Version
write-host "BiosVersion: " $objItem.BiosVersion
write-host "SMBIOSBIOS Version : " $objItem.SMBIOSBIOSVersion
write-host "Caption: " $objItem.Caption
write-host "Manufacturer : " $objItem.Manufacturer
Add-Type -AssemblyName System.speech
$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer
$speak.Speak($objItem.SMBIOSBIOSVersion)
$speak.Speak($objItem.SMBIOSBIOSVersion)
}
PWE.$$OUT
MBX.$$OUT
ENR.
Remarks
-
Limitations:
The Powershell-Scripts will be written to the harddisk prior to execution. Therefore they are not permanently crypted as is
the SPR-Script, when using the '#CRY:-Option.
There are no Limitations about Multithreading here.
See also:
• PWS. - Powershell-Script Start