Skip to content

Instantly share code, notes, and snippets.

View asheroto's full-sized avatar
:electron:
Calculating Universe

asheroto

:electron:
Calculating Universe
View GitHub Profile
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
using namespace System.Reflection
function Get-FunctionInfo {
<#
.SYNOPSIS
Get an instance of FunctionInfo.
.DESCRIPTION
FunctionInfo does not present a public constructor. This function calls an internal / private constructor on FunctionInfo to create a description of a function from a script block or file containing one or more functions.
function New-ConsoleMenu {
param (
[ScriptBlock]$ScriptBlock,
[String]$Title,
[String]$Prompt,
[Object]$Default,
@indented-automation
indented-automation / New-DynamicParameter.ps1
Last active August 11, 2023 22:46
New-DynamicParameter
function New-DynamicParameter {
<#
.SYNOPSIS
Create a new dynamic parameter object for use with a dynamicparam block.
.DESCRIPTION
New-DynamicParameter allows simplified creation of runtime (dynamic) parameters.
.EXAMPLE
New-DynamicParameter Name -DefaultValue "Test" -ParameterType "String" -Mandatory -ValidateSet "Test", "Live"
.EXAMPLE
New-DynamicParameter Name -ValueFromPipelineByPropertyName
function Get-InstalledSoftware {
<#
.SYNOPSIS
Get all installed from the Uninstall keys in the registry.
.DESCRIPTION
Read a list of installed software from each Uninstall key.
This function provides an alternative to using Win32_Product.
.EXAMPLE
Get-InstalledSoftware
@indented-automation
indented-automation / Get-CommandSource.ps1
Last active July 7, 2024 00:08
View the source for a command
function Get-CommandSource {
param (
[Parameter(Mandatory)]
[String]$Name
)
try {
$commandInfo = Get-Command $Name
if ($commandInfo -is [System.Management.Automation.AliasInfo]) {
$commandInfo = $commandInfo.ResolvedCommand
@AveYo
AveYo / .. MediaCreationTool.bat ..md
Last active June 29, 2024 01:12
Universal MediaCreationTool wrapper for all MCT Windows 10 versions - MOVED TO github.com/AveYo/MediaCreationTool.bat
@PatrickLang
PatrickLang / README.md
Last active June 10, 2024 18:36
Yubikey + Windows

Using a Yubikey 4 on Windows

These are my notes on how to set up GPG with the private key stored on the hardware Yubikey. This will reduce the chances of your GPG private key from being stolen, and also allow you to protect other secrets such as SSH private keys.

It's just some notes and a partial worklog for now, but I may turn it into a full blog post later.

using namespace System.Collections.Generic; using namespace System.Text
Add-Type -TypeDefinition '
using System;
using System.Runtime.InteropServices;
using System.Text;
public class WindowTools
{
public delegate bool EnumWindowsProc(IntPtr hWnd, int lParam);
@asheroto
asheroto / IsPortActive.md
Last active June 24, 2023 06:53
Check if a port is active/open/listening in PowerShell.
@asheroto
asheroto / EnableRDP.ps1
Last active December 26, 2023 07:13
Enable RDP on a computer with PowerShell.
# Warning
Clear-Host
Write-Output "Run this script on the computer you want to access via RDP"
Write-Output ""
# Ask
Write-Output "Remote address can be an IP address or network with CIDR"
Write-Output "Example: 192.168.0.5 or 192.168.0.0/24"
Write-Output ""
$RemoteAddress = Read-Host "Remote Address"