Ayuda de vídeo de Screencast
Búsqueda: vídeos de ayuda Close Back
to help

Managing Software Policies with the ASDK

Created: 12 Junio 2012 | 5 comments
el cuadro de los J Henderson
0 0 Votos
Login to vote

Sorry this is going to be long winded:

We created a web page for people to be able to deploy software through SMP, using ASP/vbscript, and the ASDK calls from the webpage. I know there may be better ways to do this, but this workflow seems to meet our needs very well.

Basically the web page takes the computer entered by the user and puts it into a filter that is targeted by one of our software policies. It then updates the filter (with .UpdateCollections(strFilterGuid)). The webpage then makes an ASDK call to have the task 'Update Client Configuration' run against the computer the so it will pick up the software policy (everything mentioned here is done via. an ASDK, and I can provide the code mentioned).

Even though the filter is updated and the software policy points at the filter, the policy target needs to be 'refreshed' to show the clients that were added to the filter.

Is this possible via. the ASDK?

Right now I am trying "set resources = oScopingManagement.GetResourcesTargetedByPolicy(policyGuid)" to return the resources pointed to by the policy, hoping this will refresh the target, but I can not get it to return anything.

Appreciate any help.

Comentarios ComentariosIr al último comentario

el cuadro de los Juri Tsjornoi

Hello,

Unfortunately we don't have an ASDK method which refreshes a resource target. 

But to 'refresh' a policy target you should refresh all filters from which the given target is compiled, because actually the target is just a set of filters. As I see you are refreshing the filter which is used in the policy target.

Does the policy is enabled or not? Because a policy target should be automatically refreshed after enabling a policy. Before that time, when a policy is disabled, resource targets won't be updated. You can enable a policy by calling an ASDK method EnablePolicyItem from ItemManagementLib interface.

But if a policy is enabled and you'd like to refresh a resource target, then as I said above you should refresh all filters included in the target. To do this you can use an ASDK method UpdateCollections (you're already using this method)

0
Login to vote
  • Acciones
el cuadro de los b3tts32

We've done something similar with workflow but I believe you should be able to do the same via scripting. Once you've added the computer to the filter and update the collection there's a stored procedure that needs to be run on the policy target GUIDs. spResourceTargetDeltaUpdate. To get the policy guids you could use the get resources targeted by policy method to retrieve it. Hopefully this pushes you in the right direction.

0
Login to vote
  • Acciones
el cuadro de los J Henderson

Juri I am updating all of the filters that are included by the target, but like I mentioned the policy target does not update until up to 30 mins later. The policy is enabled.

B3TTS32: Thanks for your reply. Thats what I am trying to do, as you can see here:

  ==============================================================

Const policyGuid = "{23b45281-e519-4d2c-a5e9-366260d7243c}"

  set oScopingManagement = CreateObject("Altiris.ASDK.NS.ScopingManagement")
  oScopingManagement.TargetServer = strTargetServer
  oScopingManagement.UserName = strUserName
  oScopingManagement.Password = strPassword
  oScopingManagement.DomainName = strDomainName
  oScopingManagement.Authenticate()

 

On Error Resume Next
  set resources = oScopingManagement.GetResourcesTargetedByPolicy(policyGuid)

  if Err <> 0 then
   response.write "ERROR: " & Err
  end if 

  response.write "Comps: " & resources(0)
  response.write "Comps: " & resources(1)   

  if Err <> 0 then
   response.write "ERROR: " & Err
  end if 

 

=========================================================

I get a response of: ERROR: 424, ERROR: 13.

I am not sure if something is wrong with the ASDK call or not, as I am following the instructions. Ill keep looking!

 

0
Login to vote
  • Acciones
el cuadro de los J Henderson

I looked up the first error code and got the following:

 

set resources = oScopingManagement.GetResourcesTargetedByPolicy(policyGuid)

if Err <> 0 then
response.write "ERROR: " & Err       #####Error 424, which is 'Object Required'######
end if

end if

 

Anyone have any insight on why I would I be getting this error message? Thanks for the help.

0
Login to vote
  • Acciones
el cuadro de los Juri Tsjornoi

You should not use 'set' keyword before the following line:

'resources = oScopingManagement.GetResourcesTargetedByPolicy(policyGuid)'.

Please, try calling GetResourcesTargetedByPolicy method in the following way:

resources = oScopingManagement.GetResourcesTargetedByPolicy(policyGuid)

0
Login to vote
  • Acciones