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
  • 05:11 (UTC +02:00)
View GitHub Profile
@eizedev
eizedev / New-GithubGist.ps1
Created January 9, 2020 08:58 — forked from jdhitsolutions/New-GithubGist.ps1
A PowerShell script to create a new gist on Github.
#requires -version 4.0
Function New-GitHubGist {
[cmdletbinding(SupportsShouldProcess,DefaultParameterSetName = "Content")]
Param(
[Parameter(Position = 0, Mandatory, HelpMessage = "What is the name for your gist?",ValueFromPipelineByPropertyName)]
[ValidateNotNullorEmpty()]
[string]$Name,
@eizedev
eizedev / Set-AccountPasswordRemote
Last active March 12, 2020 08:23
Change your own Active Directory password from PowerShell without any special permissions in a remote domain
$domain = "domain name"
$username = "user name"
$User = $username + "@" + $domain
$Password = (Read-Host -asSecureString "Enter the current password")
$Credential = New-Object System.Management.Automation.PSCredential ($User, $Password)
Set-ADAccountPassword -Credential $Credential -Server $domain -Identity $userName -OldPassword $Password -NewPassword (Read-Host -asSecureString "Enter the new password")
@eizedev
eizedev / powershell-template.code-workspace
Last active May 4, 2020 08:53
powershell-template.code-workspace - VSCode Template for working with different styling guidelines for different repositories. Save this file to your desired repository and change the file according to your needs. Finaly open (File - Open Workspace) this VSCode workspace in VSCode..
{
"folders": [{
"path": "."
}],
"settings": {
"powershell.codeFormatting.autoCorrectAliases": true,
"powershell.codeFormatting.openBraceOnSameLine": true,
"powershell.codeFormatting.useCorrectCasing": true
}
}
@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()
@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 / 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 / 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 / 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 / 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 / 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