Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6208537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:49:33+00:00 2026-05-24T05:49:33+00:00

This script is getting Microsoft JScript runtime error: Object expected on If (out_params.bGranted) line.

  • 0

This script is getting Microsoft JScript runtime error: Object expected on If (out_params.bGranted) line. It seems like this is related to a syntax error, but I can’t find it. This code, in its current form, was basically copied from Invoking functions with `out` arguments, passing arguments by reference in JScript.

function main()
{
    var provider_name = "StdRegProv";
    var func_name = "CheckAccess";

    var services = GetObject("winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\default"); // connect to WMI
    var registry = services.Get(provider_name); // get provider

    var in_params = registry.Methods_(func_name).InParameters.SpawnInstance_();
    in_params.hDefKey = 0x80000001;
    in_params.sSubKeyName = "Software\\Microsoft\\Shared Tools\\Proofing Tools\\1.0\\Override";
    in_params.uRequired = 65536;

    var out_params = services.ExecMethod(provider_name, func_name, in_params);

    If (out_params.bGranted)
    {
        WScript.Echo("Has DELETE Access Rights on HKCU " + strKeyPath);
        registry.DeleteKey (HKCU, strKeyPath);
    }
    Else
    {
        WScript.Echo("No DELETE Access Rights on HKCU " + strKeyPath);
    }
}

main();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T05:49:34+00:00Added an answer on May 24, 2026 at 5:49 am

    In JScript, keywords (and identifiers) are case-sensitive, so you cannot use If instead of if, Elseinstead of else, and so on.

    In your example the script engine interprets If (out_params.bGranted) as a function call, which results in a runtime error since you obviously did not defined an If function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This issue is that i am getting the error, Microsoft JScript runtime error: Object
We're getting this error once a day on a script that runs every two
I am getting an error when running this classic asp script: Dim DB_CONNECTIONSTRING, rs,
i'm getting dialogue box (Operation aborted) What is the problem in this code? <script
For this script, it checks to see if the file is a microsoft words
I am trying to use jGrowl in ASP.NET, but am getting a Microsoft JScript
When I executed the following script, I am getting the following error. What should
Im trying to work with following code i getting this error at xsltProcessor.importStylesheet Error
I have a powershell script (below) which seems to work but prints an error
Having some problems with getting some ajax script to work. Using this as the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.