Share via


SCCM 2012 - Export Query Results

Question

Thursday, September 20, 2012 4:12 AM | 3 votes

Hi guys, I have a query under "Monitoring" - "Overview" - "Queries" and have my results in the result pane however I want to print the report or export to a CSV file. I cant see an easy way to do this? Surely we dont have to create the query then create a report just so we can export or print the report? Information is on my screen and is exactly what I want but no obvious easy way to get this in a format that is usable

I only see the export MOF option available

Thanks

Nick

All replies (23)

Thursday, September 20, 2012 6:40 AM ✅Answered | 22 votes

Ctrl+A, Ctrl+C ;-)

Torsten Meringer | http://www.mssccmfaq.de


Thursday, September 20, 2012 8:45 PM

Brilliant, thanks


Friday, April 12, 2013 7:44 PM

 

The KISS principle…excellent.


Tuesday, April 23, 2013 2:14 PM

If you want the headers as well, export the MOF file and open it in notepad. The line ResultColumnsNames = shows all of the column names in a CSV format. You can format them in excel and then add it to the top of the data.


Thursday, September 26, 2013 1:59 PM

nicely painful :) was much better in 2007 to get result with headers.

No add ons for such yet available? Thank you! :)


Friday, March 28, 2014 2:37 PM

Ctrl+A, Ctrl+C ;-)

Torsten Meringer | http://www.mssccmfaq.de

For some reason, that doesn't paste over the "Agent Time" System Resource field properly.  I've tried Notepad, Excel and Notepad++.  Everything else gets pasted properly, just not Agent Time.  I've even changed the order the column is, first, middle, last, second to last.  Just shows up as a blank.  In excel it leaves an empty column.

Any ideas?

Thanks!


Thursday, September 4, 2014 10:27 AM

Unable to get the Agent Time in Excel / notepad, its just blank , Any one knows how to get that populated?

Thank You.


Thursday, September 4, 2014 11:59 AM

Unable to get the Agent Time in Excel / notepad, its just blank , Any one knows how to get that populated?

I just tested this in Excel 2013, 2010 and notepad and it does copy and paste the agent time for all of them. I recommend trying this again or checking your query.

Garth Jones | My blogs: Enhansoft and Old Blog site | Twitter: @GarthMJ


Tuesday, September 9, 2014 2:44 PM

I know this is an old post but I see Garth replied a couple days ago - on this same theme I have just upgraded to Office 2013 and the cut and paste from Queries and Collections from SCCM 2012 (which worked fine in Office 2010) seems to now not work with my Excel 2013 - you do mention it works for you in your post.  The results I see that I have 4 columns in my results it just pastes them into 1 cell - it doesn't break up the columns.  I have tried pasting to notepad first then to Excel - doesn't work - also tried Paste - Special - Unicode Text or Text and still it all goes into one cell. Is there something I have to change with either SCCM or Excel to get this to work again?

Let me know if you have run into this with Excel 2013....thanks

Kevin


Wednesday, September 10, 2014 1:20 AM

I just tested it again and it works for both Queries and Collections. I hate to say it but I think this is a problem on your end.

What OS are you running?

Garth Jones | My blogs: Enhansoft and Old Blog site | Twitter: @GarthMJ


Thursday, March 12, 2015 3:18 PM

I know this is an old post but I see Garth replied a couple days ago - on this same theme I have just upgraded to Office 2013 and the cut and paste from Queries and Collections from SCCM 2012 (which worked fine in Office 2010) seems to now not work with my Excel 2013 - you do mention it works for you in your post.  The results I see that I have 4 columns in my results it just pastes them into 1 cell - it doesn't break up the columns.  I have tried pasting to notepad first then to Excel - doesn't work - also tried Paste - Special - Unicode Text or Text and still it all goes into one cell. Is there something I have to change with either SCCM or Excel to get this to work again?

Let me know if you have run into this with Excel 2013....thanks

Kevin

I am seeing the same issue.  Win 7/Office 2013 fully patched.

Edit: Got it to work by pasting into Notepad, saving as .txt and opening that file with Excel.


Thursday, April 16, 2015 4:22 PM

Anyone know how to keep the column header information?  It is useful when sorting or sending the info to other people.


Monday, August 8, 2016 7:20 PM

Unable to get the Agent Time in Excel / notepad, its just blank , Any one knows how to get that populated?

Thank You.

Having the same issue as Rafeeq1234.

Some entries in the Agent Time column contains multiple values - seperated by semicolon.

e.g.: 07-08-2016 03:20; 28-06-14 14:45

Whenever a row contains multiple values - the agent time will be left blank when trying to copy/paste from the query result to e.g. notepad

Rows with only one entry for Agent Time are copy/pasted without problems.

Ideas anyone?


Monday, August 8, 2016 8:33 PM

Having the same issue as Rafeeq1234.

Some entries in the Agent Time column contains multiple values - seperated by semicolon.

e.g.: 07-08-2016 03:20; 28-06-14 14:45

Whenever a row contains multiple values - the agent time will be left blank when trying to copy/paste from the query to e.g. notepad

Rows with only one entry for Agent Time are copy/pasted without problems.

Ideas anyone?

Exactly what query are you using?

Garth Jones

Blog: http://www.enhansoft.com/blog Old Blog: http://smsug.ca/blogs/garth_jones/default.aspx

Twitter: @GarthMJ Book: System Center Configuration Manager Reporting Unleased


Tuesday, August 9, 2016 5:55 AM

Hi Garth.

Here is the WQL query:

select SMS_R_System.Name, SMS_R_System.AgentTime, SMS_R_System.LastLogonTimestamp, SMS_R_System.SMSAssignedSites, SMS_R_System.IPAddresses, SMS_R_System.IPSubnets, SMS_R_System.ADSiteName, SMS_R_System.OperatingSystemNameandVersion, SMS_R_System.ResourceDomainORWorkgroup, SMS_R_System.LastLogonUserDomain, SMS_R_System.LastLogonUserName, SMS_R_System.SMSUniqueIdentifier, SMS_R_System.ResourceId, SMS_R_System.ResourceType, SMS_R_System.NetbiosName, SMS_R_System.ClientType from  SMS_R_System

Looking in SMSProv.log to find the corresponding SQL - which looks like this:

select  all SMS_R_System.ItemKey,SMS_R_System.Name0,SMS_R_System.Last_Logon_Timestamp0,SMS_R_System.AD_Site_Name0,SMS_R_System.Operating_System_Name_and0,SMS_R_System.Resource_Domain_OR_Workgr0,SMS_R_System.User_Domain0,SMS_R_System.User_Name0,SMS_R_System.SMS_Unique_Identifier0,SMS_R_System.ItemKey,SMS_R_System.DiscArchKey,SMS_R_System.Netbios_Name0,SMS_R_System.Client_Type0 from vSMS_R_System AS SMS_R_System

When I'm running the above SQL query in SQL Server Management Studio - I can't seem to find Agent time listed


Tuesday, August 16, 2016 1:30 PM

*BUMP*


Monday, October 3, 2016 10:56 AM

Thanks, sometimes i feel myself.......:).


Tuesday, March 28, 2017 3:24 PM

Unfortunately Ctrl_A, Ctrl+c only works for a few results. I have 38,000 rows, and SCCM Console crashes. I guess I'll have to copy them in groups.


Tuesday, March 28, 2017 4:58 PM

Unfortunately Ctrl_A, Ctrl+c only works for a few results. I have 38,000 rows, and SCCM Console crashes. I guess I'll have to copy them in groups.

In that case, why not create a report or a SQL query within SSMS?

Garth Jones

Blog: http://www.enhansoft.com/blog Old Blog: http://smsug.ca/blogs/garth_jones/default.aspx

Twitter: @GarthMJ Book: System Center Configuration Manager Reporting Unleased


Thursday, May 11, 2017 7:29 PM | 1 vote

Why not provide an option for such an obviously common task ?


Wednesday, March 7, 2018 3:38 PM

This crashes for me, as well.  We are at 34,000 devices and I am trying to run a simple query for OS and Service Packs.  Often SCCM doesn't pull up all 34,000 devices and when it gets somewhere close (and I have to consider 28k devices close), then I am not able to do a ctrl-a, ctrl-c into excel.  SCCM crashes.  Seems like it would be standard for an export option to be made available for queries.


Wednesday, March 7, 2018 4:09 PM

Use SQL query and SSMS for this.

Garth Jones

Blog: http://www.enhansoft.com/blog Old Blog: http://smsug.ca/blogs/garth_jones/default.aspx

Twitter: @GarthMJ Book: System Center Configuration Manager Reporting Unleased


Tuesday, October 8, 2019 8:26 PM

Hi,

I have finally developed a solution for this Ctrl A + Ctrl C, which makes a mess of the format and also shifting of files from one system to another (unfortunately, my SCCM server does not have excel).

In case you wish to use the tool, here is the link from my GitHub page: Export-CMQueryResult.ps1

If you want you can use the tool as it is (GUI based) or extract the main stuff from it and modify for CLI based usage. 

Regards,

Tushar