Created
October 24, 2020 19:47
-
-
Save raulunzue/bb5bae558f6fcf6e55af9d7ab54307e8 to your computer and use it in GitHub Desktop.
Powershell para poder buscar setting en Active Directory: https://www.maquinasvirtuales.eu/powershell-buscar-setting-especifica-de-gpo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################# | |
## Raúl Unzué - El Blog de Negu | |
## Script buscar Setting GPO | |
################################# | |
## NOMBRE DE LA SETTING | |
$Setting = "Enable search roaming" | |
## NOMBRE DEL DOMINIO | |
$Dominio = "negu.local" | |
## NOMBRE DEL CONTROLADOR | |
$NeguDC = (Get-ADDomainController -Discover -NextClosestSite).Name | |
# OBTENER TODA LA LISTA DE GPOS DEL DIRECTORIO ACTIVO | |
$GPOs = Get-GPO -All -Domain $Dominio -Server $NeguDC | sort DisplayName | |
# BUSCAMOS LA SETTING EN LAS GPOS LISTADAS | |
Foreach ($GPO in $GPOs) { | |
Write-Host "Revisando GPO - $($GPO.DisplayName)" | |
# EXTRAEMOS UN REPORT | |
$CurrentGPOReport = Get-GPOReport -Guid $GPO.Id -ReportType Xml -Domain $Dominio -Server $NeguDC | |
If ($CurrentGPOReport -match $Setting) { | |
Write-Host "Setting ""$($Setting)"" detectada. Datos de la setting:" -Foregroundcolor Red | |
Write-Host "- GPO Nombre: $($GPO.DisplayName)" -Foregroundcolor Green | |
Write-Host "- GPO Id: $($GPO.Id)" -Foregroundcolor Green | |
Write-Host "- GPO Estado: $($GPO.GpoStatus)" -Foregroundcolor Green | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment