Category Archives: Powershell

Change a function definition

Functions in PowerShell are based on scriptblocks and as I showed in my session at the recent PowerShell Summit its possible to change a function definition. Let’s start with a simple function: PS> function f1 { >>   $x = 1 … Continue reading

Posted in Powershell | Leave a comment

Code reviews and Iron Scripter

Many organisations use code reviews to help ensure a quality outcome. At the recent PowerShell Summit we ran a scripting competition – Iron Scripter. I’ve had a thought on how code reviews and Iron Scripter have something in common. Something … Continue reading

Posted in Powershell | Leave a comment

Positional parameters

Positional parameters allow you go use a function of cmdlet without specifying the parameter names. The values you supply are assigned to the correct parameters based on their position. If you look at the documentation for PowerShell you’ll see some … Continue reading

Posted in Powershell | Leave a comment

PowerShell join

I looked at PowerShell split a few posts back. This time I’ll look at the opposite action – PowerShell join. Lets look at a simple string PS> $str = ‘PowerShell for Windows and Linux’ and split it PS> $strs = … Continue reading

Posted in Powershell | Leave a comment

Iron Scripter 2108

Iron Scripter 2018 is the scripting competition we’re holding at the PowerShell Summit on 12 April 2018. The task for the main event is still under wraps but even if you can’t make the Summit you can benefit from the … Continue reading

Posted in Powershell, Summit | Leave a comment

PowerShell split

The PowerShell split operator is used to split strings based on a delimiter. The default delimiter is white space PS> $str = ‘AA BB CC DD EE FF GG’ PS> -split $str AA BB CC DD EE FF GG You … Continue reading

Posted in Powershell | Leave a comment

Set active hours

Last time time you saw how to get the current active hours. This is how you set the active hours. $sb = {   Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings -Name ActiveHoursStart -Value 10 -PassThru   Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings -Name ActiveHoursEnd -Value 22 -PassThru } … Continue reading

Posted in Powershell, Windows 10, Windows Server 2016 | Leave a comment