Hello,
I need help, I know I asked this before, but it doesn’t make any sense.
I tried putting everything inside the while loop, but I get the same result, so I have everything outside the while loop now.
I’m sure its something simple, but I can’t figure it out.
Issue 1: Line 14, it displays the users with the one@one.com I added, this is good, but when I do a .count, it gives me 8 instead of 9 which is the correct count.
1=mkelley@company.com
2=jbruce@company.com
3=oreynolds@company.com
1438=alippard@company.com
1439=klaw@company.com
1440=dmarsh@company.com
1441=jonathanj@company.com
1442=aralls@company.com
one@one.com
$INI = '\\hqfs1\users\tantony\PowerShell\CalenderGroup\config.ini' $Read_INI = Get-Content $INI $Users_Line_Num = ($Read_INI | Select-String -CaseSensitive "[Users]" -SimpleMatch).LineNumber $Membersof_Line_Num = ($Read_INI | Select-String -CaseSensitive "[MembersOf-1]" -SimpleMatch).LineNumber - 2 $Users = $Read_INI[$Users_Line_Num..$Membersof_Line_Num] $Continue = $null function Add_User { $User = Read-Host "Enter the new email address to add" $Read_INI[$Membersof_Line_Num] += "`r`n$User" $Read_INI | Set-Content $INI $Read_INI[$Users_Line_Num..$Membersof_Line_Num] } While($Continue -ne 0) { switch($Continue) { 1{Add_User} } Write-Host "[1]`t`tAdd new user" Write-Host "[0]`t`tExit menu" $Continue = Read-Host "`nPlease select an option and press ENTER" }
Issue 2:
Line 14, I have $Users, which is $Read_INI[$Users_Line_Num…$Membersof_Line_Num], but it doesn’t show one@one.com, and when I do a .count, it gives me 8 instead of 9 which is the correct count.
1=mkelley@company.com
2=jbruce@company.com
3=oreynolds@company.com
1438=alippard@company.com
1439=klaw@company.com
1440=dmarsh@company.com
1441=jonathanj@company.com
1442=aralls@company.com
$INI = '\\hqfs1\users\tantony\PowerShell\CalenderGroup\config.ini' $Read_INI = Get-Content $INI $Users_Line_Num = ($Read_INI | Select-String -CaseSensitive "[Users]" -SimpleMatch).LineNumber $Membersof_Line_Num = ($Read_INI | Select-String -CaseSensitive "[MembersOf-1]" -SimpleMatch).LineNumber - 2 $Users = $Read_INI[$Users_Line_Num..$Membersof_Line_Num] $Continue = $null function Add_User { $User = Read-Host "Enter the new email address to add" $Read_INI[$Membersof_Line_Num] += "`r`n$User" $Read_INI | Set-Content $INI $Users } While($Continue -ne 0) { switch($Continue) { 1{Add_User} } Write-Host "[1]`t`tAdd new user" Write-Host "[0]`t`tExit menu" $Continue = Read-Host "`nPlease select an option and press ENTER" }
Thank you,
Tony