# PS_ExecuteScript

> Executes a power shell script.

Source: https://docs.capaone.com/capainstaller/vb-scripting-library/powershell-functions/ps-executescript/  
Product: CapaInstaller — a separate CapaSystems product; do not apply this page to any other.

### Description

Executes a power shell script  
The result is being added to `<gsWorkstationPath>\Logs\Temp\PSOut.log`

:::tip
`PS_ExecuteScript` and [PS_ExecuteCommand](/capainstaller/vb-scripting-library/powershell-functions/ps-executecommand/) both write their output to the same `<gsWorkstationPath>\Logs\Temp\PSOut.log` file, so each run overwrites the previous one. If you need to keep a history of the output, create a folder such as `<gsWorkstationPath>\Logs\PowerShell` and copy `PSOut.log` there under a more descriptive name after each run. Alternatively, consider building the logic as a PowerPack instead, which can handle logging on its own.
:::

### Syntax

PS_ExecuteScript(sScript, sScriptArguments, bSigned, bRunUnrestricted) As Boolean

### Parameters

#### sScript (String)

Full path to and name of Powershell script that should be executed

#### sScriptArguments (String)

Script arguments

#### bSigned (Boolean)

Is the script signed

#### bRunUnrestricted (Boolean)

Should the script be executed even though the execution policy prevents it

### Example

**VBScript**

```vb
If bStatus Then bStatus = PS_ExecuteScript(gsPackageRoot & "\Kit\CapaInstaller.ps1", "", False, True) 
```

[Scripting Guidelines](/capainstaller/vb-scripting-library/scripting-guidelines/)

### Related functions

[Constants](/capainstaller/vb-scripting-library/addendum/constants/) [Package Property](/capainstaller/vb-scripting-library/addendum/package-property/) [Variables](/capainstaller/vb-scripting-library/addendum/variables/)
