From cbbf3a614d65b59b019ec7436da4cf4db5f2de12 Mon Sep 17 00:00:00 2001 From: Raymond Piller Date: Thu, 17 May 2018 14:52:01 -0500 Subject: [PATCH] Update README.md --- README.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 17f77d9..f625e7b 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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: ``` @@ -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` @@ -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: @@ -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`: ```