Hello,
Can someone please tell me the most efficient way of dealing with this problem. I'm trying to use a variable within a WMI filter and don't know how to deal with the inverted commas.
I am trying to do something along the lines of:
Powershell
Get-WmiObject-ClassWin32_Service-Filter'name="$service.name"'
but obviously the outer single quotes render the inner double quotes obsolete (i.e. the variable won't be expanded) The variables are imported from a CSV file so I don't have much room to manoeuvre.
I don't want to pipe to Where-Object as this line will be used in a foreach loop and I'd like to minimalise performance impact if possible.
Thanks in advance,
Mike