This is not the exact scenario of what I'm trying to accomplish but is a good example of where I am stuck.
$Path = "\\192.168.1.1\config"
Get-CimInstance -Namespace ROOT\CIMV2 -ClassName Win32_MappedLogicalDisk -Filter "ProviderName=$Path"
This produces an "Invalid Query" error as it's trying to use \\ in the query
I know I can do this manually by using:
Get-CimInstance -Namespace ROOT\CIMV2 -ClassName Win32_MappedLogicalDisk -Filter "ProviderName='`\\`\\192.168.1.1`\\config'"
This doesn't solve my problem as I need to pass the value from a variable
Any help would be greatly appreciated
Get-CimInstance -Namespace ROOT\CIMV2 -ClassName Win32_MappedLogicalDisk | where {$_.ProviderName -eq $Path}as it will slow down the script massively