SCCM collection Query - Wrong output

Hi 
We are working on Creating Dynamic SCCM collection which get populated based on following two condition
1) Belongs to a Test OU in AD
2) Doesn't have scom agent installed
We have been trying to work out why following query doesn't populate collection with correct object instead populate by every object that exist in this OU. Seems like condition after AND is totally ignored. is there anything I am doing wrong here
select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_SERVICE on SMS_G_System_SERVICE.ResourceID =
SMS_R_System.ResourceId where SMS_R_System.SystemOUName = "AD.local/Servers/DEV/Test" and SMS_G_System_SERVICE.DisplayName != "Microsoft Monitoring Agent"
Where as below query is working and condition after AND is calculated and collection get populated with right objects.
select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_SERVICE on SMS_G_System_SERVICE.ResourceID =
SMS_R_System.ResourceId where SMS_R_System.SystemOUName = "AD.MONASH.EDU/Managed/Servers/DEV/OCIO/SplunkTest" and SMS_G_System_SERVICE.DisplayName = "Microsoft Monitoring Agent"
We tried with different combination such as "not like", "is null" etc etc. seems to us that as soon as we try have negative criteria after AND that criteria has been ignored.
To my little knowledge of SQL query, condition after AND is not optional and has to meet, if it doesn't query should return no value.
is this same with SCCM collection query? will appreciate if some one can shade some light here.
Thank you in advance. 

Thank you All for the reply
Our End Goal is to be able to automate software/configuration deployment based on criteria we set. SCOM is first of the rank if you like and we want this to be hands off approach so when a server move into certain OU based on criteria server get populated
into SCCM collection and SCCM pushes out software/configuration packages out to the server.
but having said that if we have to create two collection to satisfy our two criteria than most likely we will need number of collections depending on numbers and types of criteria. This will make managing collection and their relationship more challenging
and not sure if that is the path we want to take. This will need to be discussed through unless we find better solution.
Thank you again

Similar Messages

  • SCCM collection query to create ESX host machines

    Hello Everyone
    I am looking SCCM collection query to create  ESX host collection. Any one can share the query to create EST host machines collection please

    For the actual ESXi hosts you can't.
    For host machines, that would be a query for all virtual servers, like this one:
    select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where SMS_R_System.IsVirtualMachine = "True"
    Make sure you limit the above query to servers collection or you can expand it to include servers, like this:
    select SMS_R_System.ResourceId, SMS_R_System.ResourceType, SMS_R_System.Name, SMS_R_System.SMSUniqueIdentifier, SMS_R_System.ResourceDomainORWorkgroup, SMS_R_System.Client from  SMS_R_System inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceId
    = SMS_R_System.ResourceId where SMS_R_System.IsVirtualMachine = "True" and SMS_G_System_OPERATING_SYSTEM.Caption like "%server%"

  • SCCM Collection query to get the Linux machines details

    Hi,
    Can I get the SCCM collection query to create list of Linux  machines . Please help me to get 

    Hi,
    Yes, you can.
    You use collections to manage groups of Linux and UNIX servers in the same way you use collections to manage other client types. Collections can be direct membership collections or query based collections that identify client operating systems, hardware
    configurations, or other details about the client that are stored in the site database. 
    For more information, please review the link below:
    How to Manage Linux and UNIX Clients in Configuration Manager
    http://technet.microsoft.com/en-us/library/jj573941.aspx
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • SCCM Collection query

    Dear,
    I have created collection name it (No iTunes) and add below query to find computer does not have iTunes and in collection Limiting option selected other collection where all computer account stored but this does not apply as need.
    would you please assist.
    Select * from SMS_R_System inner join
    SMS_G_System_Add_REMOVE_PROGRAM on
    SMS_G_System_Add_REMOVE_PROGRAM.ResourceID =
    SMS_R_System.ResourceID where
    SMS_G_System_ADD_Remove_PROGRAM.DIsplayName != “iTunes”
    [email protected]

    select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,
    SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,
    SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client
    from SMS_R_System where SMS_R_System.ResourceId
    not in (SELECT SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID
    FROM SMS_G_System_ADD_REMOVE_PROGRAMS
    WHERE SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName like "itunes%" )
    Keep in mind that this will only find x86 versions of iTunes.
    Garth Jones | My blogs: Enhansoft and
    Old Blog site | Twitter:
    @GarthMJ

  • SCCM Collection Query All Clients where Advertisement not successful

    Hi
    I'm trying to create a collection with a dynamic membership query.
    I want only the clients on which an advertisement status is not successful.
    So I can see on which clients the advertisement didn't not apply.
    When I use this query, I see the clients on which the advertisement was successful:
    select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where SMS_R_System.ResourceId in (select ResourceID from SMS_ClientAdvertisementStatus where AdvertisementID = "BMA20408" and LastStateName = "Succeeded")
    So my idea was to set the != Succeeded
    But then I have no clients in the collection.
    Any Idea how I can solve that?

    Hi,,sorry, but it looks like that I'm too stupid for copy and paste.
    I tried this one:
    select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where SMS_R_SYSTEM.ResourceID not in (select SMS_ClientAdvertismentStatus.ResourceID
    from SMS_ClientAdvertisementStatus where SMS_ClientAdvertisementStatus.AdvertisementID = "P0120EFE" and SMS_ClientAdvertisementStatus.laststatusmessageID in (10021))
    and always, whe I want ot save the script I got the message that there is a mistake. I'm not able to find the mistake - can please anyone help me?
    Regards
    Rolf

  • Need to make collection Query statement by sccm 2012 sp1 for Count of Licenses by License Status

    I want to make collection Query statement by sccm 2012 sp1 for all windows activated and all non-activated windows.
    Ahmed Sherif

    Have a look at the Software Licensing Product attribute classes when creating a Query - remember to choose
    System Ressource when creating the Query. You would have to enable this class to be collected during Hardware Inventory. Go to
    Client Settings -> Hardware Inventory ->
    Set Classes -> Select Software Licensing Product.
    This Class is part of the Asset Intelligence classes so you could enable it from there as well.
    Another way to accomplish is to use Compliance Settings to get this information.
    Create a Configuration item that query the Win32_WindowsProductActivation WMI Class, if you are using XP and the
    SoftwareLicensingProduct class for later os´s
    Add this Configuration Item to a Baseline ad deploy it to your Collections as needed.
    When the Baseline has been evaluated you can use this information to create query
    Machines reported as compliant is actived and machines reported as Non-Compliant is not activated.
    You can read about the Win32_WindowsProductActivation WMI Class here:
    http://msdn.microsoft.com/en-us/library/aa394520(v=vs.85).aspx
    and the SoftwareLicensingProduct here:
    http://msdn.microsoft.com/en-us/library/cc534596(v=vs.85).aspx

  • SCCM 2012 Collection Query

    Hi All,
    I am using SCCM 2012 SP1 with SQL 2008 R2 SP1. I have scenario as below.
    App A is targeted to user based collection as Available (Optional).
    App B needs to be targeted to users who has successfully installed App A as Required(Mandatory).
    Note : As per application behaviour we cannot target App B to machine(Device) based collection, otherwise I would have created a query to pull out all the machines in a collection where App A is successfully installed on base of Add/Remove
    program display name.
    Question : I want to create a user collection query which will pullout last logged on user for all the machines where
    App A is installed successfully, so that I can target App B to this user based collection as Required(Mandatory). In this way if in future any other user is installing App A then that user will also get pulled out automatically to this user
    based collection.
    Its bit urgent for me. Request you please help me to get this query or let me know if there is any other way to achieve this.
    Thanks & Regards Uttam

    Hi Torsten,
    I really have not thought about supersedence but App B is not the upgrade or replacement for App A. If it would then we would have defined the relationship in supersedence. But App A and App B are entirely different applications. Functionality of App B depends
    upon App A, so both has to be there on the machine.
    Only the thing is App B should go to the users who has already installed App A on their machines. For this I would like to create user based collection but confused regarding query. How can we achieve this? I am thinking of to modify the below query
    to pull out last logged on user from the below collection query. I am using SCCM 2012 SP1 with SQL 2008 R2 SP1. How can I modify the below query?
    select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where ResourceId in  (select ResourceId from SMS_G_System_ADD_REMOVE_PROGRAMS
    where DisplayName="App A ARP name" and Version = "1.0.0")
    Thanks & Regards Uttam

  • How to create a group in SCOM 2012 R2 based on SCCM Collection?

    Is there a way to create a group in SCOM 2012 R2 based on sccm collection? I am planning to use that group for maintenance mode.
    Thanks, Samer

    Hi,
    I think you could query all the collectin members from SCCM database then use powershell to add them to a specific OU.
    How to Create Groups in Operations Manager
    http://technet.microsoft.com/en-us/library/hh298605.aspx
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • WRONG OUTPUT

    Hi all,
    i am getting wrong output when executing the below code
    i.e the output is coming regard less of the order number  in select statement.
    Kindly please help me.
    REPORT  ZTEMP2.
    TYPES: BEGIN OF TY_BKPF,
           MONAT TYPE MONAT,
           BUDAT TYPE BUDAT,
           BELNR TYPE BELNR_D,
           GJAHR TYPE GJAHR,
           BUKRS TYPE BUKRS,
    END OF TY_BKPF.
    TYPES: BEGIN OF TY_BSEG,
           BUKRS TYPE BUKRS,
           BELNR TYPE BELNR_D,
           GJAHR TYPE GJAHR,
           HKONT TYPE HKONT,
           WRBTR TYPE WRBTR,
           SGTXT TYPE SGTXT,
           AUFNR TYPE AUFNR,
    END OF TY_BSEG.
    TYPES: BEGIN OF TY_COLL,
           MONAT TYPE MONAT,
           BUDAT TYPE BUDAT,
           BELNR TYPE BELNR_D,
           WRBTR TYPE WRBTR,
           SGTXT TYPE SGTXT,
    END OF TY_COLL.
    DATA: TOT LIKE BSEG-WRBTR.
    DATA: IT_BKPF TYPE TABLE OF TY_BKPF,
          WA_BKPF TYPE TY_BKPF,
          IT_BSEG TYPE TABLE OF TY_BSEG,
          WA_BSEG TYPE TY_BSEG,
          IT_COLL TYPE TABLE OF TY_COLL,
          WA_COLL TYPE TY_COLL.
    SELECTION-SCREEN: BEGIN OF BLOCK B1.
    SELECT-OPTIONS: S_HKONT FOR WA_BSEG-HKONT memory id one,
                    S_AUFNR FOR WA_BSEG-AUFNR memory id twq,
                    S_BELNR FOR WA_BKPF-BELNR memory id twe,
                    S_BUDAT FOR WA_BKPF-BUDAT memory id two.
    SELECTION-SCREEN: END OF BLOCK B1.
    START-OF-SELECTION.
    SELECT MONAT
           BUDAT
           BELNR
           GJAHR
           BUKRS FROM BKPF
           INTO TABLE IT_BKPF
           WHERE BELNR IN S_BELNR
           AND  BUDAT IN S_BUDAT.
    IF NOT IT_BKPF[] IS INITIAL.
      SELECT BUKRS
             BELNR
             GJAHR
             HKONT
             WRBTR
             SGTXT
             AUFNR FROM BSEG
             INTO TABLE IT_BSEG
             FOR ALL ENTRIES IN IT_BKPF
             WHERE HKONT IN S_HKONT
             AND AUFNR IN S_AUFNR
             AND BELNR IN S_BELNR
             AND GJAHR = IT_BKPF-GJAHR
             AND BUKRS = IT_BKPF-BUKRS.
    ENDIF.
    END-OF-SELECTION.
    SORT IT_BKPF BY MONAT.
    SORT IT_BSEG BY HKONT.
    LOOP AT IT_BKPF INTO WA_BKPF.
    Read table IT_BSEG INTO WA_BSEG WITH KEY BUKRS = WA_BKPF-BUKRS
                                             BELNR = WA_BKPF-BELNR
                                             GJAHR = WA_BKPF-GJAHR BINARY SEARCH.
    WA_COLL-BELNR = WA_BKPF-BELNR.
    WA_COLL-BUDAT = WA_BKPF-BUDAT.
    WA_COLL-WRBTR = WA_BSEG-WRBTR.
    WA_COLL-SGTXT = WA_BSEG-SGTXT.
    WA_COLL-MONAT = WA_BKPF-MONAT.
    COLLECT WA_COLL INTO IT_COLL.
    CLEAR: WA_BKPF, WA_BSEG.
    ENDLOOP.
    SORT IT_COLL BY MONAT.
    LOOP AT IT_COLL INTO WA_COLL.
        WRITE:/06 WA_COLL-BELNR,
               22 WA_COLL-BUDAT,
               32 WA_COLL-WRBTR,
               54 WA_COLL-SGTXT.
        AT end of MONAT.
          SUM.
          WRITE:/ WA_COLL-MONAT.
          WRITE:32 WA_COLL-WRBTR.
        ENDAT.
    ENDLOOP.
    Thanks in advance,
    ben2012.

    Hi,
    I tried this way to calculcate opening balance,
    but it is not working kindly suggest me.
    REPORT  ZTEMP1.
    " Types Declaration part
    TYPES: BEGIN OF TY_COLL,
           MONAT TYPE MONAT,
           BUDAT TYPE BUDAT,
           BELNR TYPE BELNR_D,
           WRBTR TYPE WRBTR,
           SGTXT TYPE SGTXT,
           TOT TYPE WRBTR,
    END OF TY_COLL.
    DATA: TOT LIKE BSEG-WRBTR.
    DATA: IT_BKPF TYPE TABLE OF TY_BKPF,
          WA_BKPF TYPE TY_BKPF,
          IT_BSEG TYPE TABLE OF TY_BSEG,
          WA_BSEG TYPE TY_BSEG,
          IT_BKPF1 TYPE TABLE OF TY_BKPF1,
          WA_BKPF1 TYPE TY_BKPF1,
          IT_BSEG1 TYPE TABLE OF TY_BSEG1,
          WA_BSEG1 TYPE TY_BSEG1,
          IT_COLL TYPE TABLE OF TY_COLL,
          WA_COLL TYPE TY_COLL.
    SELECTION-SCREEN: BEGIN OF BLOCK B1.
    SELECT-OPTIONS: S_HKONT FOR WA_BSEG-HKONT memory id one,
                    S_AUFNR FOR WA_BSEG-AUFNR memory id twq,
                    S_BELNR FOR WA_BKPF-BELNR memory id twe,
                    S_BUDAT FOR WA_BKPF-BUDAT memory id two.
    SELECTION-SCREEN: END OF BLOCK B1.
    START-OF-SELECTION.
    PERFORM SELECT1.
    PERFORM OPB.
    END-OF-SELECTION.
    PERFORM P_SELECT1.
    PERFORM P_OPB.
    PERFORM P_COLL.
    *&      Form  SELECT1
    FORM SELECT1 .
    SELECT MONAT
           BUDAT
           BELNR
           GJAHR
           BUKRS FROM BKPF
           INTO TABLE IT_BKPF
           WHERE BELNR IN S_BELNR
           AND  BUDAT IN S_BUDAT.
    IF NOT IT_BKPF[] IS INITIAL.
      SELECT BUKRS
             BELNR
             GJAHR
             HKONT
             WRBTR
             SGTXT
             AUFNR FROM BSEG
             INTO TABLE IT_BSEG
             FOR ALL ENTRIES IN IT_BKPF
             WHERE HKONT IN S_HKONT
             AND AUFNR IN S_AUFNR
             AND BELNR = IT_BKPF-BELNR
             AND GJAHR = IT_BKPF-GJAHR
             AND BUKRS = IT_BKPF-BUKRS.
    ENDIF.
    ENDFORM.                    " SELECT1
    *&      Form  OPB
    FORM OPB .
    SELECT MONAT
           BUDAT
           BELNR
           GJAHR
           BUKRS FROM BKPF
           INTO TABLE IT_BKPF1
           WHERE BELNR IN S_BELNR
           AND  BUDAT < S_BUDAT+3(8).
    IF NOT IT_BKPF1[] IS INITIAL.
      SELECT BUKRS
             BELNR
             GJAHR
             HKONT
             WRBTR
             SGTXT
             AUFNR FROM BSEG
             INTO TABLE IT_BSEG1
             FOR ALL ENTRIES IN IT_BKPF1
             WHERE HKONT IN S_HKONT
             AND AUFNR IN S_AUFNR
             AND BELNR = IT_BKPF1-BELNR
             AND GJAHR = IT_BKPF1-GJAHR
             AND BUKRS = IT_BKPF1-BUKRS.
    ENDIF.
    ENDFORM.                    " OPB
    *&      Form  P_SELECT1
    FORM P_SELECT1 .
    SORT IT_BKPF BY MONAT.
    SORT IT_BSEG BY HKONT.
    LOOP AT IT_BSEG INTO WA_BSEG.
      READ TABLE IT_BKPF INTO WA_BKPF WITH KEY BUKRS = WA_BSEG-BUKRS
                                               BELNR = WA_BSEG-BELNR
                                               GJAHR = WA_BSEG-GJAHR BINARY SEARCH.
    IF sy-subrc EQ 0.
    WA_COLL-BELNR = WA_BKPF-BELNR.
    WA_COLL-BUDAT = WA_BKPF-BUDAT.
    WA_COLL-WRBTR = WA_BSEG-WRBTR.
    WA_COLL-SGTXT = WA_BSEG-SGTXT.
    WA_COLL-MONAT = WA_BKPF-MONAT.
    COLLECT WA_COLL INTO IT_COLL.
    endif.
    CLEAR: WA_BKPF, WA_BSEG.
    ENDLOOP.
    ENDFORM.                    " P_SELECT1
    *&      Form  P_OPB
    FORM P_OPB .
    SORT IT_BKPF1 BY MONAT.
    SORT IT_BSEG1 BY HKONT.
    LOOP AT IT_BSEG1 INTO WA_BSEG1.
      READ TABLE IT_BKPF1 INTO WA_BKPF1 WITH KEY BUKRS = WA_BSEG1-BUKRS
                                                 BELNR = WA_BSEG1-BELNR
                                                 GJAHR = WA_BSEG1-GJAHR BINARY SEARCH.
    IF sy-subrc EQ 0.
    WA_COLL-TOT = WA_BSEG1-WRBTR.
    COLLECT WA_COLL INTO IT_COLL.
    endif.
    CLEAR: WA_BKPF1, WA_BSEG1.
    ENDLOOP.
    ENDFORM.                    " P_OPB
    *&      Form  P_COLL
    FORM P_COLL .
    SORT IT_COLL BY MONAT.
    LOOP AT IT_COLL INTO WA_COLL.
        WRITE:/06 WA_COLL-BELNR,
               22 WA_COLL-BUDAT,
               32 WA_COLL-WRBTR,
               54 WA_COLL-SGTXT.
        AT end of MONAT.
          SUM.
          WRITE:/ WA_COLL-MONAT.
          WRITE:32 WA_COLL-WRBTR.
          WRITE: WA_COLL-TOT.  " getting value 0
        ENDAT.
    ENDLOOP.
    ENDFORM.                    " P_COLL

  • SCCM Custom Query

    Hello,
    I am looking for a 2007 SCCM custom query that will look for KB2964358 installed. My trouble lies when I specify the below query to see if an update is installed, and it only returns XP computers since it is looking for the ADD Remove Programs feature.
    ConfigMgr is not collecting the list of Software Updates (patches) for Window 7/Vista/ 2008/ 2008 Core operating systems. Because, on these operating systems this information is stored
    in “Win32_QuickFixEngineering”  WMI class (it’s not listed in Add Remove Programs) and the inventory of this class is NOT enabled in SMS_DEF.MOF (by def ault). Hence ConfigMgr. report won’t be able to provide these details unless and until you’ve enabled
    the appropriate WMI class in SMS_DEF.MOF. Is there any other way to look for an update installed in custom queries that will return Windows 7 machines as well?
    SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_ADD_REMOVE_PROGRAMS on SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID
    = SMS_R_System.ResourceId where SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName like "%KB2964358%"

    Hi,
    take a look at the article below to extend the SMS_DEF.mof file to include the WMI class.
    http://technet.microsoft.com/en-us/library/cc180866.aspx
    Blog: http://theinfraguys.com
    Follow me at Facebook
    The Infra Guys Facebook Page
    Please remember to click Mark as Answer on the answer if it helps you in anyway

  • Collection query to get the Linux machines details

     Hi,
    Can I get the collection query to create list of Linux  machines . Please help me to get 

    Hello, I think, you are asking about SCCM collections !??? if yes, kindly post your query no SCCM forums.
    if not, please elaborate your question?
    Devaraj G | Technical solution architect

  • Work Flow of Collection query

    Hi
    Can anyone tell me the flow of how collection query works. How it fetches the data from Active directory . Example
    I have written a query to collect systems from organization Unit in Active directory. I have enabled System discovery. I'm able to view the systems in sccm console.  How the flow happens over here.
    Thanks in Advance

    Collection queries do not retrieve anything from AD, they simply query the DB.
    The information in the DB can come from a variety of locations however. AD information in the DB is generally populated by AD Discovery although certain things like OU are also populated by Heartbeat Discovery (aka the data discovery cycle on a client).
    Thus, the flow is essentially, AD to DB.
    Jason | http://blog.configmgrftw.com

  • Collection query

    Dear Exprt,
    I have create collection and trying to add below query base of advertisement succeeded but i receive syntax error
    select sys.ResourceID,sys.ResourceType,sys.Name,sys.SMSUniqueIdentifier,sys.ResourceDomainORWorkgroup,sys.Client from sms_r_system as sys inner join SMS_ClientAdvertisementStatus as offer on sys.ResourceID=offer.ResourceID 
    WHERE AdvertisementID = ‘A0120005′ and LastStateName = ‘Succeeded’
    would you please assist
    [email protected]

    Try this
    select SMS_R_System.ResourceID,SMS_R_System.ResourceType,SMS_R_System.Name,SMS_R_System.SMSUniqueIdentifier,SMS_R_System.ResourceDomainORWorkgroup,SMS_R_System.Client from SMS_ClientAdvertisementStatus join SMS_R_System on SMS_R_System.ResourceID = SMS_ClientAdvertisementStatus.ResourceID
    where SMS_ClientAdvertisementStatus.AdvertisementID in('A0120005') and SMS_ClientAdvertisementStatus.LastStateName In('Succeeded')
    http://www.mssccm.com/sccm-collections/collection-query-based-advertisement-last-staus/
    Narahari(Hurry) Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”

  • Spool file problem,Can't see the query in output file.

    Hello ,
    I am facing a very old school kind of problem .....about spool file ....
    The scenario -
    I have made a script by name DB_Status_checkup.sql which i want to fire on the database to check the database status. In this script their are many queries regarding the data dictionary views to know about the database. It consist of nearly 25-30 different select queries..
    The problem is i want to make a spool file of the output of that query....i want to see the SQL query & the output below in the spool file, so it will be easy for me to judge the result. But i can't see the SQL query , i can only see the output , & in so many queries it all gets jumbled up....even i can't understand where the next output starts ...
    Sample of my SQL Script ....
    clear buffer
    spool D:\DB_status.txt
    /*To check the database startup time*/
    Select to_char(startup_time, 'HH24:MI DD-MON-YY') "Startup time"
    from v$instance
    .........next query n so on....
    spool off;
    In the output pf the spool file at D:\db_status.txt..
    Startup time
    08:25 16-JUL-10It shows only the output of the query in the spool file not the query,
    What should i do to get the SQL query as well as the output of that query just below it in the spool file ???
    Please suggest if you have anymore ideas , regarding this .....
    ORACLE 10g R2
    Windows Server 2008
    Thanks in advance ...

    Why don't you just use database control, instead of re-inventing the wheel?
    Apart from that, SQL*Plus has it's own reference manual, which you apparently refuse to read.
    The answer to your quiz/doc question is
    set echo on
    Sybrand Bakker
    Senior Oracle DBA

  • IN NEED OF A SCCM 2012 QUERY THAT SHOWS LAST TIME SOFTWARE WAS USED OR OPENED

    Hello
    I am in need of an SCCM 2012 query that shows PCs that have Visio , Adobe Professional and Visual Studio and the last time each was used or opened. I have the query below which give me the PC name and the product. Any assistance will be very helpful
    select distinct SMS_R_System.NetbiosName, SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName from SMS_R_System inner join SMS_G_System_ADD_REMOVE_PROGRAMS on SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId where SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName
    like "%adobe acrobat%pro%"
    select distinct SMS_R_System.NetbiosName, SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName from SMS_R_System inner join SMS_G_System_ADD_REMOVE_PROGRAMS on SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId where SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName
    like "%visio%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%viewer%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%service pack%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%security
    update%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%hydra%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%update%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%MUI%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName
    not like "%amd%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%microsoft visio%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%vision%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%add-in%"
    select distinct SMS_R_System.NetbiosName, SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName from SMS_R_System inner join SMS_G_System_ADD_REMOVE_PROGRAMS on SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId where SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName
    = "Microsoft Visual studio 2012 devenv" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%hotfix%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%security%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName
    not like "%update%" and SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName not like "%service%"

    Did you create a software metering rule for each software title? if not then you need you do that first and it will take over a week before you see results.
    Also keep in mind that your query will only find x86 software titles.
    http://www.enhansoft.com/

Maybe you are looking for