Altiris Software Dev Kit (ASDK)

 View Only

Running ASDK jobs from DS 6.9 on 64 bit OSs 

Dec 30, 2014 09:52 AM

I recently upgraded my DS to 6.9 SP6 on Windows Server 2008 R2 (64 bit) from DS 6.9 SP4 on 32 bit Windows Server 2003 and my ASDK job, to remove a PC from filters when rebuilt for a different user, stopped working.

As Deployment Server is a 32 bit program, when you use the "Run Script" task the 64 bit Windows Server 2008 R2 runs them in the "Windows on Windows" (WOW) environment. So it will run CMD.exe and cscript.exe from C:\Windows\SysWOW64, which are the 32 bit versions of those programs - you can see this in the "Process" tab of Task Manager where the Image name will have *32 at the end.

But the ASDK components are all 64 bit and just don't work when called from 32 bit cscript.

So I tried to explicitly call c:\windows\system32\cscript.exe (paradoxically the 64 bit version) from a Run Script task. But 64 bit Windows will see that it's being called from a 32 bit cmd.exe (which will always be called by the 32 bit Deployment Server program AFAIK) and assumes we want the 32 bit version of cscript.exe in C:\Windows\SysWOW64, which it then calls.

To get over this you have to call cscript.exe in a Run Script task by using c:\Windows\Sysnative\cscript.exe, this effectively tells 64 bit Windows "although I'm only a 32 bit program I understand I'm running on a 64 bit OS and would really like the 64 bit version of ..., please"

So my job first token replaces this script:

'Remove PC from filters
'vbscript

'---------------------------------------
' Setup management objects
'---------------------------------------

set collectionManagement = CreateObject("Altiris.ASDK.NS.CollectionManagement")
set itemManagement = CreateObject("Altiris.ASDK.NS.ItemManagement")
set resourceManagement = CreateObject("Altiris.ASDK.NS.ResourceManagement")

'Using the web service
    itemManagement.TargetServer = "ns.me.local"
    itemManagement.Authenticate()
    collectionManagement.TargetServer = "ns.me.local"
    collectionManagement.Authenticate()
    resourceManagement.TargetServer = "ns.me.local"
    resourceManagement.Authenticate()

machineName = "%NAME%"
machineDomain = "mydomain"
computerGuid = resourceManagement.GetComputerByNameAndDomain(machineName, machineDomain)

'---------------------------------------
' Setup other variables
'---------------------------------------
'This is the GUID for the top level folder
Const FILTERFOLDER = "{0ec5e832-85ab-47f5-b74d-b67d86214e6b}" ' FolderGUID to start searching under 1. Managed Software Delivery filters

'---------------------------------------
' Remove Inclusions
'---------------------------------------

Function recurseCheck(GUID)
  for each NSItemDetails in ItemManagement.GetItemsInFolder(GUID)
    If NSItemDetails.TypeName = "PresentationFolder" Then
      recurseCheck(NSItemDetails.Guid)
    Else
        Call CollectionManagement.RemoveInclusions(NSItemDetails.Guid, computerGuid)
    Call CollectionManagement.UpdateCollections(NSItemDetails.Guid)
    End If
  next
End Function

recurseCheck(FILTERFOLDER)

set collectionManagement = Nothing
set itemManagement = Nothing
set resourceManagement = Nothing
set NSItemDetails.Guid = Nothing

WScript.Quit

[I had trouble putting a .vbs file into .\temp so Token Replaced to a txt file then renamed it to .vbs]

Then Run Script - Locally on the Deployment Server:

c:\Windows\Sysnative\cscript.exe "D:\Program Files (x86)\Altiris\eXpress\Deployment Server\Temp\%ID%.vbs"

Don't forget you need the ASDK components installed on the NS and DS. The Server components are installed automatically on NS in 7.5 and log to the main NS log file.

Statistics
0 Favorited
0 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Related Entries and Links

No Related Resource entered.