JoshuaBarnette Posted November 10, 2011 Share Posted November 10, 2011 I am trying to create a way for our helpdesk to enter a machine name and be able to query certain information from the SCCM server. I have searched the forum and found similar requests, one was never answered and another was unclear. I am posting my code below, any help would be greatly appreciated. Global Const $cI_VersionInfo = "00.03.08" Global Const $cI_aName = 0, _ $cI_aDesc = 4 Global $wbemFlagReturnImmediately = 0x10, _ $wbemFlagForwardOnly = 0x20 Global $ERR_NO_INFO = "Array contains no information", _ $ERR_NOT_OBJ = "$colItems isnt an object" Dim $NodeInfo $InputNode = InputBox("Machine Information", "Please Enter The Node Name To Query:") $Node = StringUpper($InputNode) _GetPCInfo($NodeInfo) Func _GetPCInfo(ByRef $Node) Local $colItems, $objWMIService, $objItem Dim $NodeInfo[1][5], $i = 1 $objWMIService = ObjGet("winmgmts:\\server\root\sms\site_code") $colItems = $objWMIService.ExecQuery("SELECT DISTINCT SYS.NETBIOS_NAME0 AS [NodeName], CSYS.MANUFACTURER0 AS [Manufacturer], CSYS.MODEL0 AS [Model], BIOS.SERIALNUMBER0 AS [SerialNumber], NIC.MACADDRESS0 AS [MACAddress] FROM V_R_SYSTEM AS SYS JOIN V_GS_COMPUTER_SYSTEM AS CSYS ON SYS.RESOURCEID=CSYS.RESOURCEID JOIN V_GS_PC_BIOS AS BIOS ON SYS.RESOURCEID=BIOS.RESOURCEID JOIN V_GS_NETWORK_ADAPTER_CONFIGUR AS NIC ON SYS.RESOURCEID=NIC.RESOURCEID WHERE NIC.IPENABLED0=1 AND SYS.NETBIOS_NAME0 = " & '"' & $Node & '"', "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly); I have also tried this using "", 48) to close, but it did not seem to work either. If IsObj($colItems) Then For $objItem In $colItems ReDim $NodeInfo[UBound($NodeInfo) + 1][5] $NodeInfo[$i][0] = $objItem.NodeName $NodeInfo[$i][1] = $objItem.Manufacturer $NodeInfo[$i][2] = $objItem.Model $NodeInfo[$i][3] = $objItem.SerialNumber $NodeInfo[$i][4] = $objItem.MACAddress $i += 1 Next $NodeInfo[0][0] = UBound($NodeInfo) - 1 If $NodeInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Else SetError(1, 2, 0) EndIf EndFunc MsgBox(64, "Machine Information", "Node Name: " & $NodeInfo[1][0] & @CR & "Manufacturer: " & $NodeInfo[1][1] & @CR & "Model Number: " & $NodeInfo[1][2] & @CR & "Serial Number: " & $NodeInfo[1][3] & @CR & "MAC Address: " & $NodeInfo[1][4]) As a side note, I have only been using AutoIT since May and the help file along with this forum have answered all the questions I have had to date. You all are great. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 10, 2011 Moderators Share Posted November 10, 2011 Hi, Joshua; I'm curious if you have looked into other ways to get what you want from SCCM? I am just beginning a migration from Altiris 6.5 to SCCM 2007 R3 myself, and have been researching the best way to write queries and reports for it. Thus far, the most intuitive that I have found is the MS SQL Server 2008 Report Builder. It has a decent GUI that will allow you to create direct SQL queries against the database (not that you couldn't find a way to do it through AutoIT, of course!). Hope this helps. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
JoshuaBarnette Posted November 21, 2011 Author Share Posted November 21, 2011 The HD users do not have permissions that will allow them to retrieve the information necessary. Using AutoIT I can give my credentials or another elevated account inside the EXE. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now