This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": 1, | |
"DefaultTerminalName": "WindowsTerminal", | |
"terminals": [ | |
{ | |
"name": "CMD", | |
"path": "cmd.exe", | |
"arguments": "", | |
"icon": "" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Error[0].Exception.GetType().FullName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[appdomain]::CurrentDomain.GetAssemblies() | ForEach { | |
Try { | |
$_.GetExportedTypes() | Where { | |
$_.Fullname -match 'Exception' | |
} | |
} Catch {} | |
} | Select FullName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -Version 3 | |
#Credential file path | |
$script:CredentialsFile = Join-Path $env:TEMP "SavedCredentials\Credentials.xml" | |
function Set-SavedCredential() | |
{ | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Users = get-aduser -Filter {admincount -gt 0} -Properties adminCount -ResultSetSize $null | |
$Users | Select-Object Name, UserPrincipalName, SamAccountName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function DoStuff { | |
[CmdletBinding()] | |
param () | |
BEGIN | |
{ | |
$CMDOUT = @{ | |
Verbose = If ($PSBoundParameters.Verbose -eq $true) { $true } else { $false }; | |
Debug = If ($PSBoundParameters.Debug -eq $true) { $true } else { $false } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |