{"id":39,"title":"PowerShell beti\u011fi ile Active Directory bilgilerini alma","content":"<p>Tek bir &ccedil;\u0131kt\u0131da Active Directory bilgisi nas\u0131l al\u0131n\u0131r? &Ouml;rne\u011fin, Active Directory'yi yeni bir sunucuya ta\u015f\u0131mak istiyorsunuz ve AD bilgilerini almak istiyorsunuz. Veya AD'de ka&ccedil; i\u015f istasyonu, sunucu veya grup bulundu\u011funu bilmek ister misiniz? Bu yaz\u0131da, PowerShell beti\u011fi ile Active Directory bilgilerini nas\u0131l alaca\u011f\u0131n\u0131z\u0131 &ouml;\u011freneceksiniz.<\/p>\r\n<div>\r\n<h2>\u0130&ccedil;indekiler<\/h2>\r\n<ul>\r\n<li>AD bilgilerini alma PowerShell beti\u011fi<\/li>\r\n<li>AD bilgilerini alma PowerShell komut dosyas\u0131n\u0131 indirin<\/li>\r\n<li>AD bilgilerini al PowerShell beti\u011fini &ccedil;al\u0131\u015ft\u0131r\u0131n<\/li>\r\n<li>Son<\/li>\r\n<\/ul>\r\n<\/div>\r\n<h2>AD bilgilerini alma PowerShell beti\u011fi<\/h2>\r\n<p>Get-ADInfo.ps1&nbsp;PowerShell beti\u011fi a\u015fa\u011f\u0131daki AD bilgilerini al\u0131r:<\/p>\r\n<ol>\r\n<li>Bilgisayarlar (\u0130\u015f \u0130stasyonlar\u0131 + Sunucular)<\/li>\r\n<li>I\u015f istasyon -lar\u0131<\/li>\r\n<li>Sunucu<\/li>\r\n<li>Kullan\u0131c\u0131<\/li>\r\n<li>Grup<\/li>\r\n<li>Active Directory orman ad\u0131<\/li>\r\n<li>Active Directory orman modu<\/li>\r\n<li>Active Directory etki alan\u0131 modu<\/li>\r\n<li>Active Directory \u015fema s&uuml;r&uuml;m&uuml;<\/li>\r\n<li>FSMO rol sahipleri<\/li>\r\n<\/ol>\r\n<h2>AD bilgilerini alma PowerShell komut dosyas\u0131n\u0131 indirin<\/h2>\r\n<p data-slot-rendered-content=\"true\">Get-ADInfo.ps1&nbsp;PowerShell beti\u011fini indirin ve&nbsp;<strong>C:\\scripts<\/strong>&nbsp;klas&ouml;r&uuml;ne yerle\u015ftirin. Komut dosyalar\u0131 klas&ouml;r&uuml;n&uuml;z yoksa bir tane olu\u015fturun.<\/p>\r\n<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>\r\n<p>Komut dosyas\u0131n\u0131 &ccedil;al\u0131\u015ft\u0131r\u0131rken herhangi bir hatay\u0131 &ouml;nlemek i&ccedil;in dosyan\u0131n engellemesinin kald\u0131r\u0131ld\u0131\u011f\u0131ndan emin olun.&nbsp;<a href=\"..\/..\/..\/not-digitally-signed-hatasi-powershell-scriptlerini-calistirma-sorunu-ve-cozumleri\/\">PowerShell beti\u011fi &ccedil;al\u0131\u015ft\u0131r\u0131l\u0131rken dijital olarak imzalanmam\u0131\u015f hata<\/a>&nbsp;makalesinde daha fazla bilgi edinin. Di\u011fer bir se&ccedil;enek de a\u015fa\u011f\u0131daki kodu kopyalay\u0131p Not Defteri'ne yap\u0131\u015ft\u0131rmakt\u0131r.&nbsp;<strong>Get-ADInfo.ps1<\/strong>&nbsp;ad\u0131n\u0131 verin ve&nbsp;<strong>C:\\scripts<\/strong>&nbsp;klas&ouml;r&uuml;ne yerle\u015ftirin.<\/p>\r\n<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>\r\n<h2>AD bilgilerini al PowerShell beti\u011fini &ccedil;al\u0131\u015ft\u0131r\u0131n<\/h2>\r\n<p>PowerShell'i y&ouml;netici olarak &ccedil;al\u0131\u015ft\u0131r\u0131n. Ard\u0131ndan, Active Directory bilgilerini toplamak i&ccedil;in PowerShell beti\u011fini &ccedil;al\u0131\u015ft\u0131r\u0131n. C:\\scripts\\.\\Get-ADInfo.ps1 Organizasyonumuzda &ccedil;\u0131kt\u0131 bu \u015fekilde g&ouml;r&uuml;n&uuml;yor.<\/p>\r\n<div data-slot-rendered-content=\"true\">Active Directory Info Computers = 5 Workstions = 1 Servers = 4 Users = 74 Groups = 88 Active Directory Forest Name = onder.local Active Directory Forest Mode = Windows2016Forest Active Directory Domain Mode = Windows2016Domain Active Directory Schema Version is 88 which corresponds to Windows Server 2019\/Windows Server 2022 FSMO Role Owners Schema Master = DC01-2019.onder.local Domain Naming Master = DC01-2019.onder.local RID Master = DC01-2019.onder.local PDC Emulator = DC01-2019.onder.local Infrastructure Master = DC01-2019.onder.local<\/div>\r\n<p>PowerShell beti\u011fi ile Active Directory bilgilerini nas\u0131l alaca\u011f\u0131n\u0131z\u0131 &ouml;\u011frendiniz. Active Directory'de &ccedil;ok fazla bilgi vard\u0131r ve bilgileri PowerShell veya GUI'de tek tek aramak &ccedil;ok zaman al\u0131r. Bir PS komut dosyas\u0131 &ccedil;al\u0131\u015ft\u0131rmak ve hepsini tek bir &ccedil;\u0131kt\u0131da bulundurmak zaman kazand\u0131r\u0131r ve bakmas\u0131 daha kolayd\u0131r.<\/p>","excerpt":"Tek bir \u00e7\u0131kt\u0131da Active Directory bilgisi nas\u0131l al\u0131n\u0131r? \u00d6rne\u011fin, Active Directory'yi yeni bir sunucuya ta\u015f\u0131mak istiyorsunuz ve AD...","created_at":"2025-06-22 22:18:06","updated_at":"2026-09-07 18:13:54","category_id":6,"view_count":874,"reading_time":5,"status":"published","editor_choice":0,"is_editor_choice":0,"published_at":"2025-06-22 22:18:06","featured_image":"resimyok.jpg","slug":"powershell-betigi-ile-active-directory-bilgilerini-alma","category_name":"Sistem","category_slug":"sistem"}