Monthly Archives: June 2017

Learning PowerShell

A recent post on – – gave this path for learning PowerShell and becoming more proficient Books: Learn Powershell In A Month of Lunches Learn Powershell Toolmaking in a month of Lunches Windows Powershell In Action 3rd Edition … Continue reading

Posted in Learning Powershell | Leave a comment

Finding a CIM class

One of the problems you might find is finding a CIM class. You know its name but you don’t know which namespace its in. The old WMI cmdlets allow you to search the namespaces recursively PS> Get-WmiObject -Class Win32_Process -Namespace … Continue reading

Posted in PowerShell and CIM, PowerShell and WMI | Leave a comment

Joining and Testing folder paths

Last time I showed how to split folder paths to just leave the path – no filenames or drive information. What about the opposite task – joining and testing folder paths. Here’s an example $basepath = ‘C:\Scripts’ $pathsTotest = ‘Containers’,’HyperV’, … Continue reading

Posted in Powershell | Leave a comment

Just the folders

Lets say you have a bunch of files in nested folders but  you just want the folders  not the file or drive Our files look like this C:\Scripts\HyperV\Setup C:\Scripts\HyperV\attachdisks.ps1 C:\Scripts\HyperV\get-mountedvhdDrive.ps1 C:\Scripts\HyperV\invoke-CIMshutdown.ps1 C:\Scripts\HyperV\set-loopbackswitch.ps1 C:\Scripts\HyperV\Set-NestedVirtualisation.ps1 C:\Scripts\HyperV\set-realswitch.ps1 C:\Scripts\HyperV\Start-AllWindowsVMs.ps1 C:\Scripts\HyperV\Stop-AllVMs.ps1 C:\Scripts\HyperV\Stop-Lab.ps1 C:\Scripts\HyperV\test-HotfixIpresence.ps1 C:\Scripts\HyperV\Setup\Copy-Updates.ps1 C:\Scripts\HyperV\Setup\Get-LicenseStatus.ps1 … Continue reading

Posted in Powershell | Leave a comment

Location, location

Just recently I’ve found my self repeatedly working through a location, location pattern. cd C:\test\ .\hello.ps1 cd C:\Scripts\ The pattern consists of changing to another folder. Running some code and then changing back to the original folder – assuming you … Continue reading

Posted in Powershell | 3 Comments


A comment on yesterday’s post about passing parameters into a script block asked why I hadn’t mention $using $using allows you to access a local variable in a scriptblock BUT you need to be careful PS> $proc = “power*” Invoke-Command … Continue reading

Posted in Powershell | Leave a comment

PowerShell on Linux

An introduction to PowerShell v6 on Windows, mac and Linux is available here Well worth a read if you haven’t looked at PowerShell v6 yet

Posted in PowerShell v6 | Leave a comment