I am trying to write a PS script to find a share named C$$ but PS is interpreting the $ sign and I want to pass it into the filter. Normally \ stops this but after googling I cant get a working solution.
$string = "Name='C\$\$'"
Write-Host $string
get-wmiobject -Class Win32_share -filter $string
The write host returns Name='C\$\$' I need it to return C$$
You can use the backtick to escape characters in a string.
$string = "Name='C`$`$'"
That should return Name='C$$'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With