# VBScript to PowerShell Converter & Migration Scanner (`ali-lamtoueq/vbscript-to-powershell`) Actor

Scan VBScript files for migration risks (free) and convert them to PowerShell with a review checklist, before Windows disables VBScript by default. Built for AI agents and IT teams.

- **URL**: https://apify.com/ali-lamtoueq/vbscript-to-powershell.md
- **Developed by:** [Ali Lamtoueq](https://apify.com/ali-lamtoueq) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $100.00 / 1,000 script conversions

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Microsoft Legacy Migration: VBScript, VBA & EWS

Three Microsoft deadlines, one toolkit: VBScript disabled by default in Windows, VBA macros not supported by the new Outlook, and Exchange Web Services (EWS) shut down in Exchange Online on April 1, 2027.

Windows is phasing out VBScript. Microsoft's plan has three phases: VBScript stays enabled by default as a *Feature on Demand* until about 2026–2027, is then **disabled by default**, and is finally removed from future Windows releases. Logon scripts, scheduled tasks, SCCM/Intune packages and Office automations that still call `.vbs` files will stop working when that happens.

This Actor (also available as an MCP server) helps AI agents and IT teams migrate those scripts to PowerShell:

| Tool | What it does | Price |
|---|---|---|
| `scan_vbscript` | Instant static scan (no AI): COM objects used and their PowerShell equivalent, risky features, conversion traps, blockers, security flags, risk score 0–100 and difficulty | **Free** |
| `scan_vba` | VBA macro analysis (no AI): host application, blockers for modern platforms, recommended target, risk score | **Free** |
| `convert_vba` | Converts a VBA macro to Office Scripts, Python, PowerShell + Microsoft Graph (Outlook) or Windows PowerShell, with a review checklist | Paid, per successful conversion |
| `scan_ews` | EWS code analysis (no AI): each EWS call with its Microsoft Graph equivalent, auth changes, Graph gaps, on-premises detection | **Free** |
| `convert_ews_to_graph` | Migrates EWS code to Microsoft Graph in the same language (C#, PowerShell, Python, Java, JavaScript), with the permissions to grant | Paid, per successful conversion |
| `powershell_equivalent` | PowerShell replacement for a ProgID (`Scripting.FileSystemObject`, `MSXML2.XMLHTTP`, `Outlook.Application`…), a moniker (`winmgmts:`, `LDAP://`) or a VBScript function (`InStr`, `Mid`, `On Error Resume Next`, `Select Case`…) | **Free** |
| `convert_vbscript_to_powershell` | Converts a script to idiomatic PowerShell 5.1 (default) or 7, and returns the code plus a review checklist | Paid, per successful conversion |

**Free companion tool:** [VBS Readiness](https://vbs-migrate-mcp.lamtoueqali.workers.dev/) is a free, read-only scanner for Windows that finds every VBScript on a PC (files, scheduled tasks, logon scripts, Run keys, scripts that actually ran) plus Outlook add-ins, VBA macros and PST files for the move to the new Outlook. Use it to find the scripts, then convert them here.

### For AI agents

- **Pay per call without an account**: this Actor supports Apify agentic payments (x402 with USDC on Base or Solana, MPP, or Skyfire). Run it through the Apify MCP server (`https://mcp.apify.com`) or the Apify API. Guide: https://docs.apify.com/agents/payments
- **Input**: `{"tool": "convert_vbscript_to_powershell", "code": "<VBScript>", "target": "ps51"}`. Batch with `"scripts": [...]` (max 20). Start with the free `scan_vbscript` to decide which scripts need converting.
- **Charged**: $0.10 per successful conversion only. Scans and lookups are free. Failed items are never charged.
- **Direct MCP server** with 3 free conversions per day: `https://vbs-migrate-mcp.lamtoueqali.workers.dev/mcp` · Agent guide: `https://vbs-migrate-mcp.lamtoueqali.workers.dev/AGENTS.md`

### How to use it

Run the Actor with one of these inputs. Each script gives one item in the dataset.

| Field | Used by | Description |
|---|---|---|
| `tool` | all | `convert_vbscript_to_powershell`, `scan_vbscript` or `powershell_equivalent` |
| `code` | scan, convert | Content of one `.vbs` / `.wsf` file (max 30,000 characters) |
| `scripts` | scan, convert | Optional list of scripts (max 20 per run), instead of `code` |
| `query` | lookup | ProgID, moniker or keyword |
| `language`, `auth` | convert_ews_to_graph | Output language (`auto` = same as input) and `delegated` / `application` permissions |
| `vba_target` | convert_vba | `auto`, `office_scripts`, `python`, `powershell_graph` or `powershell` |
| `target` | convert | `ps51` (Windows PowerShell 5.1, preinstalled) or `ps7` |
| `context` | convert | Optional: how the script runs (GPO logon script, scheduled task, Intune…) |

AI agents can run it and pay per result with Apify's agentic payments.

#### Example

Input:

```json
{ "tool": "convert_vbscript_to_powershell",
  "code": "Set fso = CreateObject(\"Scripting.FileSystemObject\")\nIf Not fso.FolderExists(\"C:\\Temp\\Logs\") Then fso.CreateFolder \"C:\\Temp\\Logs\"\nWScript.Echo \"Done\"" }
```

Result (shape):

```json
{ "target": "ps51",
  "powershell": "if (-not (Test-Path -Path 'C:\\Temp\\Logs' -PathType Container)) { ... }",
  "warnings": ["..."],
  "blockers": [],
  "security_flags": [],
  "risk_score": 3,
  "difficulty": "easy",
  "disclaimer": "AI-generated draft: review and test in a non-production environment before deployment." }
```

### What the scanner catches

- **COM objects**: FileSystemObject, Dictionary, WScript.Shell / Network, Shell.Application, ADODB, XMLHTTP / WinHTTP, XML DOM, RegExp, Office (Excel, Word, Access, Outlook), CDO, Internet Explorer, ScriptControl, Task Scheduler, Windows Update, WMI, LDAP / WinNT, and any third-party ProgID.
- **Blockers**: `Execute` / `Eval`, `SendKeys`, HTA user interfaces, classic ASP, Internet Explorer automation, Outlook COM (the new Outlook for Windows has no COM automation).
- **Classic conversion traps**: 1-based `Mid`/`InStr` against 0-based `Substring`/`IndexOf`, `Dim a(n)` having n+1 elements, case-sensitive `=` against case-insensitive `-eq`, `ByRef` by default, `On Error Resume Next`, locale-dependent dates, banker's rounding, 32/64-bit registry views.
- **Security flags**: hard-coded passwords (never copied into the output), passwords in connection strings, plain HTTP, download-and-run patterns, encoded `.vbe` scripts.

### Quality and honesty

- Conversions are **drafts for human review**. Always test them outside production first.
- What cannot be converted faithfully is marked with a TODO in the code and listed in `warnings`. Nothing is silently invented.
- The result is checked automatically for leftover VBScript syntax (`Dim`, `CreateObject`, `End If`, `WScript.*`).

### Privacy

`scan_vbscript` and `powershell_equivalent` run locally in the Actor. `convert_vbscript_to_powershell` sends the script to a third-party AI provider (Google Gemini by default) to produce the conversion. Remove secrets from scripts before converting them; the scanner flags them for you.

# Actor input Schema

## `tool` (type: `string`):

What to do. Start with the free scan, then choose "Convert" to get the PowerShell version.

## `code` (type: `string`):

One .vbs/.wsf file, one VBA module, or source code that calls Exchange Web Services (max 30000 characters).

## `scripts` (type: `array`):

Optional: a list of VBScript sources to process in one run (max 20). Replaces "code".

## `query` (type: `string`):

For powershell_equivalent: a ProgID (Scripting.FileSystemObject), a moniker (winmgmts:) or a keyword (InStr, On Error Resume Next).

## `target` (type: `string`):

For conversion: Windows PowerShell 5.1 (preinstalled) or PowerShell 7.

## `context` (type: `string`):

Optional: logon script via GPO, scheduled task, Intune/SCCM, manual run... Helps the converter.

## `vba_target` (type: `string`):

For convert_vba: auto (recommended), Office Scripts, Python, PowerShell + Microsoft Graph (Outlook) or Windows PowerShell.

## `language` (type: `string`):

For convert_ews_to_graph: auto (same as input), C#, PowerShell, Python, Java or JavaScript.

## `auth` (type: `string`):

For convert_ews_to_graph: auto, delegated (signed-in user) or application (daemon/service).

## Actor input object example

```json
{
  "tool": "scan_vbscript",
  "code": "Set fso = CreateObject(\"Scripting.FileSystemObject\")\nIf Not fso.FolderExists(\"C:\\Temp\\Logs\") Then fso.CreateFolder \"C:\\Temp\\Logs\"\nWScript.Echo \"Done\"",
  "target": "ps51",
  "vba_target": "auto",
  "language": "auto",
  "auth": "auto"
}
```

# Actor output Schema

## `results` (type: `string`):

All results as dataset items.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "code": "Set fso = CreateObject(\"Scripting.FileSystemObject\")\nIf Not fso.FolderExists(\"C:\\Temp\\Logs\") Then fso.CreateFolder \"C:\\Temp\\Logs\"\nWScript.Echo \"Done\""
};

// Run the Actor and wait for it to finish
const run = await client.actor("ali-lamtoueq/vbscript-to-powershell").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "code": """Set fso = CreateObject(\"Scripting.FileSystemObject\")
If Not fso.FolderExists(\"C:\\Temp\\Logs\") Then fso.CreateFolder \"C:\\Temp\\Logs\"
WScript.Echo \"Done\"""" }

# Run the Actor and wait for it to finish
run = client.actor("ali-lamtoueq/vbscript-to-powershell").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "code": "Set fso = CreateObject(\\"Scripting.FileSystemObject\\")\\nIf Not fso.FolderExists(\\"C:\\\\Temp\\\\Logs\\") Then fso.CreateFolder \\"C:\\\\Temp\\\\Logs\\"\\nWScript.Echo \\"Done\\""
}' |
apify call ali-lamtoueq/vbscript-to-powershell --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ali-lamtoueq/vbscript-to-powershell"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/VLd0vnMpKsvUHSrhi/builds/JTVcrw0FlGz2hJKos/openapi.json
