-
camelCasing, PascalCasing, lowercase, and UPPERCASE in PowerShell
Capitalization rules for identifiers were created to help make types, members, and parameters easier to read. There are several types of casing used, depending on the identifier: camelCasing, PascalCasing, lowercase, and UPPERCASE. Writing good code isn’t just about how it performs or its usability. Writing code that is clean and well presented is just as...…
-
The System.IO.FileSystemWatcher .NET Class: Raise file system notifications in PowerShell
The use of .NET classes can extend PowerShell’s reach. In this article I will be looking at the System.IO.FileSystemWatcher .NET class and how you can use it to raise notifications on files and directories. PowerShell doesn’t do restrictions, and when you can’t achieve something one way, there is most probably another way with PowerShell’s extension...…
-
Start and stop an EC2 instance with a PowerShell class
My PowerShell class (AwsInstance) requires the AWS Tools for Windows PowerShell. The AWS Tools documentation is very clear with good examples. The cmdlets themselves for controlling the state of an EC2 instance are good, but I wanted an all-in-one tool with some extra features. The AWS module uses PowerShell Core 6 and its very rich...…
-
The PowerShell scriptblock
The scriptblock is a fundamental feature of the PowerShell language. Understanding the different ways to use scriptblocks is essential to for the advanced PowerShell developer. What is a scriptblock? A scriptblock is a block of script code that exists as an object reference but does not require a name. To write a scriptblock we add...…
-
Provision Windows Server 2016 with Vagrant and PowerShell DSC
If you have not heard of or used Vagrant before, then it’s well worth checking out some of the excellent blogs here on 4sysops by Adam Bertram. What is so good about Vagrant is that there are many ways to provision a machine, Ansible, Chef, Puppet, and shell scripting to name just a few. The...…