Skip to content

Instantly share code, notes, and snippets.

@OmerMicrosoft
OmerMicrosoft / Create-ClientsWithNoAssociatedSiteReport.ps1
Last active July 3, 2023 18:37
Create Clients With No Associated Site Report
#Get Domain Controllers for current domain
$DCs = Get-ADGroupMember "Domain Controllers"
#Initiate the clients array
$Clients = @()
Foreach ($DC in $DCs) {
#Define the netlogon.log path
$NetLogonFilePath = "\\" + $DC.Name + "\C$\Windows\debug\netlogon.log"
#Reading the content of the netlogon.log file
try {$NetLogonFile = Get-Content -Path $NetLogonFilePath -ErrorAction Stop}
catch {"Error reading $NetLogonFilePath"}
@OmerMicrosoft
OmerMicrosoft / Create-DomainControllersRolesReport.ps1
Last active July 3, 2023 18:37
Get Installed Windows Roles on each Domain Controller
#Get Installed Roles on each Domain Controller
$DCsInForest = (Get-ADForest).Domains | % {Get-ADDomainController -Filter * -Server $_}
$DCsRolesArray = @()
foreach ($DC in $DCsInForest) {
$DCRoles=""
$Roles = Get-WindowsFeature -ComputerName $DC.HostName | Where-Object {$_.Installed -like "True" -and $_.FeatureType -like "Role"} | Select DisplayName
foreach ($Role in $Roles) {
$DCRoles += $Role.DisplayName +","
}
try {$DCRoles = $DCRoles.Substring(0,$DCRoles.Length-1)}