powershell_cheat_sheet
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| powershell_cheat_sheet [2020/11/22 19:40] – stephen | powershell_cheat_sheet [2021/04/13 21:53] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 59: | Line 59: | ||
| </ | </ | ||
| - | ===== 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(' | Get-ChildItem -Path Cert: -Recurse | Where-Object { $_.Thumbprint -and $_.Thumbprint.ToLower().StartsWith(' | ||
| + | </ | ||
| + | |||
| + | To check for expired / revoked certs: | ||
| + | |||
| + | <code powershell> | ||
| + | $certs = Get-ChildItem -Path Cert: | ||
| + | foreach ($cert in $certs) { | ||
| + | Write-Host " | ||
| + | |||
| + | if ($certs.NotAfter -lt (Get-Date)) { | ||
| + | Write-Host " | ||
| + | } | ||
| + | elseif ($cert | Test-Certificate) { | ||
| + | Write-Host " | ||
| + | } | ||
| + | } | ||
| </ | </ | ||
| Line 87: | Line 105: | ||
| - Once installation is complete, comment out commands and change password. | - Once installation is complete, comment out commands and change password. | ||
| + | If this doesn' | ||
| + | ===== No Sleep ===== | ||
| + | |||
| + | May only work inside Windows Powershell ISE. | ||
| + | |||
| + | <code powershell> | ||
| + | $intervalSeconds = 60 | ||
| + | $mouseDistance = 1 | ||
| + | |||
| + | $myshell = New-Object -com " | ||
| + | while ($true) { | ||
| + | Start-Sleep -Seconds $intervalSeconds | ||
| + | $Pos = [System.Windows.Forms.Cursor]:: | ||
| + | [System.Windows.Forms.Cursor]:: | ||
| + | [System.Windows.Forms.SendKeys]:: | ||
| + | Write-Host 'A shuffle to the right.' | ||
| + | Start-Sleep -Seconds $intervalSeconds | ||
| + | $Pos = [System.Windows.Forms.Cursor]:: | ||
| + | [System.Windows.Forms.Cursor]:: | ||
| + | [System.Windows.Forms.SendKeys]:: | ||
| + | Write-Host 'A shuffle to the left.' | ||
| + | } | ||
| + | </ | ||
| ===== Text Processing ===== | ===== Text Processing ===== | ||
powershell_cheat_sheet.1606074044.txt.gz · Last modified: 2020/11/23 20:40 (external edit)
