I am trying to let PowerShell filter a number of objects from a cmdlet and pick an object that has a specific name format.
The name format is always going to be same like below: current Month Name + Year + Workstations
For example the format for current month looks like below: August 2021 Workstations
I tried the below but didn't succeed getting the desired output.
$currentMonth =
(Get-UICulture).DateTimeFormat.GetMonthName((Get-Date).Month.ToString())
$LatestSUG =
Get-CMSoftwareUpdateGroup |
Select-Object LocalizedDisplayName |
Where-Object -Property LocalizedDisplayName -EQ '$currentMonth'
The cmdlet is Get-CMSoftwareUpdateGroup
The object name I am trying to filter is LocalizedDisplayName
Thanks very much for any help on this.