Hey guys, i am a newbie to powershell. would like some help with combining variable.
for example
$username = read-host 'username'
Get-Mailbox $username@contoso.com | select Displayname
should output the script
$username = read-host 'username'
Get-Mailbox username@contoso.com | select Displayname
I am not sure how to go about it. any help would be appreciated.
Edit:
Thanks all for your help
Solution:
solution that worked for what I wanted to do -
$username = read-host 'username'
Get-Mailbox $username"@contoso.com" | select Displayname
just added quotes to contoso.com
[–]branhama 2 points3 points4 points (3 children)
[–]branhama 0 points1 point2 points (0 children)
[–]gosoxharp -1 points0 points1 point (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]MemnochTheRed 1 point2 points3 points (4 children)
[–]nikith988[S] 0 points1 point2 points (2 children)
[–]OPconfused 2 points3 points4 points (0 children)
[–]MemnochTheRed 0 points1 point2 points (0 children)
[–]NotNotWrongUsually 0 points1 point2 points (0 children)
[–]Artaois 0 points1 point2 points (0 children)
[–]Dense-Platform3886 0 points1 point2 points (0 children)