{"id":44,"title":"PowerShell ile Active Directory say\u0131s\u0131n\u0131 alma","content":"Active Directory nesneleri nas\u0131l say\u0131l\u0131r ve neden AD nesneleri say\u0131m\u0131na ihtiyac\u0131m\u0131z var? \u00d6rne\u011fimizde,\u00a0<a href=\"https:\/\/ondernet.net\/microsoft-entra-connect-nasil-yukseltilir\/\">Microsoft Entra Connect'i y\u00fcklemeden ve yap\u0131land\u0131rmadan<\/a>\u00a0\u00f6nce toplam say\u0131ya sahip olmak istiyoruz. Bunun nedeni, minimum sunucu gereksinimleri i\u00e7in toplam AD nesnelerini bilmemiz gerekti\u011fidir. Bu yaz\u0131da, PowerShell ile AD nesnelerinin nas\u0131l say\u0131laca\u011f\u0131na bakaca\u011f\u0131z. <h2>\u0130\u00e7indekiler<\/h2> <ul> <li>AD kullan\u0131c\u0131lar\u0131n\u0131 sayma<\/li> <li>AD gruplar\u0131n\u0131 sayma<\/li> <li>AD bilgisayarlar\u0131n\u0131 sayma<\/li> <li>AD toplam say\u0131s\u0131n\u0131 alma<\/li> <li>PowerShell beti\u011fi ile Active Directory bilgilerini alma<\/li> <li>Son<\/li> <\/ul> <h2  >AD kullan\u0131c\u0131lar\u0131n\u0131 sayma<\/h2> PowerShell ile AD kullan\u0131c\u0131lar\u0131n\u0131 say\u0131n.\u00a0<a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/activedirectory\/get-aduser\" target=\"_blank\" rel=\"noreferrer noopener\">Get-AdUser<\/a>\u00a0cmdlet'ini kullan\u0131n. <div > <pre  tabindex=\"0\"><code ><span >(<\/span>Get<span >-<\/span>AdUser <span >-<\/span><span >Filter<\/span> <span >*<\/span> <span >|<\/span> <span >Measure-Object<\/span><span >)<\/span><span >.<\/span>Count <\/code><\/pre> <h2  >AD gruplar\u0131n\u0131 sayma<\/h2> <p >PowerShell ile AD gruplar\u0131n\u0131 say\u0131n.\u00a0<a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/activedirectory\/get-adgroup\" target=\"_blank\" rel=\"noreferrer noopener\">Get-ADGroup<\/a>\u00a0cmdlet'ini kullan\u0131n.<\/p> (Get-ADGroup -Filter * | Measure-Object).Count <h2  >AD bilgisayarlar\u0131n\u0131 sayma<\/h2> <p data-slot-rendered-content=\"true\">PowerShell ile AD bilgisayarlar\u0131n\u0131 say\u0131n.\u00a0<a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/activedirectory\/get-adcomputer\" target=\"_blank\" rel=\"noreferrer noopener\">Get-ADComputer<\/a>\u00a0cmdlet'ini kullan\u0131n.<\/p> <div  data-slot> <div  data-slot> <div  data-slot> <div  data-slot> <div   data-wrapper=\"content_btf\" data-nosnippet=\"\"> <div   data-google-query->(Get-ADComputer -Filter * | Measure-Object).Count<\/div> <\/div> <div data-google-query-> <h2  >AD toplam say\u0131s\u0131n\u0131 alma<\/h2> PowerShell ile kullan\u0131c\u0131, grup ve bilgisayar say\u0131lar\u0131n\u0131 birlikte ekleyelim. A\u015fa\u011f\u0131daki beti\u011fi kullan\u0131n, kopyalay\u0131p PowerShell'e yap\u0131\u015ft\u0131r\u0131n. Ayr\u0131ca\u00a0Get-ADCount.ps1\u00a0beti\u011fini indirebilir ve PowerShell'den \u00e7al\u0131\u015ft\u0131rabilirsiniz. <pre  data-enlighter-language=\"python\">$ADUser = (Get-AdUser -Filter * | Measure-Object).Count $ADGroup = (Get-ADGroup -Filter * | Measure-Object).Count $ADComputer = (Get-ADComputer -Filter * | Measure-Object).Count $ADObjects = $ADUser + $ADGroup + $ADComputer $ADObjects<\/pre> Komut dosyas\u0131n\u0131 \u00e7al\u0131\u015ft\u0131rd\u0131ktan sonra bu \u015fekilde g\u00f6r\u00fcn\u00fcr. Toplam AD nesnesi say\u0131s\u0131\u00a0<strong>167'dir<\/strong>. <div > <pre  data-enlighter-language=\"python\">PS C:\\&gt; $ADUser = (Get-AdUser -Filter *).Count $ADGroup = (Get-ADGroup -Filter *).Count $ADComputer = (Get-ADComputer -Filter *).Count $ADObjects = $ADUser + $ADGroup + $ADComputer $ADObjects 167<\/pre> <h2  >PowerShell beti\u011fi ile Active Directory bilgilerini alma<\/h2> Active Directory say\u0131s\u0131n\u0131 alman\u0131n m\u00fckemmel bir yolu,\u00a0Get-ADInfo.ps1\u00a0PowerShell beti\u011fini \u00e7al\u0131\u015ft\u0131rmakt\u0131r. Bu, AD\u00a0<a href=\"https:\/\/ondernet.net\/powershell-betigi-ile-active-directory-bilgilerini-alma\/\">nesnelerinin say\u0131s\u0131n\u0131 ve Active Directory'niz hakk\u0131nda daha fazla bilgiyi<\/a>\u00a0g\u00f6sterecektir. <pre  data-enlighter-language=\"python\"># Get counts of different types of objects in Active Directory $Computers = (Get-ADComputer -Filter * | Measure-Object).Count $Workstations = (Get-ADComputer -Filter { OperatingSystem -notlike \"*Server*\" } | Measure-Object).Count $Servers = (Get-ADComputer -Filter { OperatingSystem -like \"*Server*\" } | Measure-Object).Count $Users = (Get-ADUser -Filter * | Measure-Object).Count $Groups = (Get-ADGroup -Filter * | Measure-Object).Count # Get Active Directory Forest information $ADForest = (Get-ADDomain).Forest $ADForestMode = (Get-ADForest).ForestMode $ADDomainMode = (Get-ADDomain).DomainMode # Obtain Active Directory Schema version and translate it to the corresponding Windows Server version $ADVer = Get-ADObject (Get-ADRootDSE).schemaNamingContext -Property objectVersion | Select-Object objectVersion $ADNum = $ADVer -replace \"@{objectVersion=\", \"\" -replace \"}\", \"\" switch ($ADNum) { '91' { $srv = 'Windows Server 2025' } '88' { $srv = 'Windows Server 2019\/Windows Server 2022' } '87' { $srv = 'Windows Server 2016' } '69' { $srv = 'Windows Server 2012 R2' } '56' { $srv = 'Windows Server 2012' } '47' { $srv = 'Windows Server 2008 R2' } '44' { $srv = 'Windows Server 2008' } '31' { $srv = 'Windows Server 2003 R2' } '30' { $srv = 'Windows Server 2003' } } # Display collected information Write-host \"Active Directory Info\" -ForegroundColor Yellow Write-host \"\" Write-Host \"Computers = $Computers\" -ForegroundColor Cyan Write-Host \"Workstions = $Workstations\" -ForegroundColor Cyan Write-Host \"Servers = $Servers\" -ForegroundColor Cyan Write-Host \"Users = $Users\" -ForegroundColor Cyan Write-Host \"Groups = $Groups\" -ForegroundColor Cyan Write-host \"\" Write-Host \"Active Directory Forest Name = \"$ADForest -ForegroundColor Cyan Write-Host \"Active Directory Forest Mode = \"$ADForestMode -ForegroundColor Cyan Write-Host \"Active Directory Domain Mode = \"$ADDomainMode -ForegroundColor Cyan Write-Host \"Active Directory Schema Version is $ADNum which corresponds to $srv\" -ForegroundColor Cyan Write-Host \"\" Write-Host \"FSMO Role Owners\" -ForegroundColor Cyan # Retrieve FSMO roles individually $Forest = Get-ADForest $SchemaMaster = $Forest.SchemaMaster $DomainNamingMaster = $Forest.DomainNamingMaster $Domain = Get-ADDomain $RIDMaster = $Domain.RIDMaster $PDCEmulator = $Domain.PDCEmulator $InfrastructureMaster = $Domain.InfrastructureMaster # Display FSMO role owners Write-Host \"Schema Master = $SchemaMaster\" -ForegroundColor Cyan Write-Host \"Domain Naming Master = $DomainNamingMaster\" -ForegroundColor Cyan Write-Host \"RID Master = $RIDMaster\" -ForegroundColor Cyan Write-Host \"PDC Emulator = $PDCEmulator\" -ForegroundColor Cyan Write-Host \"Infrastructure Master = $InfrastructureMaster\" -ForegroundColor Cyan<\/pre> &nbsp; <\/div> <\/div> <\/div> <\/div> <\/div> <\/div> <\/div>","excerpt":"Active Directory nesneleri nas\u0131l say\u0131l\u0131r ve neden AD nesneleri say\u0131m\u0131na ihtiyac\u0131m\u0131z var? \u00d6rne\u011fimizde,\u00a0Microsoft Entra Connect'i y\u00fcklemeden...","created_at":"2025-06-22 21:48:46","updated_at":"2026-09-06 18:10:16","category_id":6,"view_count":720,"reading_time":3,"status":"published","editor_choice":0,"is_editor_choice":0,"published_at":"2025-06-22 21:48:46","featured_image":"resimyok.jpg","slug":"powershell-ile-active-directory-sayisini-alma","category_name":"Sistem","category_slug":"sistem","category_color":"#3b82f6"}