Ask a questionAsk a question
 

QuestionScript to execute non mandatory assignments?

  • Wednesday, October 07, 2009 3:58 PMWilliam Bracken Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I am looking to create a script that would query the list of non mandatory assignments that are pending and execute them one by one.  Taking into consideration that the code might not be downloaded yet so I assume I would need to check and if needed make a content request prior to execution.  Anyone have anything like this yet?

    Thanks!

All Replies

  • Thursday, October 08, 2009 12:16 AMDan.Dufus Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hey man,

    If you haven't already, grab the ConfigMgr SDK and check out the Client Programming\Client Automation chapters. There are two items you will specifically be interested in..

    How to Run a Program on a Configuration Manager Client
    How to View Available Programs on a Configuration Manager Client

    They should get you started. What language are you using? I'm at the tail end of a 2 week project to replace the Run Advertised Programs GUI. Im using C# and have got most of it working so if you have any questions just let me know.

    peace,

    -Dan

  • Thursday, October 08, 2009 2:08 PMWilliam Bracken Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks Dan.  I will check the SDK for the sections your referring to.  I am currently using mostly VBScript but am not apposed to Powershell but finding good SDK type examples for Powershell seems pretty scarce.  I know squat about C# unfortunately.  :-(  I here a lot of people replacing the GUI for RAP.  Would love to see some screen shots and details on what your doing and how it improves the end user experience.  I have thought about something like that for my envirnment just havent had the cycles to get started.  But would love to see what others are doing.  Anyone making theirs portable for other to use or at least bastardize for their own environment?  :-)

    Thanks!
  • Friday, October 09, 2009 2:43 AMDan.Dufus Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    No problems. I also know squat about C# haha. Luckily I work at a place with a healthy number of developers who are willing to run me through stuff when I get stuck. I'm almost done with mine, its not as clean or pretty as it would be from someone who's a pro but it will get the job done.

    The main features it has are:

    It returns a status Succeeded/Failed as soon as the install completes without having to press F5 (as if a user is going to know to do that)
    It adds a backcolour to the status cell as a nice visual indicator green/red success/fail etc
    When the user clicks the run button to indicate something is happening a marquee progress bar appears and scrolls until completion. Same theory as the blinking curser back in the DOS days I guess.

    I was going to add screenshots but I can't add them in this forum :p If you know a free easy site I can drop them on I'll do that.

    Once I clean it up a bit Ill zip it up and make it available somewhere you're most welcome to use it as a framework. C# is really easy anyway it basically writes itself.

    -Dan

  • Tuesday, October 13, 2009 12:35 AMDan.Dufus Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hey man,

    Finally finished up most of it. You can grab the project source here (The built release exe is in there if u dont want to compile, just drill down to bin\release):

    http://www.mediafire.com/?sharekey=23ec45cb5d61961b8d78a0e555291609e04e75f6e8ebb871

    Current bugs/unhappy things:

    Doesn't have single instance detection so someone can run multiple apps and probably break something if they really want to..
    Win7 (and I assume Vista) thinks its a software install and the Program Compatibility Assistant keeps asking stuff when u close it
    There's a strange issue im having on someone win7 x64 system with one particular application when it doesnt return the status unless you F5 it, but I think its that specific app, others work fine.

    Happy things:

    Refresh (F5) works, changes to the blue circular wait cursor while its refreshing. (The main focus for me was making the user aware when something is happening and when it has finished)
    Green/Red backcolour with Succeeded/Failed status (Status appears as soon as app has finished, no need to F5)
    Run button is disabled as soon as the user launches something to prevent the inevitable multi-click 'its not doing anything' scenario
    Scrolling marquee progress bar indicates 'something' is happening while app advert is active
    Chain installations should work fine, I've tested a few but haven't tested it _extensivly_
    It runs fine from a network share so you could shortcut it to the users Desktop and just update one location

    Hope it helps others, I'm pretty sure it could be made much cleaner but it's something I'll work on as time allows, just pulling chunks out might help if you want to make your own.

    have fun!

    -Dan
  • Tuesday, October 13, 2009 4:03 PMWilliam Bracken Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Excellent.  I will take a look.  In the meantime if anyone is looking for a simple script to execute optional advertisements I have posted the one I came up with on my blog:

    http://wbracken.wordpress.com/2009/10/13/vbscript-run-optional-sccm-advertisements/

    The script is very basic but could be easily modified or wrapped in a gui to provide more functionality.

    Now off to check out Dans GUI.  :-)
  • Tuesday, October 13, 2009 11:01 PMDan.Dufus Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    haha nice script man, looks very tight! I don't think my mish-mash is up to scratch ;) Since posting it I tweaked about a dozen things already, lots of testing needed to find all my unhandled errors!
  • Tuesday, October 20, 2009 4:01 AMDan.Dufus Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Ok I thought in the interest of public safety I should mention my code is an abomination and should be burnt. Use as an example of what not to do =)

    As you were..