Query , can you build query that recognize Laptops or dekstops
Hi . I am trying to build a collections for my stations . So far i have made collections by location and by OS type. Is there any way to seperate laptops from desktops? Is there a parameter i can query for that ? Thanks
January 26th, 2009 8:01pm

Yes, you'll want to leverage ChassisTypes, check out http://myitforum.com/cs2/blogs/snorman/archive/2007/09/18/count-of-chassis-types-by-collection.aspx or http://www.myitforum.com/forums/m_129997/mpage_1/key_/tm.htm#129997 for some sample queries/reports.Standardize. Simplify. Automate.
Free Windows Admin Tool Kit Click here and download it now
January 26th, 2009 8:33pm

Thank you on the help . I found what i needed , i have created this Query and it all works in the SQL SELECT SYS.Netbios_Name0 FROM v_GS_SYSTEM_ENCLOSUREENC INNERJOIN v_R_SystemSYSONENC.ResourceID=SYS.ResourceID WHERE ENC.ChassisTypes0=10 This works fine when i run the query in the sql , but when i build a query in SCCM it keeps crashing the MMC , I must create a query for that in order to add the query to the collection ... any idea ? Error : FX:{6de537a5-7a1c-4fa4-ac3a-1b6fc1036560} Value cannot be null.Parameter name: key Server stack trace: at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at Microsoft.ConfigurationManagement.AdminConsole.ConsoleView.ConsoleFormViewControl.AddColumnsAndRestoreSettingsForClassObjects(IResultObject resultObject) at Microsoft.ConfigurationManagement.AdminConsole.ConsoleView.ConsoleFormViewControl.AddColumnsAndRestoreSettings(IResultObject resultObject) at Microsoft.ConfigurationManagement.AdminConsole.ConsoleView.ConsoleFormViewControl.ReadConfigurationData() at Microsoft.ConfigurationManagement.AdminConsole.SmsFormViewControlBase.Initialize(FormView view) at Microsoft.ConfigurationManagement.AdminConsole.ConsoleView.ConsoleFormViewControl.Initialize(FormView view) at Microsoft.ManagementConsole.FormView.InternalInitialize() at Microsoft.ManagementConsole.View.HandleInitializationRequest(IRequestStatus requestStatus) at Microsoft.ManagementConsole.View.ProcessRequest(Request request) at Microsoft.ManagementConsole.ViewMessageClient.ProcessRequest(Request request) at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs) at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs) at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at Microsoft.ManagementConsole.Internal.IMessageClient.ProcessRequest(Request request) at Microsoft.ManagementConsole.Executive.RequestStatus.BeginRequest(IMessageClient messageClient, RequestInfo requestInfo) at Microsoft.ManagementConsole.Executive.SnapInRequestOperation.ProcessRequest() at Microsoft.ManagementConsole.Executive.Operation.OnThreadTransfer(SimpleOperationCallback callback)
January 26th, 2009 9:35pm

Ben Peeri said: SELECT SYS.Netbios_Name0 FROM v_GS_SYSTEM_ENCLOSUREENC INNERJOIN v_R_SystemSYSONENC.ResourceID=SYS.ResourceID WHERE ENC.ChassisTypes0=10 This works fine when i run the query in the sql , but when i build a query in SCCM it keeps crashing the MMC , I must create a query for that in order to add the query to the collection ... any idea ? You have to "translate" this SQL statement into WQL. This should work: select * from SMS_R_System inner join SMS_G_System_SYSTEM_ENCLOSURE on SMS_G_System_SYSTEM_ENCLOSURE.ResourceId = SMS_R_System.ResourceId where SMS_G_System_SYSTEM_ENCLOSURE.ChassisTypes = "10"
Free Windows Admin Tool Kit Click here and download it now
January 26th, 2009 11:24pm

Thanks for the help .
January 26th, 2009 11:44pm

fyi, ChassisTypes = 10 might not be enough to find all laptop/portable. The following is from Michael Niehaus, regarding how MDT determines laptop vs. desktop models. Based on this information, you might want to include the other ChassisTypes for your Laptop Collection query. ------------------------------------------ This is the logic in MDT that is used to set the IsLaptop and IsDesktop variables: Select Case objInstance.ChassisTypes(0) Case "8", "9", "10", "11", "12", "14", "18", "21" bIsLaptop = true Case "3", "4", "5", "6", "7", "15", "16" bIsDesktop = true Case "23" bIsServer = true Case Else ' Do nothing End Select -MichaelStandardize. Simplify. Automate.
Free Windows Admin Tool Kit Click here and download it now
January 26th, 2009 11:47pm

there is another soluiton for your problem.here are the steps;1)open mof file and edit battery informaiton.(change the battery and battery status information to true )2)create a collection for laptops.here is the query;select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_BATTERY on SMS_G_System_BATTERY.ResourceID = SMS_R_System.ResourceId where SMS_G_System_BATTERY.Status = "OK" and SMS_R_System.OperatingSystemNameandVersion like "%Workstation%"3)query for desktop collectionselect SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where ResourceId not in (select ResourceId from SMS_G_System_BATTERY)try it and it works properly
August 17th, 2009 11:24am

seyfettinnasli Are you able to confirm if the above Query syntax is correct for your Battery queries?I recieve an invalid syntax error when I create this query for collection membership.I have only just (<10 Mins ago) enabled the Battery and Battery status information in the MOF file. Could it simply be that I have to wait for the data to populate into the DB first before creating the query?Thanks for you help
Free Windows Admin Tool Kit Click here and download it now
October 14th, 2009 5:44am

Hi here is the query that i used.select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_BATTERY on SMS_G_System_BATTERY.ResourceID = SMS_R_System.ResourceId where SMS_R_System.AgentSite = "xxx" and SMS_G_System_BATTERY.Status = "OK" and SMS_R_System.OperatingSystemNameandVersion like "%Workstation%" select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System where SMS_R_System.ResourceId not in (select ResourceId from SMS_G_System_BATTERY) and SMS_R_System.SMSAssignedSites = "xxx" and SMS_R_System.OperatingSystemNameandVersion like "%workstation%" You can check the database to mof file is enabled and collecting the battery data.The order is important but it is better to enable mof file firstly.I waited about an hour to see the battery data in mof file is enabled.
October 14th, 2009 2:58pm

This works from adding up some of the above comments. select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_SYSTEM_ENCLOSURE on SMS_G_System_SYSTEM_ENCLOSURE.ResourceId = SMS_R_System.ResourceId where SMS_G_System_SYSTEM_ENCLOSURE.ChassisTypes = "8" or SMS_G_System_SYSTEM_ENCLOSURE.ChassisTypes = "9" or SMS_G_System_SYSTEM_ENCLOSURE.ChassisTypes = "11" or SMS_G_System_SYSTEM_ENCLOSURE.ChassisTypes = "12" or SMS_G_System_SYSTEM_ENCLOSURE.ChassisTypes = "14" or SMS_G_System_SYSTEM_ENCLOSURE.ChassisTypes = "18" or SMS_G_System_SYSTEM_ENCLOSURE.ChassisTypes = "21" From a VBS I use here are what the ChassisTypes Case 1 LaptopDesktop = "Other" Case 2 LaptopDesktop = "Unknown" Case 3 LaptopDesktop = "DeskTop" Case 4 LaptopDesktop = "Low Profile Desktop" Case 5 LaptopDesktop = "Pizza Box" Case 6 LaptopDesktop = "Mini Tower" Case 7 LaptopDesktop = "Tower" Case 8 LaptopDesktop = "Portable" Case 9 LaptopDesktop = "Laptop" Case 10 LaptopDesktop = "Notebook" Case 11 LaptopDesktop = "Handheld" Case 12 LaptopDesktop = "Docking Station" Case 13 LaptopDesktop = "All-in-One" Case 14 LaptopDesktop = "Sub-Notebook" Case 15 LaptopDesktop = "Space Saving" Case 16 LaptopDesktop = "Lunch Box" Case 17 LaptopDesktop = "Main System Chassis" Case 18 LaptopDesktop = "Expansion Chassis" Case 19 LaptopDesktop = "Sub-Chassis" Case 20 LaptopDesktop = "Bus Expansion Chassis" Case 21 LaptopDesktop = "Peripheral Chassis" Case 22 LaptopDesktop = "Storage Chassis" Case 23 LaptopDesktop = "Rack Mount Chassis" Case 24 LaptopDesktop = "Sealed-Case PC" Case Else Running this on a client I can see only laptops in the collection with about the number I would expect from production. This is an old thread but I someone might still find this useful. IronPaw
Free Windows Admin Tool Kit Click here and download it now
August 7th, 2010 5:02am

I have done some Research in our environment and together with our custom Staging variable I can now be sure, that the following statements works well to evaluate Collections. Desktops SELECT sms_r_system.resourceid, sms_r_system.resourcetype, sms_r_system.name, sms_r_system.smsuniqueidentifier, sms_r_system.resourcedomainorworkgroup, sms_r_system.client FROM sms_r_system INNER JOIN sms_g_system_system_enclosure ON sms_g_system_system_enclosure.resourceid = sms_r_system.resourceid WHERE sms_g_system_system_enclosure.chassistypes = "2" OR sms_g_system_system_enclosure.chassistypes = "3" OR sms_g_system_system_enclosure.chassistypes = "4" OR sms_g_system_system_enclosure.chassistypes = "6" OR sms_g_system_system_enclosure.chassistypes = "15" Notebooks SELECT sms_r_system.resourceid, sms_r_system.resourcetype, sms_r_system.name, sms_r_system.smsuniqueidentifier, sms_r_system.resourcedomainorworkgroup, sms_r_system.client FROM sms_r_system INNER JOIN sms_g_system_system_enclosure ON sms_g_system_system_enclosure.resourceid = sms_r_system.resourceid WHERE sms_g_system_system_enclosure.chassistypes = "10" Servers SELECT sms_r_system.resourceid, sms_r_system.resourcetype, sms_r_system.name, sms_r_system.smsuniqueidentifier, sms_r_system.resourcedomainorworkgroup, sms_r_system.client FROM sms_r_system INNER JOIN sms_g_system_system_enclosure ON sms_g_system_system_enclosure.resourceid = sms_r_system.resourceid WHERE sms_g_system_system_enclosure.chassistypes = "1" OR sms_g_system_system_enclosure.chassistypes = "7" OR sms_g_system_system_enclosure.chassistypes = "23" Hope this helps other without long research. Cheers, Stefan
May 19th, 2011 8:51am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics