locked
How can I create a secure string inline within an existing command RRS feed

  • Question

  • Hi 

    I would like to do the following but can't seem to get it to work. How could I achieve this in one line? (i.e. where I convert some plain text into a secure string)?

    New-MailUser -Name "test" -Password (ConvertTo-SecureString 'myp@ssw0rd!' –asplaintext –force ) -ExternalEmailAddress test@test.com -UserPrincipalName test@test.com
    


    Wednesday, January 21, 2015 12:44 AM

Answers

All replies

  • What does that mean?  What error are you getting.  I suspect is on complexity.


    ¯\_(ツ)_/¯


    • Edited by jrv Wednesday, January 21, 2015 1:10 AM
    Wednesday, January 21, 2015 1:08 AM
  • What does that mean?? Please see the question and example command, the question boils down to whether or not the sub-statement within the parens is legal as far as a way to get the securestring for the password argument.
    Wednesday, January 21, 2015 5:46 AM
  • What error are you getting or is this just a curioosity question?


    ¯\_(ツ)_/¯

    Wednesday, January 21, 2015 7:10 AM
  • Is the syntax of the above command, with the sub-command for convertto-securestring embedded within it for the password parameter legal syntactically? or not legal syntactically?
    Wednesday, January 21, 2015 3:44 PM
  • Is the syntax of the above command, with the sub-command for convertto-securestring embedded within it for the password parameter legal syntactically? or not legal syntactically?

    Why not try it and see?

    But yes, that should be fine.


    Don't retire TechNet! - (Don't give up yet - 13,085+ strong and growing)

    • Marked as answer by bitsofinfo Wednesday, January 28, 2015 1:30 AM
    Wednesday, January 21, 2015 3:48 PM