PowerShell – Telegram
PowerShell
822 subscribers
214 photos
4 videos
1 file
802 links
Task automation and configuration management framework #PowerShell
Download Telegram
💡 Metalize!

PowerShell 6.1,7 versions:
PS C:\> function metalize {$input-replace'[aeiou]',{"$_`u{0308}".Normalize('FormC')}}

PS C:\> "Svyatoslav" | metalize

Svyätösläv

PowerShell 5 version:
$callback = {
 param($match)
 "$match$([char]0x0308)".Normalize('FormC')
}

$re = [regex]'[aeiou]'
$re.Replace("Svyataslav", $callback)

Svyätäsläv

Revert back:
"Svyätäsläv".Normalize('FormD') -replace '\p{Mn}'

Svyataslav
#fun
PowerShell 7.1 RC1 is out.

Breaking change:
TLS 1.0 and TLS 1.1 were retired from the default on Linux machines where OpenSSL 1.1 and above is used.

General Cmdlet Updates and Fixes:
- Fix case where exception message contains just "`n" on Windows.
- Recognize CONOUT$ and CONIN$ as reserved device names.
- Fix ConciseView for interactive advanced function when writing error.


https://github.com/PowerShell/PowerShell/releases/tag/v7.1.0-rc.1
💡 Function name can contain white spaces:

new-item function:"get-process -name chrome" -Value "'hello'"

& "get-process -name chrome"

(most certainly a bad practice)
You can assign a .NET type to a Powershell variable and use its static methods from the variable:

PS C:\> $list = [Collections.Generic.List[int]](1..10)
PS C:\> $linqe = [Linq.Enumerable]
PS C:\> $linqe::Take($list,3)
1
2
3
🤡 PowerShell Hero.
#fun
CVE-2020-16886: PowerShellGet Module WDAC Bypass Vulnerability

A security feature bypass vulnerability exists in the PowerShellGet V2 module. An attacker who successfully exploited this vulnerability could bypass WDAC (Windows Defender Application Control) policy and execute arbitrary code on a policy locked-down machine.

https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2020-16886