I am using VBScript to interact with WMI and check whether any print jobs are outstanding. When I run the query using VBScript I get the following error:
I've used the code on other machines and it works correctly. The code I'm using is:
Set objWMIService = GetObject("winmgmts: {impersonationlevel=impersonate}!\\.\root\cimv2")
Set colPrintJobs = objWMIService.ExecQuery("SELECT * FROM Win32_PrintJob")
Unsure about how to proceed as I'm confident it's not actually a syntax error but rather something that's wrong with WMI. WMI looks to be OK but I could be missing something. Any help would be appreciated!
OS - Windows 10 Enterprise, Version 20H2

Turns out the issue was being caused by an issue with 32-bit WMI. I ran the script using 64-bit wscript and it worked fine.