Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a mixture of Win7, and XP machines on my network. Every user logs on using a VBS based logon script and for clients that support it, I want to show an informational pop-up as shown here.

How can I detect if Powershell is installed using VBScript?

share|improve this question
up vote 5 down vote accepted

You could use something like the following. It reads the registry key for PowerShell. If the read is successful (return code 0), or not, you get the corresponding message box, which you can switch out for other logic you need to do--like install PowerShell if it's not detected. See the source links below for more info.

Option Explicit
Dim oShell
Dim value

'If the key isn't there when we try to read it, an error will be generated
'that we will later test for, so we want to automatically resume execution.
On Error Resume Next

'#Try reading the registry value
Set oShell = CreateObject("WScript.Shell")
value = oShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\")

'Catch the error
If Err.Number = 0 Then
    'Error code 0 indicates success
    MsgBox(Err.Number & "PowerShell is installed.")
    'Any other error code indicates failure
    MsgBox(Err.Number & "PowerShell is NOT installed.")
End If

VBScript to check the registry for an application (example is .NET):

Registry keys to check for PowerShell:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.