PowerShell – Telegram
PowerShell
820 subscribers
214 photos
4 videos
1 file
802 links
Task automation and configuration management framework #PowerShell
Download Telegram
Classes

Methods are used to execute predefined actions. This may be changing a property of the object itself, or a change to the the thing the object represents, or it might be used to generate something new from the object.

class File {
[string] $Path
Create() {
New-Item -Path $this.Path -ItemType File 
}
}

$file = [File]@{
Path = "c:\temp\test.txt"
}
$file.Create()

Will you see any output in the shell?

#quiz
Get-Command can also be used to analyze executable and DLL files.
Classes

A method in a class can be assigned one or more arguments.
The return keyword must be used to return a value from the method

class File {
[string] $Path
[void] Create([String] $content) {
New-Item -Path $this.Path -ItemType File -Value $Content -Force
}
[String[]] ReadAll() {
return [System.IO.File]::ReadAllLines($this.Path)
}
}

#quiz
📘 PowerShell by Mistake

Learn PowerShell by reviewing "broken" code and discovering the answers. A great complement to any structured learning effort! Honor System: Pay what you feel this book is worth and what fits your budget.

#ebook #free
📻 Windows Terminal 1.0 with Kayla Cinnamon

What if there was one place for Windows CLI commands, PowerShell, even SSH and Bash? There is, and its called Windows Terminal.

#podcast #terminal
📚 Magic of $MyInvocation in PowerShell

$MyInvocation is an automatic variable which contains information about the invocation details of the current execution, such as function or noscript name, parameters, parameter values, noscript root, noscript path, invocation name and etc., and $MyInvocation works with noscripts, functions, and noscript blocks only.

https://kpatnayakuni.com/2020/07/01/powershell-magic-of-myinvocation/
🎁 Hey! PowerShell v7.1.0-preview 5 is out!

- Engine Updates and Fixes
- Code Cleanup
- Build and Packaging Improvements

Check full list of changes on GitHub
📘 PowerShell 7 for IT Pros: A Guide to Using PowerShell 7 to Manage Windows Systems

#ebook #notfree