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

#fun
Code Golf now supports PowerShell

Code Golf is a game designed to let you show off your code-fu by solving problems in the least number of characters.

https://code.golf/

#game
📌 Parse Email Address

[System.Net.Mail.MailAddress]"Bill.Gates@microsoft.com"

#oneline
📌4 ways to send PowerShell output to null

1..1000 | Out-Null
[Void]$(1..1000)
$(1..1000) > $null
$null = $(1..1000)

#oneline
📘 A Blogger's Guide to Getting Started with PowerShell 7 [free]

#ebook
📌 Ways to validate IP Address

[IPAddress]'192.168.0.1'
[byte[]] '192.255.0.0'.split('.')
[regex] #nobody likes regex

But wait! Below are also valid!

[IPAddress]'222222'
[IPAddress]'10.1'

#oneline
Classes

A class in .NET might be considered to be the recipe used to create a type. A type is a representation of something, anything.

Classes are created using the Class keyword.
An instance of the Car class can be created using ::new().

class Car { }
$car = [Car]::new()

What type results when you create classes like above?

#quiz
🎁 Grab the latest PowerShell 7.1 Preview 4 release!

- Breaking Changes
- Engine Updates and Fixes
- General Cmdlet Updates and Fixes

Check full list of changes on GitHub
Classes

Properties are used to describe different information about an object.
A hashtable can be used to fill the properties of an object when the object is created.

class Car {
$Make
[string] $Model
}
$car = [Car]@{
Make = 'Volkswagon'
Model = 'Golf'
}

Properties which do not have an explicit type name defined are given the type System.Object.

$car | gm -name Make

#quiz