{"id":14853,"date":"2024-12-03T21:53:16","date_gmt":"2024-12-03T18:53:16","guid":{"rendered":"https:\/\/sarzimanli.com\/?p=14853"},"modified":"2024-12-15T22:01:10","modified_gmt":"2024-12-15T19:01:10","slug":"vmware-unregistered-vms","status":"publish","type":"post","link":"https:\/\/sarzimanli.com\/index.php\/2024\/12\/03\/vmware-unregistered-vms\/","title":{"rendered":"Vmware Kay\u0131tl\u0131 Olmayan Sanal Makinelerin Tespiti ve Raporlanmas\u0131"},"content":{"rendered":"\n<p>VMware ortamlar\u0131nda, kay\u0131tl\u0131 olmayan sanal makineleri (VM) tespit etmek i\u00e7in PowerCLI kullanarak veri depolar\u0131n\u0131 tarayabilirsiniz. Bu i\u015flemler \u00f6zellikle veri merkezi y\u00f6netiminde d\u00fczenin sa\u011flanmas\u0131 a\u00e7\u0131s\u0131ndan \u00f6nemlidir.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>PowerCLI Script \u00d6rne\u011fi<\/strong><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>Removed $ErrorActionPreference = \"Stop\" since it is not required.\nRemoved $VMs = Get-VM since it's not required.\nAdded $VMXS = Get-ChildItem -Path TgtDS: -Recurse -Filter *.vmx | Where-Object {$_.name -notmatch \"vCLS-*\"} In order to remove all vCLS VMs from the results.\n\nBelow is the final script:\n\n Mind giving it a quick sanity check and suggesting any improvements?\n\n$Datastores = get-datastore\n$unregistered = @()\nForEach ($datastore in $datastores) {\n    $psds = Get-Datastore -Name $datastore\n    New-PSDrive -Name TgtDS -Location $psds -PSProvider VimDatastore -Root '\\' | Out-Null\n    $VMXS = Get-ChildItem -Path TgtDS: -Recurse -Filter *.vmx | Where-Object {$_.name -notmatch \"vCLS-*\"}\n    foreach ($VMX in $VMXS) {\n            try {\n                Get-VM -datastore $datastore -name $VMX.name.replace('.vmx','') -ErrorAction:Stop | Out-Null\n                } \n            catch {\n                $unregistered += &#91;PSCustomObject] @{\n                    Name = $vmx.Name\n                    DatastoreFullPath = $vmx.DatastoreFullPath\n                    LastWriteTime = $vmx.LastWriteTime\n                }\n            }\n        }\n        Remove-PSDrive -Name TgtDS\n}\n$unregistered | export-csv -Path C:\\output\\UnregisteredVms1.csv -NoTypeInformation\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Sonu\u00e7<\/strong><\/h4>\n\n\n\n<p>Script, t\u00fcm veri depolar\u0131n\u0131 tarayarak kay\u0131tl\u0131 olmayan VM\u2019leri tespit eder ve bunlar\u0131 CSV format\u0131nda bir rapor dosyas\u0131na kaydeder. Raporlama, sistem y\u00f6neticilerine ortam d\u00fczenini sa\u011flama ve kay\u0131t d\u0131\u015f\u0131 VM\u2019leri y\u00f6netme f\u0131rsat\u0131 sunar.<\/p>\n\n\n\n<p>K\u0131saca, bu y\u00f6ntemle VMware altyap\u0131n\u0131z\u0131 daha verimli bir \u015fekilde y\u00f6netebilirsiniz.<\/p>\n\n\n\n<p><a href=\"https:\/\/community.broadcom.com\/vmware-cloud-foundation\/discussion\/create-a-report-of-all-unregistered-vms#bmfaa13653-e179-4a6b-96e9-8a334c3b052f\">Create a report of all unregistered VMs | Automation<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>VMware ortamlar\u0131nda, kay\u0131tl\u0131 olmayan sanal makineleri (VM) tespit etmek i\u00e7in PowerCLI kullanarak veri depolar\u0131n\u0131 [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":14711,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[372],"tags":[],"class_list":["post-14853","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vmware"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/sarzimanli.com\/index.php\/wp-json\/wp\/v2\/posts\/14853","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sarzimanli.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sarzimanli.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sarzimanli.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sarzimanli.com\/index.php\/wp-json\/wp\/v2\/comments?post=14853"}],"version-history":[{"count":2,"href":"https:\/\/sarzimanli.com\/index.php\/wp-json\/wp\/v2\/posts\/14853\/revisions"}],"predecessor-version":[{"id":14855,"href":"https:\/\/sarzimanli.com\/index.php\/wp-json\/wp\/v2\/posts\/14853\/revisions\/14855"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sarzimanli.com\/index.php\/wp-json\/wp\/v2\/media\/14711"}],"wp:attachment":[{"href":"https:\/\/sarzimanli.com\/index.php\/wp-json\/wp\/v2\/media?parent=14853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sarzimanli.com\/index.php\/wp-json\/wp\/v2\/categories?post=14853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sarzimanli.com\/index.php\/wp-json\/wp\/v2\/tags?post=14853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}