Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

PowerShell Syntax Problem.....

$
0
0

Trying to develop a PowerShell GUI to run some Exchange 2010 Cmdlets, IM having trouble getting the textbox / variable value to work correctly within the syntax.... 

This command works....

Works Get-Mailbox -identity myalias | Search-Mailbox -SearchQuery `Subject:"MyStringValue"' -Force -DeleteContent >\\server\c$\temp\outreport.txt

This command doesn't work....

Get-Mailbox -identity myalias | Search-Mailbox -SearchQuery `Subject:'$Sub'` -Force -DeleteContent >\\myserver\c$\temp\outreport.txt

When I say doesn't work, the command actually runs but doesnt produce the desired outcome.... Generates the report file which reports 0 item count. Any thoughts????? Thanks

 


Djoe


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>