Powershell Quotes Issue

Trying to execute this command such that halkuff@verizon.net is used in the name field as "halkuff@verizon.net"

[New-MailContact -ExternalEmailAddress "halkuff@verizon.net" -Name "halkuff@verizon.net" -Alias "halkuffverizon" -OrganizationalUnit "tessco.com/migrated users and groups/pmdf"

I need it to look like the halkuffgmail entry below when done - that entry was done in the EMC and not with PS

[PS] C:\Windows\system32>Get-MailContact -id halkuffverizon

Name                      Alias                                          RecipientType
----                      -----                                          -------------
halkuff@verizon.net       halkuffverizon                                 MailContact


[PS] C:\Windows\system32>Get-MailContact -id halkuffgmail

Name                      Alias                                          RecipientType
----                      -----                                          -------------
"halkuff@gmail.com"       halkuffgmail                                   MailContact


[New-MailContact -ExternalEmailAddress "halkuff@verizon.net" -Name "halkuff@verizon.net" -Alias "halkuffverizon" -OrganizationalUnit "tessco.com/migrated users and groups/pmdf"
halkuffAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

glcook63Commented:
Use single-quotes instead of double.

[New-MailContact -ExternalEmailAddress 'halkuff@verizon.net' -Name 'halkuff@verizon.net' -Alias 'halkuffverizon' -OrganizationalUnit 'tessco.com/migrated users and groups/pmdf'
0
halkuffAuthor Commented:
Does not achieve the desired result, no quotes , see below
[PS] C:\Windows\system32>
[PS] C:\Windows\system32>New-MailContact -ExternalEmailAddress 'halkuff@verizon.net' -Name 'halkuff@verizon.net' -Alias
'halkuffverizon' -OrganizationalUnit 'tessco.com/migrated users and groups/pmdf'

Name                      Alias                                          RecipientType
----                      -----                                          -------------
halkuff@verizon.net       halkuffverizon                                 MailContact
0
glcook63Commented:
Sorry please try using single quotes around double quotes see example below.

'"halkuff@verizon.net"'
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Redefine Your Security with AI & Machine Learning

The implications of AI and machine learning in cyber security are massive and constantly growing, creating both efficiencies and new challenges across the board. Check out our on-demand webinar to learn more about how AI can help your organization!

halkuffAuthor Commented:
Nope tried that before... I take it you do not have a system to try this on?
0
halkuffAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for halkuff's comment #a39576909

for the following reason:

New-MailContact -ExternalEmailAddress 'halkuff@verizon.net' -Name '"halkuff@verizon.net"' -Alias 'halkuffverizon' -OrganizationalUnit 'tessco.com/migrated users and groups/pmdf'

New-MailContact -ExternalEmailAddress 'ntroxel@comcast.net' -Name '"ntroxel@comcast.net"' -Alias 'niklastroxel-comcast' -OrganizationalUnit 'tessco.com/migrated users and groups/pmdf'
0
glcook63Commented:
Single quotes takes the literal string instead of interpolating the string.  Well I have tried several options, You could try using brackets to pass the literal string.

Example {"halkuff@verizon.net"}

My environment doesn't use exchange so I am just trying to give you suggestions based on previous experience.
0
halkuffAuthor Commented:
Done!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.