elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado:


  Mostrar Temas
Páginas: [1]
1  Programación / Scripting / [Powershell] Pequeña función para comprobar si un dominio tiene registros MX en: 3 Septiembre 2014, 00:44 am
Comparto esta sencilla función que podéis implementar en vuestros scripts en PowerShell para comprobar si existe algún registro MX en un dominio.

Código:
function compE{
    param([String]$dominio);
    $existe = 0;
    $cont=0;
    Invoke-Expression -Command "nslookup -type=mx $dominio" 2>$null | foreach-object {
        $filas =  $($_);
        $filtrar = $filas -match 'mail exchanger';
        if($filtrar){
            $cont++;
        }
    }
    if($cont-ge 1){
        $existe=1;
    }else{
        $existe=0;
    }
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines