Working on a script with the code pasted below. I am getting a message"cmdlet ForEach-Object at command pipeline position 2 Supply values for the following parameters: Process[0]" If I enter a value the Process[x] repeats with a incremented value. If I respond with a null I receive a response that contains the import command and the script terminates. Can anyone tell me that the initial message means?
Import-Csv $InFile | ForEach
{
$FirstName = $_.FirstName; $LastName = $_.LastName; $DisplayName = $_.DisplayName; $Upn = $_.UserName; $UPassword = $_.Password
$CheckMailbox = $null; $CheckMailUser = $null
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Check to see if the user account exist.
# If not then create it.
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
$CheckMailUser = Get-MsolUser -User $Upn
If ($CheckMailUser -eq $null)
{
New-MsolUser -UserPrincipalName $Upn -DisplayName $DisplayName -FirstName $FirstName -LastName $LastName -UsageLocation $Location -LicenseAssignment $LicenseAgreement -Password $UPassword -StrongPasswordRequired $False
"$UPN - User account added" | Out-File $LogFile -Append
}
Else
{
"$UPN - User account exist" | Out-File $LogFile -Append
}
}