SWbemLocator: Access is denied.

Discussion in 'Scripting' started by MFelkins, Dec 1, 2005.

  1. MFelkins

    MFelkins Guest

    Hi,

    I am running a script against several Windows 2003 servers. I am getting
    this error on some of them. (SWbemLocator: Access is denied.)
    error`-2147024891` Access is denied.

    I have full administraor rights on all of these machines.
    '----------------------------------<B>--------------------------------------------------------
    strComputer = "."
    Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator")
    Set objWMIService = SWBemlocator.ConnectServer(strComputer,"\root\CIMV2")

    Any ideas?
     
    MFelkins, Dec 1, 2005
    #1
    1. Advertisements

  2. MFelkins

    SubnetJO Guest

    Use a line like the following:
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

    I suggest to use SWBemlocator only when you want to connect a remote WMI
    server with alternate credentials (different from the logged on users).

    Bye,
    SubnetJO, Italy

    "MFelkins" ha scritto:
     
    SubnetJO, Dec 1, 2005
    #2
    1. Advertisements

  3. You can look on the affected servers (local logged on as admin) in :

    Computer management -> Services Appications -> WMI control

    if you get an error on the General screen, your WMI repository might be
    corrupt :

    try deleting the

    %windir%\system32\wbem\Repository directory (stop WMI service first)
    then start it again, it will rebuild the repository.

    otherwise check the WMI permissions on the security Tab.

    gr /\/\o\/\/
     
    /\\/\\o\\/\\/, Dec 1, 2005
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.