top of page
Search

How to Enable VBScript on Windows 11 Using PowerShell Detection and Remediation Scripts

Aug 17
1 min read

Why Enable VBScript on Windows 11?


  • Legacy compatibility: Some enterprise apps, MSI/EXE installers, or automation workflows still depend on VBScript.

  • Controlled deployment: Detection/remediation ensures VBScript is enabled only where required, avoiding manual intervention.

  • Security trade-off: VBScript is deprecated due to malware risks. Enable only when business-critical apps demand it.


Detection & Remediation Approach

IT admins typically use PowerShell scripts in Intune or SCCM to check if VBScript is installed and remediate if missing.


01Detect VBScript Capability

Check if VBScript is installed as a Windows Feature on Demand.

Run in elevated PowerShell


# Test Script for VBScript Feature


$feature = Get-WindowsOptionalFeature -Online -FeatureName VBSCRIPT -ErrorAction SilentlyContinue


if ($feature -and $feature.State -eq "Enabled") {

Write-Output "Test Passed: VBScript is enabled"

exit 0 # success

}

else {

Write-Output "Test Failed: VBScript is not enabled"

exit 1 # failure

}


02 Remediate by Installing VBScript

Most Common Fix

Add VBScript capability if detection shows it is missing.

Run in elevated PowerShell



# Remediation Script


try {

$feature = Get-WindowsOptionalFeature -Online -FeatureName VBSCRIPT -ErrorAction SilentlyContinue


if ($feature.State -ne "Enabled") {

Enable-WindowsOptionalFeature -Online `

-FeatureName VBSCRIPT `

-All `

-NoRestart


Write-Output "VBScript feature enabled successfully."

}

else {

Write-Output "VBScript is already enabled."

}


exit 0

}

catch {

Write-Error $_.Exception.Message

exit 1

}



 
 
 

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating

Disclaimer: The above content is created at Tek-Doyen's sole discretion. Razorpay shall not be liable for any content provided here and shall not be responsible for any claims and liability that may arise due to merchant’s non-adherence to it.

bottom of page