Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

use powershell to work with dcdiag

$
0
0

Hi,

I find the following script to work with DCDIAG in english environment

function Invoke-DcDiag {
    param(
        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        [string]$DomainController
    )
 
    $result = dcdiag /s:$DomainController
    $result | select-string -pattern '\. (.*) \b(passed|failed)\b test (.*)' | foreach {
        $obj = @{
            TestName = $_.Matches.Groups[3].Value
            TestResult = $_.Matches.Groups[2].Value
            Entity = $_.Matches.Groups[1].Value
        }
        [pscustomobject]$obj
    }
}

And the result is :

It works good but I'm in french language and I don't know how to do for it to work.

In english, dcdiag is like this :

In french it's like this :

I know I have to change this line :

select-string -pattern '\. (.*) \b(passed|failed)\b test (.*)'

but I don' tknow exactly what I have to change.  (passed, failed, test but not only this)


Merci de marquer comme reponses les interventions qui vous ont ete utile.


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>