I hereby claim:
- I am panosgreg on github.
- I am panosg (https://keybase.io/panosg) on keybase.
- I have a public key ASAx9YCaHV53FwOXOIl66R9htjStsTv4Y-DNHhnjU_uYMgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
function Install-PowerShell { | |
<# | |
.SYNOPSIS | |
Installs latest PowerShell 7 via msi, from GitHub. | |
You need to: | |
a) run this from PS 5 (not PS 7) on windows (not linux) | |
b) have internet connectivity (and able to access github.com) | |
c) and have rights to install apps (usually local admin privileges) | |
.EXAMPLE | |
Install-PowerShell -Verbose |
function New-UserProfile { | |
<# | |
.EXAMPLE | |
New-UserProfile -DomainName MyLab -UserName MyUser -Verbose | |
#> | |
[cmdletbinding()] | |
[OutputType([System.IO.DirectoryInfo])] | |
param( | |
[Parameter(Mandatory=$true)] | |
[String]$UserName, |
function Get-ProcessHandle { | |
<# | |
.SYNOPSIS | |
Get all the currently open handles of a process | |
NOTE: requires the handle.exe tool from Sysinternals | |
.EXAMPLE | |
Get-ProcessHandle -PID 12000 -IncludeMode | |
#> | |
[cmdletbinding()] |
## Encryption & Decryption using native .NET functions | |
## This is Symetrical encryption. Which means the same key is used to both encrypt and decrypt. | |
## The encryption method is based on AES 256bit. | |
## The major difference between this option and the ConvertFrom/To-SecureString functions | |
## is that this way produces much smaller encrypted files. | |
## I have not compared the 2 options in regards to performance though, as-in which one is faster. |
## Encryption & Decryption via ConvertFrom-SecureString and ConvertTo-SecureString | |
## This is Symetrical encryption. Which means the same key is used to both encrypt and decrypt. | |
## The encryption method is based on AES 256bit. | |
$KeyFile = 'c:\temp\AWS.key' | |
$EncFile = 'c:\temp\AWS.aes' |
# 3 different options to Sort: | |
# 1) via an IComparer class, | |
# using the Sort() method from List and ArrayList | |
# or just instantiate a SortedSet | |
# 2) via LINQ | |
# using the OrderBy() method | |
# 3) via Sort() method from [Array] |
function Get-ReversedString { | |
<# | |
.SYNOPSIS | |
Reverse any letters of the input string | |
.EXAMPLE | |
Get-ReversedString '!abc123def456!' | |
# returns: !cba123fed456! | |
#> | |
[OutputType([string])] | |
[CmdletBinding()] |
function Test-TcpConnection { | |
<# | |
.SYNOPSIS | |
Check connectivity on a specific TCP port | |
.DESCRIPTION | |
Check connectivity on a specific TCP port | |
This function does not support Proxy settings. Which means if you are using a proxy | |
then you need to configure it beforehand on either the computer or user level. | |
.EXAMPLE | |
Test-TcpConnection 10.1.1.0 22 -Verbose |
function Test-TrueForAll { | |
<# | |
.SYNOPSIS | |
Checks if all items in an array have the same value | |
.EXAMPLE | |
'a','a','b' | Test-TrueForAll -ShouldBe 'a' | |
# returns False | |
.EXAMPLE | |
$false,$false,$false | Test-TrueForAll -ShouldBe $false | |
# returns True |