namerg
asked on
How to echo captured values whithin a Read-Host statement ?
Hello all,
I am working in a little project that involves reading a csv file, query ad against the csv file and set the the right values in AD.
Through the code I have captured the following values
$AD_USER.sn
$InputLastName
$InputLastName = Read-Host 'Type the new Last Name:'
$NewLastName = Read-Host 'Are you sure, you want to replace the following lastname "$($AD_USER.sn)" by $($InputLastName) (Y/N)'
So, when I ask the question: 'Are you sure, you want to replace the following lastname "$($AD_USER.sn)" by $($InputLastName) (Y/N)',
So, not sure how to echo the values previously captured on $AD_USER.sn and $InputLastName in the Read-Host statement
Thanks for your help,
I am working in a little project that involves reading a csv file, query ad against the csv file and set the the right values in AD.
Through the code I have captured the following values
$AD_USER.sn
$InputLastName
$InputLastName = Read-Host 'Type the new Last Name:'
$NewLastName = Read-Host 'Are you sure, you want to replace the following lastname "$($AD_USER.sn)" by $($InputLastName) (Y/N)'
So, when I ask the question: 'Are you sure, you want to replace the following lastname "$($AD_USER.sn)" by $($InputLastName) (Y/N)',
So, not sure how to echo the values previously captured on $AD_USER.sn and $InputLastName in the Read-Host statement
Thanks for your help,
ASKER
Hmm, what do you mean? I do not understand your question.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Nope. I get the following:
Are you sure, you want to replace the following lastname $($AD_USER.sn) by $($InputLastName) (Y/N)
Thanks, G
Are you sure, you want to replace the following lastname $($AD_USER.sn) by $($InputLastName) (Y/N)
Thanks, G
ASKER
Ohh my bad sorryyyy....let me try....
ASKER
You got it. thank you.
Ok so I see the issue with my copy and paste was that I did not change the single quote at the end to a double quote lol .
$InputNewLastName = Read-Host 'Type the new Last Name:'
$NewLastName = Read-Host 'Are you sure, you want to replace the following lastname "$($AD_USER.sn)" by $($InputNewLastName) (Y/N)'