Powershell Variable Help
		
	The below command does not work because when entered I am prompted with a follow-up question of what the user's external email address should be (ExternalEmailAddress). If I enter bob@domain.com it works for the first result, but the rest fail because bob@domain.com is already used.
Get-User | Enable-MailUser
How do I get this command to include the ExternalEmailAddress for each user, but instead of a static (external) list, I want it to just assume the name should be the current SamAccountName@domain.com? Other provisioning programs do this with ease... and it DOES sound easy! 
So if get-user returns bob, sally and joe, I want this command to turn them into the MailUsers:
bob@domain.com
sally@domain.com
joe@domain.com 
Mike Crowley A+, Network+, Security+, MCT, MCSE, MCTS, MCITP: Enterprise Administrator / Messaging Administrator		
				June 16th, 2009 12:15am
			Try this:
Get-User |foreach($_.samaccountname) {$email = $_.Samaccountname +"@domain.com"; Enable-MailUser -Identity $_ -ExternalEmailAddress $email -WhatIf}
Note the -whatif - I think you will find that it plansto do way more than you want.Karl		
				Free Windows Admin Tool Kit Click here and download it now
					June 16th, 2009 1:41am
			For turn user to mail user in bulk, please see this thread		
				June 16th, 2009 5:00am
			thanks for the help Karl and James. I will test this later in the week and report back!
Mike Crowley A+, Network+, Security+,
MCT, MCSE, MCTS, MCITP: Enterprise Administrator / Messaging Administrator		
				Free Windows Admin Tool Kit Click here and download it now
					June 16th, 2009 5:08pm
			works as expected Thanks Karl!!!   James-Luo thanks as well. Instead of a CSV I pointed the above script at an OU. For this project I'd like to keep it all in the pipeline, but i'll definitely save your csv method for later reference!   
Mike Crowley   A+, Network+, Security+, MCT, MCSE, MCTS, MCITP: Enterprise Administrator / Messaging Administrator		
				June 16th, 2009 7:00pm
			You're welcome.I'm glad it works.Karl		
				Free Windows Admin Tool Kit Click here and download it now
					June 16th, 2009 7:02pm
			 Other recent topics
			Other recent topics
		

