VBScript is scheduled for deprecation! So?


Feuer

Fatal Error
Power User
VIP
Local time
11:36 AM
Posts
311
Location
Türkiye
OS
Windows 11 25H2 Home Single Language (26200.8037)
VBScript is scheduled for deprecation!
What will happen next?

I use VBScript mainly for ;

- Starting scripts in hidden mode (No CMD Window)
- Starting scripts as administrator
- Starting apps as administrator

It was very fast.
It was very useful especially with using Task Scheduler.

This deprecation will negatively impact my computer usage.

I have some ideas for how to handle these tasks. What are your thoughts on these processes?
 

My Computer

System One

  • OS
    Windows 11 25H2 Home Single Language (26200.8037)
    Computer type
    Laptop
    Manufacturer/Model
    LENOVO IdeaPad 5 15ITL05
    CPU
    Intel Core i3-1115G4
    Motherboard
    There is no such a God, I only know mother-Earth
    Memory
    8GB
    Graphics Card(s)
    on-board
    Sound Card
    on-board
    Monitor(s) Displays
    (s) is too ambitious for me
    Screen Resolution
    1920*1080
    Hard Drives
    256GB (SSD)
    PSU
    I was very young when I last saw a PSU
    Case
    ...
    Cooling
    My coldness is enough to cool the computer
    Keyboard
    A broken and very clean keyboard
    Mouse
    Rat
    Internet Speed
    Slowest internet connection in Europe
    Browser
    ChromePortable / FirefoxPortable / TorBrowser
    Antivirus
    G-Virus
    Other Info
    I can simply say that I took the red pill and I am not happy with it.
- Starting scripts in hidden mode (No CMD Window)

Hackers have been doing this for a few years now.
Code:
conhost --headless cmd /c script.bat
conhost --headless powershell -ep bypass -f script.ps1

- Starting scripts as administrator
- Starting apps as administrator
PowerShell or cmdt
GitHub - wesmar/CmdT: The world's smallest TrustedInstaller launcher ~20KB of pure x64/x86 assembly. Hybrid CLI/GUI in one binary. Full NT privilege elevation (34 privileges), token caching, .lnk resolution via COM, drag-and-drop with UIPI bypass. Zero CRT dependency.

It was very fast.
It was very useful especially with using Task Scheduler.
It is very insecure.
 

My Computer

System One

  • OS
    Windows 7
If you're not distributing your code, you don't have to change anything. VBScript will remain available to install via Optional Features in the same way you can install other old stuff such as SMB 1.

You can slso convert VBScript code to JScript and it will work exactly the same. ChatGPT or Copilot can be used to convert your scripts.


Also possibly useful:
 
Last edited:

My Computer

System One

  • OS
    Windows 10/11
    Computer type
    Laptop
    Manufacturer/Model
    Acer
It is very insecure
More insecure than batch or PS scripts?

I store all my batch, PS & VBS scripts in a folder where they can be run but they can only be edited with Admin permission. Doesn't this counter the insecurity of all three types of script?


Denis
 

My Computer

System One

  • OS
    Windows 11 Home x64 Version 25H2 Build 26200.8037
Historically, VBS and JS got a bad reputation and a lot of legacy security guides instruct you to disable them. Let's face it, all the bad actors have moved to PS after it became universal with W10.

But it's harder to ban PS, unlike VBS & JS -- where most of the active devs have aged out of the Windows scene. So MS is in a position to deprecate VBS.
 

My Computer

System One

  • OS
    Windows 7
I had a little VBS to allow a batch file to run minimised from task scheduler. After seeing deprecation warning events start recently I changed to a PowerShell command - a single command rather than a PowerShell script and the permissions that involves. But I've also spotted another deprecation warning event - possibly after running the performance monitor in MMC which I'd assumed was a Windows tool.
 

My Computer

System One

  • OS
    Windows 11
In general, the primary security issue with scripts are malicious email attachments that a user is tricked into opening. In some cases the script is embedded in another file type, such as a PDF. Your personal scripts are of no concern.

If VBScript files can't be run at all, you're machine is a bit more secure from such attacks. The bad actors can still use other script languages, such as JScript, but there's overall a smaller attack surface.

As usual, your best defense is what's between your ears.
 

My Computer

System One

  • OS
    Windows 10/11
    Computer type
    Laptop
    Manufacturer/Model
    Acer
I had a little VBS to allow a batch file to run minimised from task scheduler. After seeing deprecation warning events start recently I changed to a PowerShell command

I use VBS for this job as well.
Please would you post a sample of your PS equivalent.
My attempt to write a PS equivalent could not get rid of a momentary flash of a PS window [after which my desired batch script would run minimised].


Denis
 

My Computer

System One

  • OS
    Windows 11 Home x64 Version 25H2 Build 26200.8037
an exe (see my previous post

Les,

Unfortunately, I am not trying to get scripts to run hidden.
I use VBS to run scripts [from TS] minimised with an icon of my choosing appearing on the Taskbar just as I might when running them directly from a shortcut.
[My VBS intermediaries are started by TS & just run shortcuts to the target scripts that set the minimised window & the icon. I have dozens of these VBS intermediaries.]
I tested a PS equivalent to be run from TS. That had the momentary flash that I find distracting.
I'll have to look into JS equivalents. I know nothing about JScript other than that it exists and that I have lots of JScript examples in my old VBS Help file
[Copies can still be downloaded from VBS Help v5.6 [2001] but not from MS].
[The only shortcoming I have found with this old Help file is that it omits the ShellExecute command - ShellExecute - SS64, ShellExecute - MSLearn.]
I also tested the use of NirCmd as the intermediary between TS & a script. My notes say that I succeeded but this thread made me look again:-
- I can get TS to run the script minimised as I want.
- But I lose the chosen icon. I cannot now see how it ever succeeded. I'll have to investigate this all over again.

I appreciate that I have years, perhaps even decades, to get this right because I'll be able to add VBS back in to future Windows 11 versions for quite some time to come.


All the best,
Denis
 
Last edited:

My Computer

System One

  • OS
    Windows 11 Home x64 Version 25H2 Build 26200.8037
You can't get rid of the console flash using PS alone. Use JScript or an exe (see my previous post).
That's why all hackers use "conhost --headless" as a command wrapper. There is no onscreen flash to execute a batch or PS script. None. No more playing with screen minimize (which doesn't hide the flash).

One drawback is because you're not in a normal console context, redirection of stdout/stderr is broken. It can be done, but it's like tearing out your eyes. AveYo even filed a bug against the Windows Terminal team (conhost now falls under their control).

If you don't need console redirection, it's a perfect replacement for "invisible VBS" scripts.
 

My Computer

System One

  • OS
    Windows 7
Hackers have been doing this for a few years now.
conhost --headless cmd /c script.bat conhost --headless powershell -ep bypass -f script.ps1

Yes, sorry. I'll also be looking at this.
I use TS to run a VBS that runs a batch file that runs a shortcut to the real target script so it runs minimised with my chosen icon.
I'll play with your conhost suggestion to see if I can
use TS to run a conhost headless command that runs a batch file that runs a shortcut to the real target script so it runs minimised with my chosen icon.


Thanks for posting again about it,
Denis
 

My Computer

System One

  • OS
    Windows 11 Home x64 Version 25H2 Build 26200.8037
If you use JScript you'll retain the console redirection. JScript is a drop in replacement for VBScript. ChatGPT will easily convert your scripts.
 

My Computer

System One

  • OS
    Windows 10/11
    Computer type
    Laptop
    Manufacturer/Model
    Acer
ChatGPT will easily convert your scripts.
I've used online AI*** to suggest some short VBA scripts recently and not a single one of them could run.
*** Generally using DuckDuckGo's AI but I've also used Bing sometimes.

Since I'm armed with so many JScript examples in my 'VBS' Help file I'll bite the bullet and study it [which is generally how I learnt VBS in the first place].
This one of my VBS intermediaries is typical - it's a one-liner.
Step 1 - TS runs StartCoreFilesBackup.vbs every hour.
CreateObject("WScript.Shell").Run chr(34) & "C:\Tools\Backup\CoreFiles\CoreFilesBackup.lnk" & Chr(34), 7
Step 2 - Then all that CoreFilesBackup.lnk does is set its target script, CoreFilesBackup.bat, to run minimised with my chosen icon.


Thanks,
Denis
 

My Computer

System One

  • OS
    Windows 11 Home x64 Version 25H2 Build 26200.8037
I can see how VBA would be a tricky one for AI.

Short VBS scripts are very easy to translate to JScript. To be sure the context is correct, tell the AI to translate the code to "Microsoft JScript".

Post an example you'd like to translate and I'll run it through both ChatGPT and GitHub Copilot (results should be the same).
 

My Computer

System One

  • OS
    Windows 10/11
    Computer type
    Laptop
    Manufacturer/Model
    Acer
I use VBS to run scripts [from TS] minimised with an icon of my choosing appearing on the Taskbar just as I might when running them directly from a shortcut.
[My VBS intermediaries are started by TS & just run shortcuts to the target scripts that set the minimised window & the icon. I have dozens of these VBS intermediaries.]
I tested a PS equivalent to be run from TS. That had the momentary flash that I find distracting.

I think you only need one script that takes a command line argument (i.e. the path of the shortcut).

I successfully tested this JScript script via Task Scheduler:

RunThis.js
JavaScript:
var oWSH = new ActiveXObject("WScript.Shell");
var path = WScript.Arguments(0);
oWSH.Run('"' + path + '"', 7);
 

My Computer

System One

  • OS
    Windows 10/11
    Computer type
    Laptop
    Manufacturer/Model
    Acer
I think you only need one script that takes a command line argument (i.e. the path of the shortcut).

I successfully tested this JScript script via Task Scheduler:

RunThis.js
JavaScript:
var oWSH = new ActiveXObject("WScript.Shell");
var path = WScript.Arguments(0);
oWSH.Run('"' + path + '"', 7);
Thank you @LesFerch! 🙏

I replaced my RunMinimized.vbs file with your JavaScript code and it was a perfect replacement!

Thanks so very, very much!!! :clap:
 

My Computer

System One

  • OS
    Windows 11 Pro
    Computer type
    Laptop
    Manufacturer/Model
    Microsoft Surface Laptop Studio
    Memory
    32GB
    Hard Drives
    1TB
Please would you post a sample Task scheduler Argument entry.
Prog is, I assume,
c:\windows\system32\cscript.exe
Argument might be something like
"D:\Desktop\JScript-Intermediary-TestedOK\Test-JScript.js" "D:\Desktop\JScript-Intermediary-TestedOK\TakeAScreenshot.bat - 5.lnk"
[Path to the JScript then Path to the shortcut]

I've tested the jscript with its shortcut & its batch file manually/directly but cannot get the TS entry right.
I started using vbs all those years ago to avoid trying to get TS to run lnk files because they didn't play ball [run minimised with my chosen icon without any flash of a window outline].


Denis
 
Last edited:

My Computer

System One

  • OS
    Windows 11 Home x64 Version 25H2 Build 26200.8037
I use VBS for this job as well.
Please would you post a sample of your PS equivalent.
My attempt to write a PS equivalent could not get rid of a momentary flash of a PS window [after which my desired batch script would run minimised].


Denis
My previous vbs script to run minimised contained
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 2, False
which was called from the task scheduler action with a batch_file_to_run

I changed this to-
Program/script:
conhost.exe
and Add arguments:
--headless powershell -WindowStyle hidden -command "&{Start-Process 'batch_file_to_run' -WindowStyle Hidden}"
I'm assuming WindowStyle can affect whether it's just minimised or is invisible etc
 

My Computer

System One

  • OS
    Windows 11
Thanks.

Batch target script example
My argument was
--headless powershell -WindowStyle hidden -command "&{Start-Process 'D:\Desktop\JScript-Intermediary-TestedOK\TakeAScreenshot.bat - 5.lnk' -WindowStyle Minimized}"
and the batch script ran successfully whilst minimised to my Taskbar and displaying my chosen icon.
TakeAScreenshot 5.webp

I've tested it in both Windows 10 & Windows 11.

Added the next day -

Powershell target script example
I have now tested the conhost method on a PS script triggered from TS.
prog
conhost.exe
argument
--headless powershell -WindowStyle hidden -command "&{Start-Process 'C:\Tools\System\Touchscreen\ToggleTouhscreen.lnk' -WindowStyle Hidden}"
- The test script toggles my touchscreen on / off.
- I just set the TS task up as a standard current user one i.e. without taking any Admin measures.
- The shortcut shown in the argument line is set to demand Admin approval [set the normal way in its properties].
- I ran the TS task, the Admin prompt came up for me to approve in the normal way then the script ran correctly.
[I've only just noticed the spelling mistake in the shortcut name which it inherited from the spelling mistake in the ps1 file's name.]

@jak22 @garlin @LesFerch @Feuer
I've added this to yesterday's post to keep my bat & ps1 examples together.

From now on, as I review any of my TS-triggered scripts, I will convert them over to this conhost method.


Denis
 
Last edited:

My Computer

System One

  • OS
    Windows 11 Home x64 Version 25H2 Build 26200.8037

Latest Support Threads

Back
Top Bottom