A new Flexera Community experience is coming on November 18th, click here for more information.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Passing the ConfigMgr ID of a device into a Script Command

Hello - has anyone ever tried to set an argument in a Script Command, that includes the device's ConfigMgrID property? 

I see the correct ID for the device in ConfigMgrID field for the record in the WD_Computer table.   But selecting the ConfigMgrID property in my Script Command passes some other value into the script as an argument.   

If you have a solution, please share!  Thanks!

(1) Solution

Yes, if you use a custom sync query and pull the resourceID as a custom value in that query, it will be available as a variable for command parameters and email variables.  It will show up in GetResolvedRequestVariables like everything else.

I believe what you're seeing is that WD_User and WD_Computer both use the same column names for all of those IDs (ConfigMgrID, CM7ID, CM12ID, etc.), so when we do variable resolution, you'll see both the user and the computer ConfigMgrID listed with the same variable name.  Unfortunately, there is no way for you to choose which one will be referenced when you use the variable.  So, your options are to do a custom sync and pull that value in with a different variable name or to just pass the ##RequestID## or ##ComputerID## as your parameter, and then have your command script look up the values you want from the database.

Anything expressed here is my own view and not necessarily that of my employer, Flexera. If my reply answers a question you have raised, please click "ACCEPT AS SOLUTION".

View solution in original post

(5) Replies
CharlesW
By Level 12 Flexeran
Level 12 Flexeran

Never really looked at it before, but I do see two variables named  ##ConfigMgrID## when I hit the getResolvedRequestVariables() method in integration.asmx (http://localhost/esd/ws/integration.asmx/GetResolvedRequestVariables)

One of the values is correct, and one is not.
ConfigMgrD .png

I'll see where the incorrect value is coming from if I can. I know that we should be able to create a new variable entirely (we could call it resourceID), if you wanted to use a custom sync computer query. 

 

Thanks for the quick note on that Charles!     We are already using a custom computer sync query so that may work.    Would the new property be able to be passed along as an argument? 

Correct, any new property that you add to the sync query (either user or computer) should be available as a new variable that you can resolve. The variable name will be the same as the property that you add to your query.

Yes, if you use a custom sync query and pull the resourceID as a custom value in that query, it will be available as a variable for command parameters and email variables.  It will show up in GetResolvedRequestVariables like everything else.

I believe what you're seeing is that WD_User and WD_Computer both use the same column names for all of those IDs (ConfigMgrID, CM7ID, CM12ID, etc.), so when we do variable resolution, you'll see both the user and the computer ConfigMgrID listed with the same variable name.  Unfortunately, there is no way for you to choose which one will be referenced when you use the variable.  So, your options are to do a custom sync and pull that value in with a different variable name or to just pass the ##RequestID## or ##ComputerID## as your parameter, and then have your command script look up the values you want from the database.

Anything expressed here is my own view and not necessarily that of my employer, Flexera. If my reply answers a question you have raised, please click "ACCEPT AS SOLUTION".

Thank you!  Yes ,that makes sense since I was getting the same ID when I tested from different machines.   I am going to try bringing in the additional ResourceID as a different variable name.  

Top Kudoed Authors