Simple usage
1. Logging PowerShell version
This example is the most popular thing that people love about using PowerShell
PowerShell Version Table:
Try executing $PSVersionTable
and $PSVersionTable.PSVersion
in a PowerShell terminal.
You should see something simillar to the above.
PowerJS behind the scenes try to transport data between PowerShell and your Node Process
When running the example code, you should see:
However, the 7
there is the same as $PSVersionTable.PSVersion.Major
, that means it can differ in your side.
In step-by-step:
Import PowerJS library using the
import
statement. Currently PowerJS exports many things, so you will need to imported object using{...}
,and get onlyPowerJS
objectCreate an instance using the new operator.
Execute
$PSVersionTable
to get A version table object PowerShell Version Table:, then wait for response.Extract the Major part of the version, using
result.PSVersion.Major
.
2. Logging User names
This task is common when it comes to automation and system management
3.
Last updated