header image

Archive for January, 2018


Posted by: | January 31, 2018 Comments Off on Clear-RecycleBin |

Every so often I find a new cmdlet in PowerShell. This was the case with Clear-RecycleBin that I’ve just found. It appears to have been introduced with PowerShell 5.0 BUT isn’t available in PowerShell 6.0 With pretty simple syntax PS> Get-Command Clear-RecycleBin -Syntax Clear-RecycleBin [[-DriveLetter] <string[]>] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>] Its easy to use PS> […]

under: PowerShell v5

Documentation can be wrong!

Posted by: | January 31, 2018 Comments Off on Documentation can be wrong! |

We rely on vendor documentation to help us solve problems. Documentation is produced by people and people make mistakes so Documentation can be wrong!   As an example: The CIM class Win32_OperatingSystem has a Description property. According to the documentation the Description property is “ Description of the Windows operating system. Some user interfaces for […]

under: PowerShell

PowerShell sleep

Posted by: | January 30, 2018 Comments Off on PowerShell sleep |

PowerShell use tends to be very interactive. You run a command at the console and get some results. You run a script and get some results. How do you make PowerShell sleep? There’s a few ways you can make PowerShell code sleep.   First there’s Start-Sleep PS> for ($i=0; $i -le 10; $i++){ >> if […]

under: PowerShell

PowerShell –f string

Posted by: | January 28, 2018 Comments Off on PowerShell –f string |

A PowerShell –f string is used to format the data inside a string. –f is usually referred to as the format operator.   The operation of the format operator is best explained by examples. At its simplest you create fields in the string using {} and the arguments to the right of the –f operator are assigned to those […]

under: PowerShell

DSC update

Posted by: | January 27, 2018 Comments Off on DSC update |

The PowerShell team have posted an update on what’s happening with DSC. https://blogs.msdn.microsoft.com/powershell/2018/01/26/dsc-planning-update-january-2018/   The interesting thing is the decoupling of the Local Configuration Manager from Windows. A new LCM that can use resources written in multiple languages sounds good – DSC on Linux can finally have custom written resources.   LCM will be open source […]

under: DSC, PowerShell

PowerShell v6.0.1

Posted by: | January 26, 2018 Comments Off on PowerShell v6.0.1 |

PowerShell v6.0.1 is available from https://github.com/PowerShell/PowerShell/releases   This release upgrades PowerShell to use .NET core v2.0.5 which addresses a couple of security vulnerabilities. The release also addresses upgrade issues on some Linux distributions due to version numbers being misunderstood.   Also available is the v1.0.0 beta for OpenSSH https://github.com/PowerShell/Win32-OpenSSH/releases. This version supplies one of my […]

under: PowerShell v6

Iron Scripter prequels

Posted by: | January 25, 2018 Comments Off on Iron Scripter prequels |

One of the new things for Summit 2018 is the iron Scripter competition on the last afternoon. As a warm up for the competition we’re running a number of Iron Scripter prequels.   A puzzle will be published every week – first 2 are on powershell.org.   A forum exists to discuss the solutions in […]

under: PowerShell, Scripting Games, Summit

PowerShell v6 GA and beyond

Posted by: | January 25, 2018 Comments Off on PowerShell v6 GA and beyond |

PowerShell v6 achieved General Availability on 10 January 2018. https://blogs.msdn.microsoft.com/powershell/2018/01/10/powershell-core-6-0-generally-available-ga-and-supported/   Why do these things always happen when I’m in a plane over the Atlantic?   GA is a tremendous milestone but its not the end by any means. Work has already begun on v6.1 https://blogs.msdn.microsoft.com/powershell/2018/01/24/powershell-core-6-1-roadmap/   Note a service release at the end of […]

under: PowerShell v6

Just the date

Posted by: | January 8, 2018 Comments Off on Just the date |

Way back in this post https://richardspowershellblog.wordpress.com/2008/03/27/start-and-end-of-week/ I showed how to find the start of the week. I recently had a question about how to restrict the display to just the date.   PowerShell uses the .NET datetime class for working with dates so there will always be time information even if its set to 0. […]

under: PowerShell

Relevance of Scripts

Posted by: | January 4, 2018 Comments Off on Relevance of Scripts |

I had a sudden thought today about the relevance of scripts – PowerShell Scripts –  today.   PowerShell v6 can’t run some of the modules that we’ve come to rely on – for instance the AD cmdlets. The Windows Compatibility Pack (see previous post) enables access to some of the underlying .NET classes that enable […]

under: Books, PowerShell

Older Posts »