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
# Copyright: (c) 2023, Jordan Borean (@jborean93) <jborean93@gmail.com> | |
# MIT License (see LICENSE or https://opensource.org/licenses/MIT) | |
Function Get-SqlServerTlsCertificate { | |
<# | |
.SYNOPSIS | |
Gets the MS SQL X509 Certificate. | |
.DESCRIPTION | |
Gets the X509 Certificate that is being used by a remote MS SQL Server. |
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
using namespace System | |
using namespace System.Linq | |
using namespace System.Collections | |
using namespace System.Collections.Generic | |
using namespace System.Management.Automation | |
using namespace System.Management.Automation.Language | |
using namespace System.Reflection | |
# Hey person reading this! Don't do this, alright? You'll have a bad time. ty |
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
# Copyright: (c) 2022, Jordan Borean (@jborean93) <jborean93@gmail.com> | |
# MIT License (see LICENSE or https://opensource.org/licenses/MIT) | |
Function Trace-TlsHandshake { | |
<# | |
.SYNOPSIS | |
TLS Handshake Diagnostics. | |
.DESCRIPTION | |
Performs a TLS handshake and returns diagnostic information about that |
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
class ConstrainedVariableInterpolation : System.Management.Automation.Language.AstVisitor { | |
hidden [Hashtable] $Property | |
[System.Collections.Generic.List[PSCustomObject]] $Result | |
hidden [System.Management.Automation.Language.Ast] $Ast | |
[System.Management.Automation.Language.AstVisitAction] CheckForPostAction([System.Management.Automation.Language.Ast] $ast, [System.Management.Automation.Language.AstVisitAction] $action) | |
{ | |
throw 'CheckForPostAction not supported' | |
} | |
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
using namespace System.Management.Automation | |
using namespace System.Collections.Generic | |
class ArgumentCompleterBase : IArgumentCompleter { | |
hidden [List[CompletionResult]] $Results = [List[CompletionResult]]::new() | |
[string] $WordToComplete | |
[Language.CommandAst] $commandAst | |
# override in child class | |
[void] AddCompletionsFor([string] $commandName, [string] $parameterName, [Collections.IDictionary] $fakeBoundParameters) {} |
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 Get-MonitorInfo { | |
[CmdletBinding()] | |
param ([string[]]$ComputerNames = $env:computername) | |
foreach ($ComputerName in $ComputerNames){ | |
try { | |
$CimSession = New-CimSession -ComputerName $ComputerName | |
} catch { | |
Write-Warning "Please make sure PSRemoting is enabled on $ComputerName" | |
Continue | |
} |
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 -Module Reflection | |
[CmdletBinding()] | |
param( | |
# The path to a script or name of a command | |
$Command, | |
# If you want to include private functions from a module, make sure it's imported, and pass the ModuleInfo here | |
[System.Management.Automation.PSModuleInfo]$ModuleScope = $( | |
Get-Module $Command -ListAvailable -ErrorAction SilentlyContinue | Get-Module -ErrorAction SilentlyContinue | |
), |
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
Set-PowerLinePrompt ` | |
-SetCurrentDirectory ` | |
-RestoreVirtualTerminal ` | |
-PowerLineFont ` | |
-FullColor ` | |
-Title { | |
$title = "PowerShell {0} - {1} ({2}) - PID: {3}" -f $PSVersionTable.PSVersion.ToString(),(Convert-Path $pwd), $pwd.Provider.Name,$PID | |
if (Test-Elevation) { | |
"Elevated - $title" | |
} else { |
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
<# | |
Forked from https://github.com/jaykul Gist, posted in response to my Twitter | |
whinge about PowerShellGet in the enterprise - Thank you, Joel Bennett! | |
This adds the ability to use a web proxy, using your current session's | |
credentials. Might add option to use other credentials, if there's demand. | |
It also adds a 'BL' (Bootleg) prefix to the nouns, just to prevent confusion with the "real" | |
cmdlets. Feel free to remove them. |
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
param( | |
[string]$Exe7z, | |
[string]$PackageDir, | |
[string]$InstallDir | |
) | |
Function Expand-ToDirectory { | |
param( | |
[string]$Archive, | |
[string]$TargetDir |
NewerOlder