Google Reviews
If you find this content or our services useful, please leave us a review.

In this blog we provide a solution that enables administrators to run PowerShell scripts silently.

Many of us have tried to launch Powershell.exe silently with the following parameter:

Powershell.exe -WindowStyle Hidden...

But we still see a flash of the blue PowerShell console, even if for a split second.  Unfortunately since PowerShell is console-based, there is no native way around this.  The only other, relatively simple solution, is to use VBScript to launch it.  And I discovered a very handy script over at StackOverflow:

On Error Resume Next

ReDim args(WScript.Arguments.Count-1)

For i = 0 To WScript.Arguments.Count-1
    If InStr(WScript.Arguments(i), " ") > 0 Then
        args(i) = Chr(34) & WScript.Arguments(i) & Chr(34)
        args(i) = WScript.Arguments(i)
        End If

CreateObject("WScript.Shell").Run Join(args, " "), 0, False

Which you can launch like so:

WScript.exe /b "\\path\to\silent.vbs" powershell.exe -ExecutionPolicy ByPass -file "\\path\to\powershell.ps1"

or another example:

wscript.exe /b "\\path\to\silent.vbs" powershell.exe -ExecutionPolicy Bypass -Command "New-Item 'HKLM:\SOFTWARE\Test' -Force"
Run PowerShell Scripts Silently
Comments have now been disabled. If you have a question to ask about this post please ask the community!