3

In Windows RT on a Surface tablet, I'm running a VB script that fails on the first line which is:

Set WshShell = WScript.CreateObject("WScript.Shell")

The error message says:

Could not create object WScript.Shell with the error code: 80070005

This seems to be a generic error code having to do with access permissions. Any ideas?

I am running with admin privileges.

jwarnick
  • 31
  • 3

2 Answers2

1

Windows RT (also known as Windows 8 RT, Windows 8.1 RT, and Surface RT) uses User Mode Code Integrity (UMCI) to restrict the software that is allowed to run.

In the case of VBScript, the Code Integrity component of UMCI only allows creation of "enlightened" COM objects.

"Which COM objects are enlightened?" you ask. Good question. Let's use PowerShell on our Windows RT device to help us find out.

$arrInstances = @(Get-WMIObject -ClassName 'Win32_COMSetting')
$arrCOMObjectProgIDs = @($arrInstances | Where-Object { $null -ne $_.ProgId } |
    ForEach-Object { $_.ProgId })

$ErrorActionPreference = [System.Management.Automation.ActionPreference]::SilentlyContinue
$result = @($arrCOMObjectProgIDs | ForEach-Object { if (New-Object -ComObject $_) { $_ } })
$result

On my fully-patched Surface 2 device, as of today, 2021-Jan-17, the only enlightened COM objects with a ProgID (i.e., the only ones callable from VBScript on Windows RT) are:

  • Scripting.FileSystemObject
  • VBScript.RegExp
  • Scripting.Dictionary

It is not possible to create other VBScript objects (e.g., WScript.Shell, WScript.Network, WinNTSystemInfo, Wbemscripting.SWbemLocator, etc.) on Windows RT due to User Mode Code Integrity (UMCI).

For a more-robust version of the above code, check out my script "Get-COMObjectsProgIDsAllowedToLaunch.ps1" posted to my GitHub repo: https://github.com/franklesniak/PowerShell_Resources

Frank Lesniak
  • 560
  • 1
  • 5
  • 18
0

I've seen in a few places people commenting that RT doesn't allow VBScript to run WScript.Shell, though I've not found any official documentation to that effect.

It may just be that the script needs to run with Admin privileges.

AnonJr
  • 2,759
  • 1
  • 26
  • 39
  • I am running with admin privileges. – jwarnick Oct 02 '13 at 19:17
  • @user2839815 not having an RT device available to me I can only speculate that it may not be possible. I've found nothing but conflicting information on getting that particular command to work/or not to work, and no hard leads from MSDN or other more "official" sources. – AnonJr Oct 02 '13 at 19:44
  • I'm beginning to think the same thing. Thanks for searching around. – jwarnick Oct 02 '13 at 21:12
  • 1
    Windows RT uses User Mode Code Integrity (UMCI), which is the feature that is prevents VBScript from creating WScript.Shell and many more objects. – Frank Lesniak Jan 17 '21 at 05:12