+ Reply to Thread
Results 1 to 5 of 5

Thread: WMI Filter fails for Windows Vista

  1. #1
    PreviousPoster is offline 100+ Helpful Posts! 50+ Helpful Posts
    Join Date
    Dec 1969
    Posts
    1,254

    Default

    Hi!

    I am trying to create a WMI Filter for a GPO so that it only will apply to Windows Vista Business. This GPO does only one thing and that is to run a login script. The script is very simple and is designed to change the power settings from Power Saver to High Performance.

    Using Scriptomatic I came up with the following filter:

    [code:1]SELECT * FROM Win32_OperatingSystem WHERE Caption = 'Microsoftr Windows VistaT Business' [/code]

    I have tried with double quotes as well, but to no avail. I have also tried using BuildNumber = '6001' and that doesn't seem to work.

    I have essentially the same setup for Windows XP and it is working fine. The script works as expected if I run it from the desktop, but not when I try from a login script. Here are the contents of the script:

    [code:1]strComputer="."
    shellCommand1="POWERCFG -SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c"

    Set oShell=CreateObject("Wscript.Shell"& #41;
    oShell.run "%comspec% /c " & shellCommand1[/code]

    As you can see it is a very simple script and works fine.

    I ran the filter on the WMI Filter Validator from GPOGuy and got this error: “Call was canceled by the message filter. (Exception from HRESULT:0x80010002 (RPC_E_CALL_CANCELED))"

    Can anyone see the reason this WMI filter is not working? Thanks!

  2. #2
    PreviousPoster is offline 100+ Helpful Posts! 50+ Helpful Posts
    Join Date
    Dec 1969
    Posts
    1,254

    Default

    One thing that comes to my mind immediately is the misspelling of "Microsoft" in your query. There is an "r" at the end which should not be there...

  3. #3
    PreviousPoster is offline 100+ Helpful Posts! 50+ Helpful Posts
    Join Date
    Dec 1969
    Posts
    1,254

    Default

    I used the following script to get the caption of the OS.

    [code:1]On Error Resume Next

    Const wbemFlagReturnImmediately = &h10
    Const wbemFlagForwardOnly = &h20

    strComputer = "."

    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
    Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", _
    wbemFlagReturnImmediately + wbemFlagForwardOnly)

    For Each objItem In colItems

    WScript.Echo "Caption: " & objItem.Caption

    Next[/code]

    This is why there is also a T at the end of Vista. As far as I can tell the r is for Registered (R) and the T is for TradeMark (TM).

  4. #4
    PreviousPoster is offline 100+ Helpful Posts! 50+ Helpful Posts
    Join Date
    Dec 1969
    Posts
    1,254

    Default

    Mmh, when I execute your query, I do not see the "R" at the end of "Vista", but the "®".
    I am not sure if this is the problem you are facing, but to overcome this possible issue I tried this query:
    [code:1]Select * FROM Win32_OperatingSystem WHERE caption like '%Vista%Business%'[/code]
    This query works fine for me in a simple vb script and with the validate tool you mentioned I do no get an error.

    Does this work for you as well?

  5. #5
    PreviousPoster is offline 100+ Helpful Posts! 50+ Helpful Posts
    Join Date
    Dec 1969
    Posts
    1,254

    Default

    Interesting....
    When I copy your filter, it still does not work. I get the same error :x

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO