{"id":50,"date":"2025-04-08T19:50:01","date_gmt":"2025-04-08T19:50:01","guid":{"rendered":"https:\/\/burlage.it\/?p=50"},"modified":"2025-04-17T14:59:51","modified_gmt":"2025-04-17T14:59:51","slug":"mggraph-device","status":"publish","type":"post","link":"https:\/\/burlage.it\/index.php\/2025\/04\/08\/mggraph-device\/","title":{"rendered":"MgGraph &#8211; Device"},"content":{"rendered":"\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"# MgGraph - Lookup a device by name\n$deviceName = 'ComputerName'\nGet-MgDeviceManagementManagedDevice -Filter &quot;deviceName eq '$deviceName'&quot;\n\n# MgGraph - Lookup all details of a device\n$deviceName = 'ComputerName'\nGet-MgDeviceManagementManagedDevice -Filter &quot;deviceName eq '$deviceName'&quot; | Format-List\n\n# MgGraph - Display all Managed Devices\nGet-MgDeviceManagementManagedDevice -All \n\n# MgGraph - Count the numbers of Managed Device\n$devices = Get-MgDeviceManagementManagedDevice -All\n$devices.Count\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #6A9955\"># MgGraph - Lookup a device by name<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$deviceName<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #CE9178\">&#39;ComputerName&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">Get-MgDeviceManagementManagedDevice<\/span><span style=\"color: #D4D4D4\"> -Filter <\/span><span style=\"color: #CE9178\">&quot;deviceName eq &#39;<\/span><span style=\"color: #9CDCFE\">$deviceName<\/span><span style=\"color: #CE9178\">&#39;&quot;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\"># MgGraph - Lookup all details of a device<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$deviceName<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #CE9178\">&#39;ComputerName&#39;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">Get-MgDeviceManagementManagedDevice<\/span><span style=\"color: #D4D4D4\"> -Filter <\/span><span style=\"color: #CE9178\">&quot;deviceName eq &#39;<\/span><span style=\"color: #9CDCFE\">$deviceName<\/span><span style=\"color: #CE9178\">&#39;&quot;<\/span><span style=\"color: #D4D4D4\"> | <\/span><span style=\"color: #DCDCAA\">Format-List<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\"># MgGraph - Display all Managed Devices<\/span><\/span>\n<span class=\"line\"><span style=\"color: #DCDCAA\">Get-MgDeviceManagementManagedDevice<\/span><span style=\"color: #D4D4D4\"> -All <\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\"># MgGraph - Count the numbers of Managed Device<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$devices<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #DCDCAA\">Get-MgDeviceManagementManagedDevice<\/span><span style=\"color: #D4D4D4\"> -All<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$devices<\/span><span style=\"color: #DCDCAA\">.Count<\/span><\/span><\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-50","post","type-post","status-publish","format-standard","hentry","category-powershell"],"_links":{"self":[{"href":"https:\/\/burlage.it\/index.php\/wp-json\/wp\/v2\/posts\/50","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/burlage.it\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/burlage.it\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/burlage.it\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/burlage.it\/index.php\/wp-json\/wp\/v2\/comments?post=50"}],"version-history":[{"count":3,"href":"https:\/\/burlage.it\/index.php\/wp-json\/wp\/v2\/posts\/50\/revisions"}],"predecessor-version":[{"id":53,"href":"https:\/\/burlage.it\/index.php\/wp-json\/wp\/v2\/posts\/50\/revisions\/53"}],"wp:attachment":[{"href":"https:\/\/burlage.it\/index.php\/wp-json\/wp\/v2\/media?parent=50"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/burlage.it\/index.php\/wp-json\/wp\/v2\/categories?post=50"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/burlage.it\/index.php\/wp-json\/wp\/v2\/tags?post=50"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}