Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using variables in parameter name

Status
Not open for further replies.

BigEHead

MIS
Aug 19, 1999
1
US
do any of you guys know how to get this to work?

@str = 'IMAP'
set-casmailbox -identity username ("-str" + 'Enabled') $true

i get an error that says:
Set-CASMailbox : A parameter cannot be found that matches parameter name '-IMAPEnabled', which is bizarre because it parses correctly. if i hard code -IMAPEnabled, it works fine.
 
Try building a string for the command and using the Invoke-Expression command. That should work for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top