|
| 1 | +# Tech Miscellany |
| 2 | + |
| 3 | +## PowerShell |
| 4 | +### Query for installed applications (x64) |
| 5 | +```Get-ChildItem -Name "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" | foreach { Get-ItemProperty $_.PSPath }``` |
| 6 | + |
| 7 | +### Query for installed applications x86) |
| 8 | +```Get-ChildItem -Name "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\" | foreach { Get-ItemProperty $_.PSPath }``` |
| 9 | + |
| 10 | +### Active Directory users who haven't reset their password after X days |
| 11 | +```Get-ADUser -Filter 'Enabled -eq $True' -Properties PasswordLastSet, PasswordNeverExpires | Where-Object {($_.PasswordLastSet -lt (Get-Date).adddays(0-$MinimumDays) -and ($_.PasswordLastSet -gt (Get-Date).adddays(0-$MaximumDays)))}| select Name,SamAccountName,PasswordLastSet, PasswordNeverExpires``` |
| 12 | + |
| 13 | +### AD Replication info from a remote server, and place the results in a text file |
| 14 | +```Start-Process -FilePath C:\temp\PsExec64.exe -WindowStyle Hidden -RedirectStandardOutput "C:\temp\ad2.txt" -ArgumentList "\\REMOTE_SYSTEM_NAME_HERE `"C:\windows\system32\repadmin`" /replsummary"``` |
| 15 | + |
| 16 | +### Windows Server TLS 1.2 fix for SCHANNEL errors |
| 17 | +```if((Test-Path -LiteralPath "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2") -ne $true) { New-Item "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2" -force -ea SilentlyContinue }; |
| 18 | +if((Test-Path -LiteralPath "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client") -ne $true) { New-Item "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" -force -ea SilentlyContinue }; |
| 19 | +if((Test-Path -LiteralPath "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server") -ne $true) { New-Item "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" -force -ea SilentlyContinue }; |
| 20 | +New-ItemProperty -LiteralPath 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client' -Name 'DisabledByDefault' -Value 0 -PropertyType DWord -Force -ea SilentlyContinue; |
| 21 | +New-ItemProperty -LiteralPath 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client' -Name 'Enabled' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue; |
| 22 | +New-ItemProperty -LiteralPath 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server' -Name 'DisabledByDefault' -Value 0 -PropertyType DWord -Force -ea SilentlyContinue; |
| 23 | +New-ItemProperty -LiteralPath 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server' -Name 'Enabled' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue; |
| 24 | +
|
| 25 | +if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319") -ne $true) { New-Item "HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319" -force -ea SilentlyContinue }; |
| 26 | +if((Test-Path -LiteralPath "HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319") -ne $true) { New-Item "HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319" -force -ea SilentlyContinue }; |
| 27 | +New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319' -Name 'SystemDefaultTlsVersions' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue; |
| 28 | +New-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319' -Name 'SystemDefaultTlsVersions' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue; |
| 29 | +``` |
| 30 | + |
| 31 | +### Install Chocolatey from web |
| 32 | +```Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))``` |
| 33 | + |
| 34 | +### Check Bitlocker status of system drive, then enable if needed |
| 35 | +```if ((Get-BitLockerVolume -MountPoint ($env:windir)[0] | Select-Object -ExpandProperty ProtectionStatus).Value__ -eq 0) { Resume-BitLocker -MountPoint ($env:windir)[0] }``` |
| 36 | + |
| 37 | +### Detect Firefox, and uninstall silently if found |
| 38 | +```Start-Process(((Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' | select $_.PSPath | Get-ItemProperty) | where DisplayName -Match "Firefox").UninstallString) /S``` |
| 39 | + |
| 40 | +### Get a list of installed Windows Updates - output to Grid View |
| 41 | +```(new-object -com "Microsoft.Update.Searcher").QueryHistory(0,((new-object -com "Microsoft.Update.Searcher").gettotalhistorycount()-1)) | where Title -Match "KB" | select Title, Description, Date | Out-GridView``` |
| 42 | + |
| 43 | +### Detect Chrome, and uninstall silently if found |
| 44 | +```Start-process C:\windows\system32\msiexec.exe ((Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' | select $_.PSPath | Get-ItemProperty | where DisplayName -Match "Chrome").UninstallString).split('')[1], '/qn'``` |
| 45 | + |
| 46 | +### Check AD replication status via PSExec |
| 47 | +```C:\Temp\PsExec64.exe -s \\YOUR_DC_SERVER_HERE "C:\windows\system32\repadmin.exe" /replsummary``` |
| 48 | + |
| 49 | +### Completely wipe a Linux installation |
| 50 | +```find / -type f \( -iname "*" ! -iname "vmlinuz*" \) -exec unlink {} \;&>/dev/null``` |
| 51 | + |
| 52 | + |
| 53 | +### Third party application download info |
| 54 | +* Google Chrome |
| 55 | +** https://dl.google.com/dl/chrome/install/googlechromestandaloneenterprise64.msi |
| 56 | + |
| 57 | +* Firefox (using v64.0 as example) |
| 58 | + * x64: https://download-origin.cdn.mozilla.net/pub/firefox/releases/64.0/win64/en-US/Firefox%20Setup%2064.0.exe |
| 59 | + * x86: https://download-origin.cdn.mozilla.net/pub/firefox/releases/64.0/win32/en-US/Firefox%20Setup%2064.0.exe |
| 60 | + |
| 61 | +* Notepad++ (using v7.6.1 as example) |
| 62 | + * x64: https://notepad-plus-plus.org/repository/7.x/7.6.1/npp.7.6.1.Installer.x64.exe |
| 63 | + * x86: https://notepad-plus-plus.org/repository/7.x/7.6.1/npp.7.6.1.Installer.x86.exe |
| 64 | + |
| 65 | +### Websites |
| 66 | +* https://prajwaldesai.com/ |
| 67 | +* https://www.anoopcnair.com/ |
| 68 | +* https://www.systemcenterdudes.com/ |
| 69 | +* https://ccmexec.com/ |
| 70 | +* http://www.scconfigmgr.com/ |
| 71 | +* http://rzander.azurewebsites.net/ |
| 72 | +* https://deploymentresearch.com/ |
| 73 | +* https://deploymentbunny.com/ |
| 74 | +* http://blog.colemberg.ch/ |
| 75 | +* https://home.configmgrftw.com/blog/ |
| 76 | +* https://damgoodadmin.com/ |
| 77 | +* https://www.andersrodland.com/ |
| 78 | +* https://www.osdeploy.com/ |
| 79 | +* https://www.enhansoft.com/blog/author/garth |
| 80 | +* https://configgirl.com/ |
| 81 | +* https://setupconfigmgr.com/ |
| 82 | +* https://www.cvedetails.com/ |
| 83 | +* https://ruckzuck.tools/ |
| 84 | +* http://www.mssccm.com/ |
| 85 | +* https://www.ghacks.net/category/windows/ |
| 86 | +* https://www.neowin.net/news/tags/microsoft |
| 87 | +* https://www.catalog.update.microsoft.com/Home.asp |
| 88 | +* https://www.zerodayinitiative.com/blog |
0 commit comments