Skip to content

Instantly share code, notes, and snippets.

View eizedev's full-sized avatar
💻
Automating everything - Picture powered by AI with my photo as model.

René eizedev

💻
Automating everything - Picture powered by AI with my photo as model.
  • Germany
  • 02:54 (UTC +02:00)
View GitHub Profile
@eizedev
eizedev / terminal.json
Last active January 18, 2021 09:14
windows-terminal and powershell core integration for files-community files app (https://github.com/files-community/Files)
{
"version": 1,
"DefaultTerminalName": "WindowsTerminal",
"terminals": [
{
"name": "CMD",
"path": "cmd.exe",
"arguments": "",
"icon": ""
},
@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-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 / 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 / SavedCredential.ps1
Created October 9, 2020 09:38 — forked from altrive/SavedCredential.ps1
Credential management utilities for PowerShell
#Requires -Version 3
#Credential file path
$script:CredentialsFile = Join-Path $env:TEMP "SavedCredentials\Credentials.xml"
function Set-SavedCredential()
{
[CmdletBinding()]
param(
[Parameter(Mandatory)]
@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 / Create-SHA1PasswordHash.ps1
Created October 9, 2020 09:18
Create SHA1 Hash from Password
#insert password here
$string = "Passw0rd!"
$encoding = [System.Text.Encoding]::UTF8
$SHA1Hash = New-Object -TypeName "System.Security.Cryptography.SHA1CryptoServiceProvider"
$Hashcode = ($SHA1Hash.ComputeHash($encoding.GetBytes($string)) | ForEach-Object { "{0:X2}" -f $_ }) -join ""
Write-Output $Hashcode
@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 / Use-VerboseDebug.ps1
Created June 23, 2020 08:56
Use Verbose or Debug advanced function parameters in an easy way in your own functions
function DoStuff {
[CmdletBinding()]
param ()
BEGIN
{
$CMDOUT = @{
Verbose = If ($PSBoundParameters.Verbose -eq $true) { $true } else { $false };
Debug = If ($PSBoundParameters.Debug -eq $true) { $true } else { $false }
}
@eizedev
eizedev / mouse_manager.ps1
Created May 25, 2020 08:46 — forked from BadCoder1337/mouse_manager.ps1
AFTER THE LAST GAME UPDATE THIS METHOD DOESN'T WORK ANYMORE
Add-Type -AssemblyName System.IO.Compression.FileSystem
Write-Host "Location: $PSScriptRoot"
Write-Host "Username: $env:UserName"
Set-Location $PSScriptRoot
$dataDir = "./mouse_manager_data"
# Get the ID and security principal of the current user account
$myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent()