Close Menu
    Facebook X (Twitter) Instagram
    Saturday, October 11
    X (Twitter) LinkedIn Reddit RSS
    All about Endpoint Management
    • Home
    All about Endpoint Management
    Home»SCCM 2007»VBScript SCCM Advertisements targeted to machine

    VBScript SCCM Advertisements targeted to machine

    Eswar KonetiBy Eswar KonetiJune 19, 1:24 pm1 Min Read SCCM 2007 1,298 Views
    Share
    Facebook Twitter LinkedIn Reddit

    was looking at machine to see what advertisements /packages are targeted to sccm client though you can get this information directly from SCCM reports if you have access else wrote a simple script which gives you what packages with program name,Command line used ,ADV ID,Package ID information.

    ON ERROR RESUME NEXT
    Set fso=CreateObject("scripting.filesystemobject")
    'create text file with list of computers what you need
    Set objinputfile=fso.OpenTextFile("computers.txt",1,True)
    'pipe the results into output.txt file
    Set objoutputfile=fso.OpenTextFile("Output.txt",2,True)
    'Read the input file until end of line
    Do While objinputfile.AtEndOfLine <> True
    strcomputer=objinputfile.ReadLine
    objoutputfile.WriteLine(strcomputer)
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\ccm\Policy\Machine")
    Set Colitems = objWMIService.ExecQuery("SELECT * FROM CCM_SoftwareDistribution")
    For Each objItem in colItems
    objoutputfile.WriteLine("-----------------------------------")
    objoutputfile.WriteLine("ADV_AdvertisementID: " & objItem.ADV_AdvertisementID)
    objoutputfile.WriteLine("PKG_Name: " & objItem.PKG_Name)
    objoutputfile.WriteLine("PKG_PackageID: " & objItem.PKG_PackageID)
    next
    Loop
    msgbox("DONE")

    Routine Note: Please change the quotes from the script as blog changes them to Fancy quotes.

    Advertisements configmgr configuration Manager Package ID Packages SCCM SCCM 2007 script sccm advertisements targetted to machine VB script for sccm advertisements avilable
    Share. Twitter LinkedIn Email Facebook Reddit

    Related Posts

    SCCM SQL Report – Compare Installed Apps on TWO Different Computers

    July 13, 10:35 am

    Optimize Your Intune Workflow with a Powerful Browser Extension

    March 22, 10:39 am

    Migrate Microsoft 365 Updates from SCCM/MECM to Intune for Co-Managed Devices

    February 11, 9:50 pm

    2 Comments

    1. sandeep on August 7, 2012 8:09 PM

      Hi,

      I am looking for vb script to create collection in SCCM2012, I am able to do it in Root folder but this needs to be placed in a particular folder under collections..

      Will you be able to help me?

      Thanks in Advance.

      Reply
      • Eswar Koneti on August 8, 2012 6:06 AM

        Have you tried this ? http://myitforum.com/myitforumwp/2011/11/03/configmgr-2012create-dynamic-collection-script/ OR http://www.windows-noob.com/forums/index.php?/topic/2965-vbs-for-creating-collections/

        Reply

    Leave a ReplyCancel reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Sign Up

    Get email notifications for new posts.

    Author

    I’m Eswar Koneti ,a tech enthusiast, security advocate, and your guide to Microsoft Intune and Modern Device Management. My goal? To turn complex tech into actionable insights for a streamlined management experience. Let’s navigate this journey together!

    Support

    Awards

    Archives

    © Copyright 2009-2025 Eswar Koneti, All rights reserved.

    Type above and press Enter to search. Press Esc to cancel.