Script to set asset status needed

pmakaveev's picture

Hello,

 

I am looking for a script which will allow me to change a "retired" computer to "active" remotely. The script should take the computer name as a parameter.

 I am using NS 6.0 Sp3 and Asset managemetn Solution 6.5.

I am not looking into doing it manually from the Altiris Console.

 

Thank you,

Peter

MBHarmon's picture

Normally an Inventory update

Normally an Inventory update from a workstation would change that status to Active. 

If you're going to need to update it without an inventory update you've got a couple of options.  The easiest that springs to mind immediately is a simple connector with a  CSV file. 

Are you looking to do, just one computer or multiple computers at a time?

- Matt

pmakaveev's picture

assetManagement.SetAssetStatus

I am looking to do one computer at a time. I am looking to do it within a script from the Deployment Server, as part of the re-imaging of a retired computer. I do not want to delete the retired computer.

I have looked at the Administrator SDK 1.4 asset.vbs:

' SetAssetStatus
'---------------------------------------
wscript.Echo "SetAssetStatus"
success = assetManagement.SetAssetStatus( clonedObject.Guid, names(0) )
wscript.Echo "Method complete"
wscript.Echo "Success: " & success

So, I am looking for something simialr to the above. However, I am not sure how to use the script above.

The above script seems to use the computer Guid as a parameter, while I want to use the computer name.

Thanks!

claus66's picture

Try this script

 

'--------------------------------------
itemName="computername"

' Setup management objects
'---------------------------------------
set assetManagement = CreateObject("Altiris.ASDKAsset.AssetManagement")
assetManagement.TargetServer = "ns-server"
assetManagement.Authenticate()

set itemManagement = CreateObject("Altiris.ASDK.NS.ItemManagement")
itemManagement.TargetServer = "ns-server"
itemManagement.Authenticate()

computerGuid = ""

itemsList = itemManagement.GetItemsByName(itemName)

'Asuming theres only one item called computername
if ubound(itemsList)=0 then computerGuid = itemsList(0).Guid

if computerGuid <> "" then
  wscript.Echo "Found computer: " & computerGuid
else
  wscript.Echo "Could not find a computer. Ending script."
  wscript.Quit
end if

'---------------------------------------
' SetAssetStatus
'---------------------------------------
wscript.Echo "SetAssetStatus"
success = assetManagement.SetAssetStatus( computerGuid , "Active" )
wscript.Echo "Method complete"
wscript.Echo "Success: " & success

jhallam3's picture

Hi, Im trying to get this to

Hi, Im trying to get this to work as well... basicly look up the asset and set it to in stock.. im doing this in workflow however the ASDK webservices are not there.

having looked at the script above and the forum entry at https://www-secure.symantec.com/connect/forums/set-status-asset-using-workflow I found that my NS 6.5 server with ADSK 1.4 installed doesnt have the following

IMG_0802.JPG

Surely these things should have been installed with the ASDK, having looked in IIS I cannot find any of the links within the picture about.

can you point me in the right dirrection??

Thanks

Jon