Hi,
I have the following code:
$Members = Get-UnifiedGroupLinks -Identity "NameOfGroup" -LinkType Members | select PrimarySmtpAddress
[int]$live_number = 012345678
$UserDetails = @()
foreach ($Member in $Members)
{
$Member
$UserDetails += Get-AzureADUser -SearchString $Member.PrimarySmtpAddress | select @{n="live_number";e={$live_number}},@{n="mobile_number";e={$_.Mobile}},@{n="email_address";e={$_.UserPrincipalName}}
$live_number++
}
I am trying to do a +1 on the $live_number variable in the foreach loop. Basically I need to assign a number to each user returned in the loop which needs to be +1 from the original number defined in the variable. The issue I am facing is that the zero is dropped but I need the 0 as it is part of a phone number. An integer drops the zero but I need it to be an integer to use the $live_number++ command. So I am not sure how to retain the zero without turning the variable into a string but then the $live_number++ will not work.
Hope that makes sense, very new to PS so I am sure there is lots of room for improvement on how I am doing / done things.
Cheers
Son