VBScript is going away. Here’s how to find every script that still uses it
Every Windows shop has a logon script nobody wants to open. It maps the drives, connects the printer, writes some registry value somebody needed years ago, and it’s VBScript. (Probably with On Error Resume Next on line two, so you’d never know if it broke.)
Microsoft is turning VBScript off. Around 2027 it’s off by default, and later it’s gone. When that day comes, that logon script won’t throw an error. It’ll exit with code 1 and do nothing, on every machine, at every sign-in. I know because I turned it off in my lab and watched it happen.
So I built a small domain (a Server 2025 DC, a Windows 11 25H2 client, Splunk and Sysmon), deployed exactly that kind of logon script, and went hunting for it the way you’d have to across a real fleet. Then I replaced it three ways: with Group Policy Preferences, with an LLM, and with our own free converter. The converter part didn’t go great at first, and I’ll show you why.
Every script in here is read-only until the part where you start changing things.
Where it stands
Microsoft’s plan has three phases:
- Now. On Windows 11 24H2 and later, and Windows Server 2025, VBScript is a Feature on Demand that’s still installed and on by default. My 25H2 client and 2025 DC both report
VBSCRIPT~~~~ : Installed. - Around 2027. The feature is off by default on new installs. You can turn it back on per machine.
- Later. It’s removed from Windows entirely.
There’s no firm date for phase 2 yet. Plan for 2027 and you won’t be surprised.
It isn’t only your scripts. slmgr.vbs (Windows activation), ospp.vbs (Office activation), the prn*.vbs printer scripts in System32 and winrm.vbs are all VBScript. My lab client had a VBScript event from three weeks earlier, and it was slmgr.vbs, from the day I re-armed its evaluation license. (Microsoft’s own activation script. Good luck, everyone.)
You can see the 2027 world today. Removing the feature takes seconds and doesn’t need a restart:
Remove-WindowsCapability -Online -Name 'VBSCRIPT~~~~'
vbscript.dll is gone, cscript.exe and wscript.exe stay, and this is what’s left:
C:\> cscript //nologo test.vbs
Input Error: There is no script engine for file extension ".vbs".
That’s exit code 1. wscript //B test.vbs also returns 1, with no message at all, which is exactly how a logon script fails: silently, at every sign-in, on every machine. Put it back with Add-WindowsCapability -Online -Name 'VBSCRIPT~~~~'. That part isn’t quick. It downloads from Windows Update (so it needs a way out to the internet, or a Features on Demand source with -Source), and on my 4 GB lab VM it took 30 minutes while Windows re-checked every Feature on Demand package. Real hardware will be faster, but plan your pilot rollback around minutes, not seconds.
Do this on one test machine before 2027 does it to all of them.
Step 1: find it
On one machine: Event 4096
Windows 11 24H2 and later log a warning when VBScript runs, though not every time. It’s in the Application log, source VBScriptDeprecationAlert, Event ID 4096:
ProcessName = "wscript.exe"
ProcessTree = "wscript.exe;userinit.exe;winlogon.exe"
CallStack = "vbscript.dll+0x6A2F6;vbscript.dll+0x5535F;..."
ProcessTreeEnhanced = "wscript.exe("<path>\WScript.exe" <path>\vbslab-netlogon.vbs);userinit.exe("<path>\userinit.exe");winlogon.exe"
That’s a lot more than most deprecation warnings give you. The process tree tells you how the script started (that one is a logon script run by userinit.exe), and the enhanced tree has the command line. I hit three catches in the lab.
- Every folder is redacted to
<path>. You get the script’s file name, not where it lives. - It’s rate-limited. My GPO logon script ran four times. 4096 recorded it once. The NETLOGON script ran eight times and got five events. Use it to learn that VBScript runs and which script, never as a count.
- It’s written when the script finishes, not when it starts. My GPO logon script hung for two minutes on a printer, so its event showed up two minutes after it started. By then
gpscript.exe, the process that launched it, was long gone, and the tree only showedwscript.exe.
It covers mshta.exe running an .hta too. (The old mshta vbscript:... one-liner didn’t run at all on 25H2, so nothing to log there.)
Filtering on the provider name in Get-WinEvent fails with “The parameter is incorrect”, because the provider has no registered manifest. Filter on the ID and then the provider.
This script lists everything on one machine that runs VBScript or would, and doesn’t change anything. It checks the feature, the 4096 history, scheduled tasks, Run keys (including every signed-in user’s), Startup folders, services and WMI script consumers:
# Find-VbsOnMachine.ps1 - read-only, run as admin, Windows PowerShell 5.1
$hit = '(?i)\b(cscript|wscript|mshta)(\.exe)?\b|\.(vbs|vbe|wsf|hta)\b'
function Out-Hit($where, $what, $detail) { [pscustomobject]@{ Where = $where; What = $what; Detail = $detail } }
Get-WindowsCapability -Online -Name 'VBSCRIPT*' | ForEach-Object { Out-Hit 'Feature' $_.Name $_.State }
Get-WinEvent -FilterHashtable @{ LogName = 'Application'; Id = 4096 } -ErrorAction SilentlyContinue |
Where-Object ProviderName -eq 'VBScriptDeprecationAlert' | ForEach-Object {
$data = @(([xml]$_.ToXml()).Event.EventData.Data)
$proc = ($data | Where-Object { "$_" -like 'ProcessName =*' }) -replace '^ProcessName = "|"$'
$script = [regex]::Match((($data | Where-Object { "$_" -like 'ProcessTreeEnhanced =*' }) -join ''), '[^\\"\s]+\.(vbs|vbe|wsf|hta)').Value
Out-Hit 'Event 4096' "$proc $script" $_.TimeCreated
}
foreach ($t in Get-ScheduledTask) { foreach ($a in @($t.Actions)) {
if ("$($a.Execute) $($a.Arguments)" -match $hit) { Out-Hit 'Scheduled task' "$($t.TaskPath)$($t.TaskName)" "$($a.Execute) $($a.Arguments)" } } }
$keys = 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Run', 'HKLM:\Software\Microsoft\Windows\CurrentVersion\RunOnce',
'HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Run', 'HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\RunOnce'
foreach ($h in Get-ChildItem 'Registry::HKEY_USERS' | Where-Object PSChildName -match '^S-1-5-21-[\d-]+$') {
$keys += "Registry::HKEY_USERS\$($h.PSChildName)\Software\Microsoft\Windows\CurrentVersion\Run"
$keys += "Registry::HKEY_USERS\$($h.PSChildName)\Software\Microsoft\Windows\CurrentVersion\RunOnce" }
foreach ($k in $keys) { $p = Get-ItemProperty $k -ErrorAction SilentlyContinue; if (-not $p) { continue }
foreach ($n in $p.PSObject.Properties | Where-Object Name -notlike 'PS*') { if ("$($n.Value)" -match $hit) { Out-Hit 'Run key' "$k\$($n.Name)" $n.Value } } }
$sh = New-Object -ComObject WScript.Shell
$folders = @("$env:ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp") +
@(Get-ChildItem 'C:\Users' -Directory | ForEach-Object { "$($_.FullName)\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup" })
foreach ($f in $folders | Where-Object { Test-Path $_ }) { foreach ($i in Get-ChildItem $f -File) {
if ($i.Name -match $hit) { Out-Hit 'Startup folder' $i.FullName '' }
elseif ($i.Extension -eq '.lnk') { $l = $sh.CreateShortcut($i.FullName)
if ("$($l.TargetPath) $($l.Arguments)" -match $hit) { Out-Hit 'Startup folder' $i.FullName "$($l.TargetPath) $($l.Arguments)" } } } }
Get-CimInstance Win32_Service | Where-Object { "$($_.PathName)" -match $hit } | ForEach-Object { Out-Hit 'Service' $_.Name $_.PathName }
Get-CimInstance -Namespace root\subscription -ClassName ActiveScriptEventConsumer -ErrorAction SilentlyContinue |
ForEach-Object { Out-Hit 'WMI script consumer' $_.Name $_.ScriptingEngine }
I planted one of each (a scheduled task, a machine Run key, a user Run key, a Startup-folder script and a WMI consumer) and it found all five, and none of them before I planted them. If that last one ever shows up on a real machine, go look at it. An ActiveScriptEventConsumer running VBScript is a classic persistence trick, and legit uses are rare.
Across the domain: SYSVOL, NETLOGON and the user object
There are two ways a logon script reaches a user, and you need to check both:
- A GPO (User Configuration > Windows Settings > Scripts > Logon). The script sits in the GPO’s folder in SYSVOL and
scripts.ini(orpsscripts.inifor PowerShell) points at it. - The user account itself. The Profile tab’s “Logon script” box, which is the
scriptPathattribute. It runs from NETLOGON and predates Group Policy. It’s still everywhere because nobody ever looks at it.
This reads both, plus VBScript launched from Group Policy Preferences (scheduled tasks, shortcuts, files) and batch files in NETLOGON that call cscript. It needs RSAT and any domain account that can read SYSVOL:
# Find-VbsInDomain.ps1 - read-only
Import-Module ActiveDirectory, GroupPolicy
$dom = Get-ADDomain
$sysvol = "\\$($dom.DNSRoot)\SYSVOL\$($dom.DNSRoot)"
$vbsCall = '(?i)\b(cscript|wscript|mshta)(\.exe)?\b|\.(vbs|vbe|wsf|hta)\b'
function Out-Finding($where, $gpo, $scope, $what, $detail) { [pscustomobject]@{ Where = $where; GPO = $gpo; Scope = $scope; What = $what; Detail = $detail } }
foreach ($g in Get-GPO -All) {
$x = [xml](Get-GPOReport -Guid $g.Id -ReportType Xml)
$linked = @($x.GPO.LinksTo | ForEach-Object { "$($_.SOMPath)$(if ($_.Enabled -ne 'true') { ' (link disabled)' })" }) -join '; '
$label = "$($g.DisplayName) [linked: $(if ($linked) { $linked } else { 'nowhere' })]"
$root = "$sysvol\Policies\{$($g.Id)}"
foreach ($half in 'Machine', 'User') { foreach ($ini in 'scripts.ini', 'psscripts.ini') {
$p = "$root\$half\Scripts\$ini"; if (-not (Test-Path -LiteralPath $p)) { continue }
$section = ''
foreach ($line in Get-Content -LiteralPath $p -Encoding Unicode) {
if ($line -match '^\[(\w+)\]') { $section = $Matches[1]; continue }
if ($line -match '^(\d+)CmdLine=(.+)$') { $cmd = $Matches[2]
if ($cmd -match $vbsCall) { Out-Finding 'GPO script' $label "$half $section" $cmd $p } } } } }
Get-ChildItem -LiteralPath $root -Recurse -File -Force -ErrorAction SilentlyContinue | Where-Object Name -match '\.(vbs|vbe|wsf|hta)$' |
ForEach-Object { Out-Finding 'GPO file' $label '' $_.Name $_.FullName }
foreach ($pref in 'ScheduledTasks', 'Shortcuts', 'Files', 'DataSources') {
Get-ChildItem -LiteralPath $root -Recurse -Filter "$pref.xml" -Force -ErrorAction SilentlyContinue | ForEach-Object {
if ((Get-Content -LiteralPath $_.FullName -Raw) -match $vbsCall) { Out-Finding "GPP $pref" $label '' '' $_.FullName } } }
}
Get-ChildItem "\\$($dom.DNSRoot)\NETLOGON" -Recurse -File -ErrorAction SilentlyContinue | ForEach-Object {
if ($_.Name -match '\.(vbs|vbe|wsf|hta)$') { Out-Finding 'NETLOGON file' '' '' $_.Name $_.FullName }
elseif ($_.Extension -in '.bat', '.cmd') { $c = Select-String -LiteralPath $_.FullName -Pattern $vbsCall
if ($c) { Out-Finding 'NETLOGON batch calls VBScript' '' '' $_.Name (($c | ForEach-Object { $_.Line.Trim() }) -join ' | ') } } }
Get-ADUser -LDAPFilter '(scriptPath=*)' -Properties scriptPath | Group-Object scriptPath |
ForEach-Object { Out-Finding 'User scriptPath' '' "$($_.Count) user(s)" $_.Name (($_.Group | Select-Object -First 5).SamAccountName -join ', ') }
Against my lab domain it reports exactly the three things I put there:
Where GPO Scope What
GPO script VBSLab - Legacy Logon Script [linked: corp.contoso.com/VBSLab/Users] User Logon vbslab-logon.vbs
GPO file VBSLab - Legacy Logon Script [linked: corp.contoso.com/VBSLab/Users] vbslab-logon.vbs
NETLOGON file vbslab-netlogon.vbs
User scriptPath 1 user(s) vbslab-netlogon.vbs
Pipe it to Export-Csv and you’ve got the migration list. Check the link state too. If a GPO isn’t linked anywhere, or its link is disabled, nothing’s running it. That one’s a delete, not a migration (back it up first).
In the SIEM: process creation
This is where you find the VBScript nobody wrote down, like installers, vendor tools and that one scheduled task on one server. You need process creation events with command lines. Out of the box, Windows doesn’t log them. Two settings in a GPO linked to your computers turn them on:
- Computer Configuration > Policies > Windows Settings > Security Settings > Advanced Audit Policy Configuration > Audit Policies > Detailed Tracking > Audit Process Creation: Success. That’s Event 4688.
- Computer Configuration > Policies > Administrative Templates > System > Audit Process Creation > Include command line in process creation events: Enabled.
Check a machine picked it up with auditpol /get /subcategory:"Process Creation". If you run Sysmon, Event ID 1 has the same information plus the full parent command line.
The parent process tells you how each one started.
Parent of wscript.exe / cscript.exe | What it means |
|---|---|
gpscript.exe | A GPO logon or startup script. The command line includes the GPO’s GUID |
userinit.exe | The user account’s scriptPath logon script, from NETLOGON |
svchost.exe | A scheduled task (or a service) |
explorer.exe | Somebody double-clicked it |
msiexec.exe | An MSI custom action |
I saw the first two in the lab. The last three are what you’ll see in the wild, and the query sorts them for you.
Here’s the Splunk search I ran against the lab’s Security log. It works without any add-on:
index=main source="WinEventLog:Security" EventCode=4688
(New_Process_Name="*\\cscript.exe" OR New_Process_Name="*\\wscript.exe" OR New_Process_Name="*\\mshta.exe")
| eval user=mvindex(Account_Name, 0)
| eval launched_by=case(
match(Creator_Process_Name, "(?i)\\\\gpscript\.exe$"), "GPO script (gpscript.exe)",
match(Creator_Process_Name, "(?i)\\\\userinit\.exe$"), "AD logon script (scriptPath)",
match(Creator_Process_Name, "(?i)\\\\svchost\.exe$"), "Scheduled task or service",
match(Creator_Process_Name, "(?i)\\\\explorer\.exe$"), "User double-click",
match(Creator_Process_Name, "(?i)\\\\msiexec\.exe$"), "MSI custom action",
true(), "Other: " . Creator_Process_Name)
| rex field=Process_Command_Line "(?i)(?<script>[^\\\\\"]+\.(vbs|vbe|wsf|hta))"
| stats count min(_time) as first_seen max(_time) as last_seen values(user) as users by host launched_by script
| convert ctime(first_seen) ctime(last_seen)
| sort - count

Account_Name is multivalued in 4688 (the subject and the new process’s account), which is why it’s mvindex(..., 0).
Here’s the Sysmon version. My lab had no Sysmon add-on, so it pulls the fields out of the raw XML with rex. With the add-on installed you can drop the rex lines:
index=main sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" "<EventID>1</EventID>"
("cscript.exe" OR "wscript.exe" OR "mshta.exe")
| rex "Name='Image'>(?<Image>[^<]+)<"
| rex "Name='ParentImage'>(?<ParentImage>[^<]+)<"
| rex "Name='CommandLine'>(?<CommandLine>[^<]+)<"
| rex "Name='User'>(?<User>[^<]+)<"
| where match(Image, "(?i)\\\\(cscript|wscript|mshta)\.exe$")
| eval CommandLine=replace(CommandLine, """, "\"")
| stats count max(_time) as last_seen by ParentImage Image User CommandLine
| convert ctime(last_seen)
| sort - count

Sysmon can also tell you when VBScript runs inside something else. Add an ImageLoad rule for vbscript.dll to your config:
<RuleGroup name="" groupRelation="or">
<ImageLoad onmatch="include">
<ImageLoaded condition="end with">\vbscript.dll</ImageLoaded>
</ImageLoad>
</RuleGroup>
Then anything other than cscript.exe or wscript.exe loading it is the interesting part:
index=main sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" "<EventID>7</EventID>" "vbscript.dll"
| rex "Name='Image'>(?<Image>[^<]+)<"
| eval host_kind=if(match(Image, "(?i)\\\\(cscript|wscript)\.exe$"), "script host", "VBScript inside another program")
| stats count by host_kind Image
In the lab that was mshta.exe running an .hta. In a real environment, expect line-of-business apps and installer engines.
And 4096, if you collect the Application log:
index=main source="WinEventLog:Application" SourceName=VBScriptDeprecationAlert EventCode=4096
| rex "ProcessName = \"(?<vbs_host>[^\"]+)\""
| rex "ProcessTree = \"(?<process_tree>[^\"]+)\""
| rex "ProcessTreeEnhanced = \"[^(]+\((?<first_cmd>[^)]*)"
| rex field=first_cmd "(?i)(?<script>[^\\\\ \"]+\.(vbs|vbe|wsf|hta))"
| stats count max(_time) as last_seen values(script) as scripts by host vbs_host process_tree
| convert ctime(last_seen)

Compare that count column with the 4688 one: same scripts, far fewer events. That’s the rate limit.
If you’re on Microsoft Sentinel or Defender, these are the same ideas in KQL. I didn’t have either in the lab, so these are untested. Treat them as a starting point:
// Defender for Endpoint (advanced hunting)
DeviceProcessEvents
| where FileName in~ ("cscript.exe", "wscript.exe", "mshta.exe")
| extend LaunchedBy = case(InitiatingProcessFileName =~ "gpscript.exe", "GPO script",
InitiatingProcessFileName =~ "userinit.exe", "AD logon script (scriptPath)",
InitiatingProcessFileName =~ "svchost.exe", "Scheduled task or service",
InitiatingProcessFileName =~ "explorer.exe", "User double-click",
InitiatingProcessFileName =~ "msiexec.exe", "MSI custom action",
strcat("Other: ", InitiatingProcessFileName))
| summarize Count = count(), LastSeen = max(Timestamp) by DeviceName, LaunchedBy, ProcessCommandLine
// Sentinel, Windows Security Events (4688)
SecurityEvent
| where EventID == 4688 and NewProcessName has_any ("\\cscript.exe", "\\wscript.exe", "\\mshta.exe")
| summarize Count = count(), LastSeen = max(TimeGenerated) by Computer, ParentProcessName, CommandLine
While you’re in there: every other script
The same 4688 data finds every script, not only VBScript. Add cmd.exe, powershell.exe and pwsh.exe to the process list and pull out whatever script file the command line names:
index=main source="WinEventLog:Security" EventCode=4688
(New_Process_Name="*\\cmd.exe" OR New_Process_Name="*\\powershell.exe" OR New_Process_Name="*\\pwsh.exe"
OR New_Process_Name="*\\wscript.exe" OR New_Process_Name="*\\cscript.exe" OR New_Process_Name="*\\mshta.exe")
| rex field=Process_Command_Line "(?i)(?<script>[^\\\\\" ]+\.(bat|cmd|ps1|vbs|vbe|js|jse|wsf|hta))\b"
| where isnotnull(script)
| eval type=lower(replace(script, "^.*\.", ""))
| eval launched_by=case(
match(Creator_Process_Name, "(?i)\\\\gpscript\.exe$"), "GPO script",
match(Creator_Process_Name, "(?i)\\\\userinit\.exe$"), "AD logon script",
match(Creator_Process_Name, "(?i)\\\\svchost\.exe$"), "Scheduled task or service",
match(Creator_Process_Name, "(?i)\\\\explorer\.exe$"), "User double-click",
true(), "Other: " . replace(Creator_Process_Name, "^.*\\\\", ""))
| stats count max(_time) as last_seen dc(host) as hosts by type script launched_by
| convert ctime(last_seen)
| sort type - count

I planted three scheduled tasks on the lab client (a batch file, a PowerShell script and a JScript file), and it found all three. It also found things I didn’t plant: Splunk’s own input wrappers (the .cmd rows under splunkd.exe) and our agent’s watchdog script. You’ll see the same on a real fleet. Your monitoring, backup and management tools fill the first page, so once you know them, filter them out by launched_by or path.
It has one blind spot, and it’s PowerShell. When a script calls another script, the second one runs inside the same powershell.exe and never creates a process, so 4688 never sees it. I tested it with a scheduled task running monthly-maintenance.ps1, which calls cleanup-temp.ps1. 4688 named the first one and had nothing for the second.
Script block logging catches both. Turn on Computer Configuration > Policies > Administrative Templates > Windows Components > Windows PowerShell > Turn on PowerShell Script Block Logging, collect the Microsoft-Windows-PowerShell/Operational channel, and Event 4104 records the path of every script file PowerShell runs:
index=main sourcetype="XmlWinEventLog:Microsoft-Windows-PowerShell/Operational" "<EventID>4104</EventID>"
| rex "Name='Path'>(?<script_path>[^<]+)<"
| where isnotnull(script_path)
| stats count max(_time) as last_seen dc(host) as hosts by script_path
| convert ctime(last_seen)
| sort - count
In the lab that returned both monthly-maintenance.ps1 and cleanup-temp.ps1. Like the Sysmon search, it pulls the field out of the raw XML, so it works without an add-on.
4104 logs the full text of every script block too, not only the path. That’s a lot of data, and any password sitting in a script ends up in your SIEM. Size the index for it, and be careful who can search it.
Reading the Group Policy log
When you start moving things around, the Microsoft-Windows-GroupPolicy/Operational log tells you exactly what ran at sign-in and how long each piece took. From the lab’s GPP sign-in:
17:52:09.577 4016 Starting Group Policy Drive Maps Extension Processing ... VBSLab - Drives, Printer, Settings (GPP)
17:52:18.275 5016 Completed Group Policy Drive Maps Extension Processing in 8687 milliseconds.
17:52:21.863 4016 Starting Group Policy Printers Extension Processing ...
17:52:27.692 5016 Completed Group Policy Printers Extension Processing in 5828 milliseconds.
17:52:28.211 8001 Completed user logon policy processing for CORP\vbslab.user in 21 seconds.
17:52:28.235 4018 Starting Logon script for CORP\vbslab.user.
17:52:33.973 5018 Completed Logon script for CORP\vbslab.user in 5 seconds.
4016/5016 are each client-side extension starting and finishing (with the GPO names and “Changes were detected” or not), 8001 is the whole user policy pass, and 4018/5018 bracket the logon script. When a user says sign-in got slow after your change, this is where you look.
Step 2: delete what Group Policy already does
Here’s the logon script I deployed. You’ve seen this one, or its cousin:
On Error Resume Next
Set objNetwork = CreateObject("WScript.Network")
Set objShell = CreateObject("WScript.Shell")
Set objSysInfo = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://" & objSysInfo.UserName)
MapDrive "P:", "\\DC1\VBSLab-Public"
If IsMember("VBSLab-Finance") Then MapDrive "F:", "\\DC1\VBSLab-Finance"
If IsMember("VBSLab-HR") Then MapDrive "H:", "\\DC1\VBSLab-HR"
objNetwork.AddWindowsPrinterConnection "\\DC1\VBSLab-Printer"
objNetwork.SetDefaultPrinter "\\DC1\VBSLab-Printer"
objShell.RegWrite "HKCU\Software\Contoso\Branch", "Chicago", "REG_SZ"
' ...plus a desktop shortcut, a log file, and the MapDrive / IsMember helpers

Every line of that is a Group Policy Preference.
| VBScript | Group Policy Preferences |
|---|---|
MapNetworkDrive "P:", ... | User Configuration > Preferences > Windows Settings > Drive Maps |
If IsMember("VBSLab-Finance") Then ... | That drive map’s Common > Item-level targeting > Security Group |
AddWindowsPrinterConnection + SetDefaultPrinter | User Configuration > Preferences > Control Panel Settings > Printers > Shared Printer, “Set this printer as the default printer” |
RegWrite "HKCU\..." | User Configuration > Preferences > Windows Settings > Registry |
CreateShortcut(...) | User Configuration > Preferences > Windows Settings > Shortcuts |
I built the GPP version in one GPO, unlinked the old one, and signed in again. Same drives, same printer set as the default, same registry value, same shortcut, and the whole user policy pass took 21 seconds. Use Replace as the action on drive maps and printers so each sign-in puts back what’s supposed to be there.

For reference, the Finance drive map with its group targeting is this in the GPO’s Drives.xml (what GPMC writes when you click through it):
<Drive clsid="{935D1B74-9CB8-4e3c-9914-7DD559B7A417}" name="F:" status="F:" image="2" bypassErrors="1" uid="{...}">
<Properties action="R" thisDrive="NOCHANGE" allDrives="NOCHANGE" userName="" path="\\DC1\VBSLab-Finance"
label="Finance" persistent="0" useLetter="1" letter="F"/>
<Filters>
<FilterGroup bool="AND" not="0" name="CORP\VBSLab-Finance" sid="S-1-5-21-..." userContext="1" primaryGroup="0" localGroup="0"/>
</Filters>
</Drive>
And the same item in the GPO’s settings report, which is what GPMC’s Settings tab shows:

Item-level targeting checks the user’s token, so it also matches nested groups. I put the test user in a new group, VBSLab-Payroll, and made Payroll a member of VBSLab-HR. The GPP drive map targeted at HR mapped H:. The original VBScript, run in the same session, mapped P: and F: and skipped H:, because its objUser.Groups loop only sees groups the user is a direct member of. If your old script ever “randomly” skipped a drive for someone, that might be why.

H: only showed up on the second sign-in after the group change, though. The first one signed in with the cached group list (whoami /groups had Finance and nothing else). Same thing as scriptPath below.
Printers already broke in 2021
The printer line failed in my VBScript run, and it wasn’t VBScript’s fault. The script logged error -2147023673 (0x800704C7, “cancelled”) after sitting for about two minutes. The PrintService Admin log had the real reason, Event 600:
The print spooler failed to import the printer driver that was downloaded from \\DC1\print$\x64\PCC\ntprint.inf_amd64_....cab
into the driver store for driver Generic / Text Only. Error code= 800702e4.
0x800702E4 is “elevation required”. Since the 2021 PrintNightmare fixes, a standard user can’t install a printer driver from a print server, even an inbox driver. (PrintNightmare, the gift that keeps on giving.) Installing the matching inbox driver on the client beforehand didn’t help, because the client still wanted the server’s own package. What fixed it was installing the driver once as an admin, by connecting to the printer as an admin:
# As admin (or SYSTEM from your RMM / Intune), once per machine
Add-Printer -ConnectionName '\\DC1\VBSLab-Printer'
Remove-Printer -Name '\\DC1\VBSLab-Printer' # the driver stays in the store
After that, the same user connected in 1.2 seconds. Whatever replaces your printer logon script, get the drivers onto machines as SYSTEM first, or every replacement will fail the same way.
Two more printer notes from the lab:
- Logon timing. With the driver in place, the VBScript’s printer connection still failed at sign-in with
0x80074005, and the identical script run two and a half minutes later in the same session connected fine. The GPP printer connected at sign-in every time. If a script has to do printers, retry it. - “Let Windows manage my default printer” is on by default (Settings > Bluetooth & devices > Printers & scanners), and it can quietly move the default away from what your script set. The policy to turn it off is User Configuration > Administrative Templates > Control Panel > Printers > Turn off Windows default printer management.

Clearing scriptPath isn’t instant
When I cleared scriptPath on the test user, the next sign-in still ran the old NETLOGON script (userinit.exe launched it, I watched it in 4688). The sign-in after that didn’t. That fits Windows signing in from cached data and catching up in the background. Don’t judge the change by the first sign-in after it.
Step 3: convert the rest
Some scripts aren’t drive maps. For those, you have two good options.
Use an LLM, then audit what it gives you
Paste the script into your LLM of choice and ask for PowerShell. It’ll usually do a good job and still get something wrong. Before you paste:
- Strip the secrets. Old logon and admin scripts are full of hard-coded passwords, service accounts and
net use /user:lines. Don’t send those to a public model. - Say what you want, not just “convert this”. Something like: “Convert this VBScript logon script to Windows PowerShell 5.1. Keep the behavior identical. Read group membership from the logon token, not LDAP. Log every failure to a file instead of swallowing it. List anything you weren’t sure about at the end.”
Then read the output like you’d read a junior’s first script. Mine looked right and mapped every drive and the printer. It also used New-Item -Path 'HKCU:\Software\Contoso' -Force to make sure the key existed, which deletes every value already in that key. My old NETLOGON script had written a value there a second earlier, and it was gone. I reproduced it on its own to be sure:
before: Existing = set by another script
after New-Item -Force: Existing = ''
after Test-Path guard: Existing = 'set by another script'
Use if (-not (Test-Path $key)) { New-Item -Path $key | Out-Null } instead. A test on a clean machine never shows that bug.

Then test it the way it’ll actually run, as a standard user at a real sign-in on a machine that already has the old state, not in an admin PowerShell window.
Or use a converter, and test that too
If you’d rather not paste scripts into an LLM, our free VBScript to PowerShell converter runs entirely in your browser. It converts line by line and keeps VBScript’s semantics (string concatenation, 1-based string functions, On Error Resume Next that actually resumes). It isn’t perfect, and this logon script proved it. (Embarrassingly.)
I ran this exact script through it and deployed the result as the real logon script. It mapped P: and nothing else, with no error. A Finance user would’ve just lost their F: drive one morning and called the help desk.

Running real sign-ins turned up five bugs:
If ok Then MapDrive "F:", "\\server\share"became{ MapDrive "F:"; "\\server\share" }. The comma between the Sub’s two arguments was treated as a statement break, so the Sub got one argument and the path was printed instead.ADSystemInfoproperties. PowerShell can’t read$sysInfo.UserNameon that COM object at all. It throws underSet-StrictModeand is$nullwithout it, so the LDAP bind got an empty name and every group check after it failed. Nearly every old logon script starts with this line. It now reads the property throughInvokeMember.For Each g In objUser.Groupson an ADSI object.Groupsis a method, not a property, so the loop ran zero times. It now calls the method.- The error helper broke on exactly those COM failures. It read a property that’s
$nullfor COM errors, so underSet-StrictModeit threw inside its owncatchand never recorded the error. The script carried on as if everything worked. - An inline
If ... Then Err.Raise ...lost a closing parenthesis, and wasn’t protected by the script’sOn Error Resume Next.
All five are fixed, with tests that run the VBScript and the PowerShell and compare the results. Same script, same sign-in, after the fixes:

It still flags the two If Err.Number <> 0 Then ... : Err.Clear lines for a human, because reading VBScript’s Err object doesn’t translate cleanly. Whatever you use, a converter or an LLM, the output is a first draft until it’s passed a real sign-in.
Doing this across a fleet
The order I’d do it in:
- Turn on process-creation auditing (or Sysmon) and let it collect for a few weeks, so it sees the monthly and quarterly jobs.
- Run the domain audit and the machine audit, and put both into one list.
- Delete everything Group Policy Preferences can do. That’s most logon scripts.
- Convert what’s left, and test each one as a real user at a real sign-in.
- Remove the VBScript feature from a pilot group, watch the 4096 events and your help desk queue, and only then widen it.
Both audits are in RFF’s Script Library. Run VBScript Usage Finder across every Windows device and the job page gives you one line per machine (what’s installed, what launches VBScript, what ran recently). Run VBScript in Group Policy and NETLOGON once, on one domain controller. The converter is free and doesn’t need an account. RFF is free for your first 100 endpoints: getrff.com.
Sources
- Microsoft: VBScript deprecation: Timelines and next steps
- Windows Server Insiders: State of VBScript deprecation, September 2026
- Microsoft: Custom form script is now disabled by default
- Microsoft: KB5005652, Point and Print default behavior change
Comments
Comments use GitHub Discussions, so you'll need a GitHub account to post. Corrections are especially welcome.