powershell

sethayes

·

step03

·

Powershell

·

Total Size: 1.95 KB

·

·

Created: 5 years ago

·

Edited: 5 years ago

[bool]$restart = $false $Log = "C:\Users\Public\Log.txt" filter timestamp {"$(Get-Date -Format G) | $_"} $trust = Test-ComputerSecureChannel If (!($trust)) { Write-Output "Trust Relationship is Broken. Trying to Repair Now..." | timestamp Write-Output "Trust Relationship is Broken. Trying to Repair Now..." | timestamp | Out-File $Log -Append Test-ComputerSecureChannel -Repair $reTrust = Test-ComputerSecureChannel If (!($reTrust)) { Write-Output "...Trust Relationship is Still Broken. Trying a Different Repair Method Now..." | timestamp Write-Output "...Trust Relationship is Still Broken. Trying a Different Repair Method Now..." | timestamp | Out-File $Log -Append $un = "$env:USERDOMAIN\msi" $pw = ConvertTo-SecureString -String "iC2JP!yR" -AsPlainText -Force $admin = New-Object System.Management.Automation.PSCredential($un,$pw) Reset-ComputerMachinePassword -Server ECSDC01 -Credential $admin $trust3 = Test-ComputerSecureChannel If ($trust3) { Write-Output "...Trust Relationship is Fixed." | timestamp Write-Output "...Trust Relationship is Fixed." | timestamp | Out-File $Log -Append } Else { Write-Output "...Could NOT Fix Trust Relationship. Manual effort is Required" | timestamp Write-Output "...Could NOT Fix Trust Relationship. Manual effort is Required" | timestamp | Out-File $Log -Append } } Else { Write-Output "...Trust Relationship is Fixed." | timestamp Write-Output "...Trust Relationship is Fixed." | timestamp | Out-File $Log -Append } } Else { Write-Output "Trust Relationship is NOT Broken" | timestamp Write-Output "Trust Relationship is NOT Broken" | timestamp | Out-File $Log -Append } If (Test-Path C:\Users\Public\step04.ps1) { & C:\Users\Public\step04.ps1 }

1 bit

1527 views

Are you sure you want to delete?