Skip to content

Problems rerunning chained programs

Featured Replies

Hi guys

 

A coupple of days ago a colleuge told me that he was having problems rerunning chained advertisements with the rightclick tools in SCCM.

SCCM Right click tolls can be downloaded from here: http://myitforum.com/cs2/blogs/rhouchins/0424ConfigMgrTools.zip

 

This is the error msg that you get when trying to to a rerun on a chained advertisement.

post-2500-12537070039637_thumb.jpg

 

By a chained advertisement i mean that the advertisement will run several programs in a chain. Example:

post-2500-12537070586103_thumb.jpg

 

 

I though this was very strange since i know ive used rerun on chained programs in SMS so I started digging and here is what i found out:

 

SCCM rightclick tools use the ReRunAdv.wsf script for rerunning programs.

This script is located on the following path: "C:\WINDOWS\SCCMTools\ReRunAdv.wsf"

 

In the function called "SetRerunBehavior" beginning on row 143 we can see the root of the why the script is not working.

We will get errors if the following query get more then 1 result.

Set objScheds = objNMS.ExecQuery("select * from CCM_SoftwareDistribution where ADV_AdvertisementID = '" & strAdvID & "'" )

Because of the following row (161):

if (objScheds.Count <> 1) then

 

This basiclly means that if we get more or less then 1 row when running the query we will get an error code of "-3" when running this function.

 

So why do we get more then one result?

Well this is because we have a chained advertisement which means we will get one row for each program in the chain. This is how it look in wbemtest (namespace: "\\<COMPUTERNAME>\root\ccm\policy\machine\actualconfig" ) when running this query:

post-2500-12537084268384_thumb.jpg

 

So what we can do to make the advertiemsent rerun is either to alter the WQL query or we could simply change row 163

FROM

SetRerunBehavior = -3

TO

SetRerunBehavior = 0

 

This will make the script able to process this function with exit code 0, which in turn will make the script complete without error.

 

Since it will be able to get past this step now:

' Then make sure the program can be rerun

ret = SetRerunBehavior(strMachine, strAdvID, strOldRerunBehavior, "RerunAlways")

If ret < 0 then

MsgBox "Unable to set RerunBehaviour. Program will not rerun.", vbCritical OR vbOKOnly, "Rerun Advertisement Error"

Wscript.Quit(ret)

Else

' wscript.echo "Successfully set RerunBehaviour from " & strOldRerunBehavior & " to RerunAlways."

End If

 

I have tested this in two enviroments now and it´s working great in booth. I will tell you if i find any buggs with this solution.

  • Author

Note there are allso some rightclick tools for SMS that use the same rerun script as the SCCM Tools:

 

ReRunAdv.wsf

 

These will allso get the same error as mentioned above.

----------------

Rightclick Tools that use the following script seems to be able to rerun chained programs though

 

SMSSend.vbs

 

Note i havent tried this script on SCCM. But it work great on SMS.

  • 4 months later...

But it gives me different error(using the default script) given below.is this due to the scheduleID not found in policies ?Looked into CCM instances but not find the advID.

 

 

 

Error1.JPG

  • Author

But it gives me different error(using the default script) given below.is this due to the scheduleID not found in policies ?Looked into CCM instances but not find the advID.

 

 

 

post-3797-12663870723874_thumb.jpg

 

Has the client run through the advertisement once?

Does the client still have the advertisement?

  • Author

NO,It doesnt run and client doesnt have.This could be the reason probably why it gives the error.

 

For "rerun" to work the client still has to be in a collection that is tied to the specific advertisement that you want to rerun.

Also the advertisement has to have ran once on this client before you can perform a rerun.

For "rerun" to work the client still has to be in a collection that is tied to the specific advertisement that you want to rerun.

Also the advertisement has to have ran once on this client before you can perform a rerun.

 

Perfect!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.