Skip to content

Instantly share code, notes, and snippets.

View eizedev's full-sized avatar

René eizedev

  • Germany
  • 00:45 (UTC +02:00)
View GitHub Profile
@eizedev
eizedev / Get-LinuxUsers.ps1
Last active May 21, 2019 19:29
Get all users on a linux operating system by parsing the /etc/passwd file
$passwd = (Get-Content /etc/passwd).ForEach({
$userfields = $_ -split ':'
return [pscustomobject]@{
UserName = $UserFields[0]
ShadowFile = $(if ($userfields[1] -eq 'x') { $true }else { $false })
UserId = $UserFields[2]
GroupId = $userfields[3]
FullName = $Userfields[4]
HomeDirectory = $UserFields[5]
ShellAccount = $Userfields[6]
@eizedev
eizedev / Get-AdminSDHolderUsers.ps1
Created July 15, 2020 15:52
Get AdminSDHolder protected AD Users
$Users = get-aduser -Filter {admincount -gt 0} -Properties adminCount -ResultSetSize $null
$Users | Select-Object Name, UserPrincipalName, SamAccountName
@eizedev
eizedev / Start-InElevatedMode.ps1
Created October 9, 2020 09:32
One-Liner to run the current script elevated as administrator if not already run as admin. Just copy&paste this oneliner to the top of your scripts.
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs -Wait }
@eizedev
eizedev / Test-WinCredential.ps1
Created October 9, 2020 09:50 — forked from mklement0/Test-WinCredential.ps1
Test-WinCredential: PowerShell function for validating Windows domain / local user credentials.
function Test-WinCredential {
<#
.SYNOPSIS
Validates Windows user credentials.
.DESCRIPTION
Validates a [pscredential] instance representing user-account credentials
against the current user's logon domain or local machine.
.PARAMETER Credential
@eizedev
eizedev / Get-PowershellErrorTypes.ps1
Created January 13, 2021 10:11
Get all available error types from powershell
[appdomain]::CurrentDomain.GetAssemblies() | ForEach {
Try {
$_.GetExportedTypes() | Where {
$_.Fullname -match 'Exception'
}
} Catch {}
} | Select FullName
@eizedev
eizedev / Get-LastPowershellErrorType.ps1
Created January 13, 2021 10:12
Get error type of last powershell error
$Error[0].Exception.GetType().FullName
@eizedev
eizedev / Get Recovery Keys.ps1
Created March 29, 2021 12:20 — forked from ak9999/Get Recovery Keys.ps1
Retrieve BitLocker Recovery Keys From Active Directory
# Generate Report of BitLocker Status for Computers in the BitLocker Machines OU.
# Sources: https://4sysops.com/archives/find-bitlocker-recovery-passwords-in-active-directory-with-powershell/
param([string]$OutputDirectory="~/Desktop",[string]$OrganizationalUnit=([adsi]'').distinguishedName)
if(!([Security.Principal.WindowsPrincipal] `
[Security.Principal.WindowsIdentity]::GetCurrent() `
).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Host -ForegroundColor Yellow "Only Administrators can read BitLocker Recovery Keys."
exit
}
$computers = Get-ADComputer -Filter * -SearchBase $OrganizationalUnit
@eizedev
eizedev / run.tpl
Created May 1, 2021 14:08 — forked from efrecon/run.tpl
`docker inspect` template to regenerate the `docker run` command that created a container
docker run \
--name {{printf "%q" .Name}} \
{{- with .HostConfig}}
{{- if .Privileged}}
--privileged \
{{- end}}
{{- if .AutoRemove}}
--rm \
{{- end}}
{{- if .Runtime}}
@eizedev
eizedev / vaultwarden.conf
Last active October 17, 2026 12:06
vaultwarden (bitwarden) nginx configuration on synology NAS (DSM 7 compatible) using synology docker (Supporting bitwardens LiveSync with Websocket configuration)
server {
listen 4444 ssl http2;
listen [::]:4444 ssl http2;
server_name CHANGE_SERVERNAME;
ssl_certificate /usr/syno/etc/certificate/system/default/ECC-fullchain.pem;
ssl_certificate_key /usr/syno/etc/certificate/system/default/ECC-privkey.pem;
ssl_trusted_certificate /usr/syno/etc/certificate/system/default/ECC-fullchain.pem;
add_header Strict-Transport-Security "max-age=15768000; includeSubdomains; preload" always;
@eizedev
eizedev / treestyletab.css
Created June 11, 2021 10:20
Firefox Tree Style Tab CSS - Collapsible
/* Hide border on tab bar, force its state to 'scroll', adjust margin-left for width of scrollbar.
#tabbar {
border: 0;
overflow-y: scroll !important;
margin-left: -18px !important;
}
*/
/* Hide .twisty and adjust margins so favicons have 7px on left. */
.tab .twisty {