User Tools

Site Tools


powershell_cheat_sheet

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
powershell_cheat_sheet [2020/12/07 18:24] stephenpowershell_cheat_sheet [2021/04/13 21:53] (current) – external edit 127.0.0.1
Line 59: Line 59:
 </code> </code>
  
-===== Search installed certs for thumbprint =====+===== Certificates ===== 
 + 
 +Search by thumbprint:
  
 <code powershell> <code powershell>
Line 69: Line 71:
 <code powershell> <code powershell>
 Get-ChildItem -Path Cert: -Recurse | Where-Object { $_.Thumbprint -and $_.Thumbprint.ToLower().StartsWith('c4') } | Test-Certificate Get-ChildItem -Path Cert: -Recurse | Where-Object { $_.Thumbprint -and $_.Thumbprint.ToLower().StartsWith('c4') } | Test-Certificate
 +</code>
 +
 +To check for expired / revoked certs:
 +
 +<code powershell>
 +$certs = Get-ChildItem -Path Cert:\LocalMachine\My -Recurse
 +foreach ($cert in $certs) {
 +    Write-Host "$($cert.Thumbprint) $($cert.Subject)"
 + 
 +    if ($certs.NotAfter -lt (Get-Date)) {
 +        Write-Host "    Expired on $($certs.NotAfter)" -ForegroundColor Red
 +    }
 +    elseif ($cert | Test-Certificate) {
 +        Write-Host "    Tested ok." -ForegroundColor Green
 +    }
 +}
 </code> </code>
  
Line 86: Line 104:
   - Run ''Get-PSRepository'' again to verify.   - Run ''Get-PSRepository'' again to verify.
   - Once installation is complete, comment out commands and change password.   - Once installation is complete, comment out commands and change password.
 +
 +If this doesn't work, and it won't for an ANZ Dev VM, try the [[powershell_manual_module_installation|PowerShell Manual Module Installation]].
  
 ===== No Sleep ===== ===== No Sleep =====
powershell_cheat_sheet.1607365480.txt.gz · Last modified: 2020/12/08 19:24 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki