Simple usage
Last updated
Was this helpful?
Last updated
Was this helpful?
This example is the most popular thing that people love about using PowerShell
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.
Import PowerJS library using the import
statement. Currently PowerJS exports many things, so you will need to imported object using {...}
,and get only PowerJS
object
Create 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
.
This task is common when it comes to automation and system management