SoftwareCentral · End User Scheduler

End User Scheduler API

The API of the End User Scheduler is a web service. It returns the computers that chose not to run a deployment, so that your own scripts or reports can use the list.

GetComputersWithDoNotRun Web service PowerShell example

1 The web service

There is a web service GetComputersWithDoNotRun that returns a list of objects for computers which have chosen not to run the deployment.

The web service GetComputersWithDoNotRun takes one value, the ID of the End User Scheduler (endUserScheduleId, a whole number).

Replace [Your_SoftwareCentral_Address] with the address of your SoftwareCentral web server.

2 The fields returned

The returned object, WS_ComputerObject, contains the following data:

FieldWhat it contains
ResourceIDThe ConfigMgr resource ID of the computer (a whole number).
ComputerNameThe name of the computer.
UsernameThe user name recorded with the choice.
ReasonThe reason the user gave.
TimestampUTCWhen the choice was made, as a date and time in UTC.

3 PowerShell example

The example calls the web service with the ID of the End User Scheduler and prints the result.

# Web Service Parameters Start
[int]$endUserScheduleId = 1
# Web Service Parameters End

# The object that will make the call to the Web Service
$proxy = New-WebServiceProxy -Uri "http://[Your_SofwareCentral_Address]/SWCWebservices/CustomWebServices.asmx" -Class "Proxy" -UseDefaultCredential

# Call the Web Service
$listOfComputers = $proxy.GetComputersWithDoNotRun($endUserScheduleId)

# Print the result if any
foreach ($computer in $listOfComputers)
{
    Write-Host $computer.ResourceID
    Write-Host $computer.ComputerName
    Write-Host $computer.Username
    Write-Host $computer.Reason
    Write-Host $computer.TimestampUTC
}

Replace the value 1 with the ID of your End User Scheduler. -UseDefaultCredential sends the Windows credentials of the account that runs the script.

4 How the list is built

  • A computer is listed when it has a Reason recorded for the deployment. A computer without a reason is not listed.
  • The list comes from the status of the End User Scheduler on the site that SoftwareCentral is connected to.
  • TimestampUTC is converted to UTC before it is returned.
  • If the call fails, the web service returns an empty list. It does not return an error and writes nothing to the log. An empty list therefore means either that nobody has chosen not to run, or that the call failed.

5 Best practice

  • Do not poll too often. Each call reads the whole status list of the End User Scheduler, so call the web service at a sensible interval rather than in a tight loop.
  • Convert the time before you show it. TimestampUTC is in UTC, so convert it to local time before you show it to a user.
  • Check the ID first. Use the ID of the End User Scheduler you mean. A wrong ID gives an empty list, not an error.
  • Know who the call runs as. The example sends the Windows credentials of the account that runs it. Run the script under an account that is meant to read this list.

6 Troubleshooting

SymptomCauseWhat to do
The list is always empty, and no error is shownNobody has chosen not to run the deployment, the ID is not the ID of the End User Scheduler, or the call failed. A failed call also returns an empty list, with no message.Check the ID of the End User Scheduler. Check that the script runs under an account that can use SoftwareCentral.
The times are not your local timeTimestampUTC is returned in UTC.Convert the value to your local time zone, as described in the best practice above.