{"id":2402,"date":"2014-01-03T02:47:16","date_gmt":"2014-01-03T02:47:16","guid":{"rendered":"https:\/\/pipe2text.com\/?page_id=2402"},"modified":"2014-03-23T15:56:26","modified_gmt":"2014-03-23T15:56:26","slug":"using-powershell-export-devices-in-need-of-the-sccm-2012-client-to-a-csv-file","status":"publish","type":"page","link":"https:\/\/pipe2text.com\/?page_id=2402","title":{"rendered":"Using PowerShell Export Devices In Need of the SCCM 2012 Client to a CSV File"},"content":{"rendered":"<p>Hi All,<\/p>\n<p>In a recent deployment of SCCM 2012, I had a percentage of devices showing up under \u201cAssets and Compliance\u201d that did not have the SCCM client installed. Before troubleshooting each individual machine, I wanted to dump all machines showing up in \u201cDevices\u201d under Assets and Compliance\u201d to a csv file. I needed the devices in a file so I could run other checks for example, to see if the machines were stale in Active Directory, if I could ping them etc\u2026 There may be other reasons you may need this information depending on your environment.<\/p>\n<p>You will need to have the Configuration Manager Module for SCCM 2012 installed to run the following commands. The easiest way to load the Configuration Manager Module is to open the System Center Configuration Manager Console, click the arrow in the left corner and choose \u201cConnect via Windows PowerShell\u201d as shown below.<\/p>\n<p><img decoding=\"async\" style=\"display: inline;\" alt=\"\" src=\"https:\/\/pipe2text.com\/wp-content\/plugins..\/..\/uploads\/media\/using-powershell-export-devices-in-need-of-the-sccm-2012-client-to-a-csv-file\/image1.png\" \/><\/p>\n<p>When PowerShell opens, you can type the following command to get all the devices in the SCCM 2012 console that do not currently have an agent installed and view the output in the PowerShell window (I will show you how to Export it to csv in a\u00a0later example). In this example we are using the &#8220;Get-CMDevice&#8221; cmdlet and piping to the &#8220;Where-Object&#8221; cmdlet to say only choose machines where the &#8220;ClientType&#8221; property is empty or null. Depending on how many devices you have the time this may take to run\u00a0will vary.<\/p>\n<p>Get-CMDevice | Where-Object {$_.ClientType -eq $null}<\/p>\n<p>After the command above completes you will see a list of the machines without the client and all the associated properties. As you can see, this may be too much information. In the example below I will select the 3 properties that I want to view (Name, DeviceOS, LatestProcessingAttempt) and export the information to a csv file using the Export-Csv cmdlet. I will export the information to a file named exportnoclient.csv in the c:\\output directory. I add in the \u2013NoTypeInformation parameter so we don\u2019t get the type information at the top of the\u00a0csv file.<\/p>\n<p>Get-CMDevice | where-object {$_.ClientType -eq $null} |select Name,DeviceOS,LatestProcessingAttempt | Export-Csv c:\\output\\exportnoclient.csv \u2013NoTypeInformation<\/p>\n<p>After you run this command adding in the properties that you would like to see, you will have all the information in a file and you can open it in Excel or do whatever you would like with it. You could also manipulate this command to search for devices with other property settings. To get more information about the Get-CMDevice cmdlet you can simply type &#8220;Get-Help Get-CMDevice&#8221;. To get a list of other cmdlets available in the Configuration Manager PowerShell Module you can type the following with the module loaded:<\/p>\n<p>Get-Command -Module ConfigurationManager<\/p>\n<p>I hope this helps! If you have any questions or feedback, please leave a comment.<\/p>\n<p>Related Links:<\/p>\n<p><strong><a title=\"Using PowerShell to find Stale Computers in Active Directory\" href=\"https:\/\/pipe2text.com\/?page_id=121\">Using PowerShell to find Stale Computers\u00a0in Active Directory<\/a><\/strong><\/p>\n<p><strong><a title=\"Using PowerShell to Create Multiple Device Collections in SCCM 2012 R2 Based on Active Directory Organizational Units (OUs)\" href=\"https:\/\/pipe2text.com\/?page_id=2786\">Using PowerShell to Create Multiple Device Collections in SCCM 2012 R2 Based on Active Directory Organizational Units (OUs)<\/a><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi All, In a recent deployment of SCCM 2012, I had a percentage of devices showing up under \u201cAssets and Compliance\u201d that did not have the SCCM client installed. Before troubleshooting each individual machine, I wanted to dump all machines &hellip; <a href=\"https:\/\/pipe2text.com\/?page_id=2402\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","footnotes":""},"class_list":["post-2402","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/pages\/2402","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/pipe2text.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2402"}],"version-history":[{"count":7,"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/pages\/2402\/revisions"}],"predecessor-version":[{"id":2828,"href":"https:\/\/pipe2text.com\/index.php?rest_route=\/wp\/v2\/pages\/2402\/revisions\/2828"}],"wp:attachment":[{"href":"https:\/\/pipe2text.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}