1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| $varCheminRepertoireScript = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Definition)
if (!(Test-ComputerSecureChannel))
{
$PassKey = [byte]12,13,58,11,34,67,91,12,20,96,82
$username = “Domaine\User”
$password = Get-Content "$env:${varCheminRepertoireScript}\Password.ps1"| Convertto-SecureString -Key $PassKey
$Credentials = New-Object System.Management.Automation.PSCredential -argumentlist ($username,$password)
Test-ComputerSecureChannel -repair -credential $Credentials
}
if (!(Test-ComputerSecureChannel))
{Add-Type -AssemblyName PresentationCore,PresentationFramework
$ButtonType = [System.Windows.MessageBoxButton]::OK
$MessageboxTitle = “Test-ComputerSecureChannel”
$Messageboxbody = "Repair failed”
$MessageIcon = [System.Windows.MessageBoxImage]::Warning
[System.Windows.MessageBox]::Show($Messageboxbody,$MessageboxTitle,$ButtonType,$messageicon) }
else
{Add-Type -AssemblyName PresentationCore,PresentationFramework
$ButtonType = [System.Windows.MessageBoxButton]::OK
$MessageboxTitle = “Test-ComputerSecureChannel”
$Messageboxbody = "Test-ComputerSecureChannel succeed”
$MessageIcon = [System.Windows.MessageBoxImage]::Information
[System.Windows.MessageBox]::Show($Messageboxbody,$MessageboxTitle,$ButtonType,$messageicon) }
Test-ComputerSecureChannel -Verbose
pause "Press any key to continue" |
Partager