Eswar Koneti's Blog

All about Configmgr and its connected objects…….

  • About Author
      View eswar koneti's LinkedIn profile
  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 106 other subscribers

  • Awards


  • FaceBook Updates

  • Catagories

  • Meta

  • Copyright!

    All the blog posts in this website are owned by Eswar Koneti and may not be reused in any mode without prior approval of Eswar Koneti. You may quote one paragraph from the blog posts if you link to the original blog post.
    Happy Reading!

VBScript SCCM Advertisements targeted to machine

Posted by Eswar Koneti on June 19th, 2012

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.

2 Responses to “VBScript SCCM Advertisements targeted to machine”

  1. sandeep Says:

    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.

  2. Eswar Koneti Says:

    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/

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>