Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
VertigoRay authored May 17, 2018
1 parent ab6695c commit cbbf3a6
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
This vbscript will run powershell.exe hidden; since [`-WindowStyle Hidden` isn't sufficient](https://github.com/PowerShell/PowerShell/issues/3028). Hopefully we'll have [a `pwshw.exe` soon](https://github.com/PowerShell/PowerShell/issues/3028#issuecomment-367169480) and this repo can be antiquated.
This vbscript will run powershell.exe hidden; since [`-WindowStyle Hidden` isn't sufficient](https://github.com/PowerShell/PowerShell/issues/3028).
Hopefully we'll have [a `pwshw.exe` soon](https://github.com/PowerShell/PowerShell/issues/3028#issuecomment-367169480) and this repo can be antiquated.

You're probably here because you've already realized that using [PowerShell's `-WindowStyle Hidden` parameter](https://docs.microsoft.com/en-us/powershell/scripting/core-powershell/console/powershell.exe-command-line-help#parameters) without this script, doesn't completely hide the powershell console.

Expand All @@ -10,12 +11,13 @@ You're probably here because you've already realized that using [PowerShell's `-
wscript.exe HiddentPowershell.vbs -ExecutionPolicy ByPass -File "C:\Program Files\Get-HelloWorld.ps1"
```

This Will run Powershell in a completely hidden console by calling PoweRShell like this:
This Will run Powershell in a completely hidden console by calling PowerShell like this:
```
powershell.exe -ExecutionPolicy ByPass -File "C:\Program Files\Get-HelloWorld.ps1"
```

I recommend that you also pass the `-WindowStyle Hidden` parameter, so that the executing powershell script knows that it's hidden.
You may also want to include the `-NonInteractive` parameter for the same reason.

If you have machines that have Windows Scripting Host (WSH) file extensions (like `.vbs`) disassociated from WSH; then you will need to add the `//E:vbscript` parameter:
```
Expand All @@ -24,7 +26,9 @@ wscript.exe //E:vbscript HiddentPowershell.vbs ...

# Logging

Logging is done to *Event Viewer*. There will be two events for every run of the script. One at the start of the run, and the other at the completion/finish. The details of the logs are:
Logging is done to *Event Viewer*.
There will be two events for every run of the script. One at the start of the run, and the other at the completion/finish.
The details of the logs are:

- **Event Path:** `Windows Logs\Application`
- **Source:** `WSH`
Expand All @@ -35,7 +39,8 @@ Logging is done to *Event Viewer*. There will be two events for every run of the

## Start

The *Event ID* of the *starting* message will always be `4` (informational). Here's an example of what that will look like:
The *Event ID* of the *starting* message will always be `4` (informational).
Here's an example of what that will look like:

```
HiddenPowershell Running:
Expand All @@ -45,7 +50,8 @@ HiddenPowershell Running:

## Finish

The *Event ID* of the *finished* message will be `0` (success). If powershell exits with a non-zero exit code, the *Event ID* will be `1` (error).
The *Event ID* of the *finished* message will be `0` (success).
If powershell exits with a non-zero exit code, the *Event ID* will be `1` (error).

Here's an example of what a *success* looks like; *Event ID* is `0`:
```
Expand Down

0 comments on commit cbbf3a6

Please sign in to comment.