Closed Fiyorden closed 4 years ago
Looks good. On a side note, does DCDiagnostics source works fine on non-english system?
Only with repadmin on file ReplicationStatus.ps1
what about this one: Test-ADDomainController -ComputerName $DomainController -WarningAction SilentlyContinue
Hello no message C:\Users\administrateur.XXXX> Test-ADDomainController -ComputerName localhost -WarningAction SilentlyContinue C:\Users\administrateur.XXX> Test-ADDomainController -ComputerName localhost
ok, that means dcdiag output must be different in non-english systems.
function Test-ADDomainController {
[CmdletBinding()]
param([string[]] $ComputerName,
[Parameter(Mandatory = $false)][PSCredential] $Credential = $null)
$CredentialParameter = @{ }
if ($null -ne $Credential) { $CredentialParameter['Credential'] = $Credential }
$Output = foreach ($Computer in $ComputerName) {
$Result = Invoke-Command -ComputerName $Computer -ScriptBlock { dcdiag.exe /v /c /Skip:OutboundSecureChannels } @CredentialParameter
for ($Line = 0; $Line -lt $Result.length; $Line++) {
if ($Result[$Line] -match '^\s{9}.{25} (\S+) (\S+) test$') { $Result[$Line] = $Result[$Line] + ' ' + $Result[$Line + 2].Trim() }
if ($Result[$Line] -match '^\s{6}Starting test: \S+$') { $LineStart = $Line }
if ($Result[$Line] -match '^\s{9}.{25} (\S+) (\S+) test (\S+)$') {
$DiagnosticResult = [PSCustomObject] @{ComputerName = $Computer
Target = $Matches[1]
Test = $Matches[3]
Result = $Matches[2] -eq 'passed'
Data = $Result[$LineStart..$Line] -join [System.Environment]::NewLine
}
$DiagnosticResult
}
}
}
$Output
}
The command is really simple and works with english. Would it be possible for you to run this:
dcdiag.exe /v /c /Skip:OutboundSecureChannels
and provide output in a text file? Of course with replaced details for computer name/domain
To make it work on non-English speaking windows server