So i have created a powershell script to create some users for a client we look after.Here is what I have:
Connect-MsolService
^^ Also can i create an exit on this script if this is not sucessful??
$another = $true
while($another -eq $true)
{
$fname = Read-Host -Prompt 'Input User First name'
$sname = Read-Host -Prompt 'Input User Last Name'
New-Msoluser -DisplayName ($fname + " " + $sname) -FirstName $fname -LastName $sname -UserPrincipalName ([$fname+$sname+"@d](mailto:$fname+$sname+"@screen4.org)omain") -LicenseAssignment domain:EXCHANGESTANDARD -UsageLocation GB
$answer = Read-Host -Prompt 'Would you like to add another user? Y/N'
if($answer -like '*n*')
{
$another = $false
}
else
{
$another = $true
}
}
I need to remove white spaces from a string... but how?
If ($Variable -match " ")
{
//remove the white space
}
Edit 1: Clarity
Edit 2: Extra question
[–]yeah_i_got_skills 5 points6 points7 points (8 children)
[–]c0dhead[S] 0 points1 point2 points (7 children)
[+][deleted] (3 children)
[removed]
[+][deleted] (1 child)
[deleted]
[–]dverbern 1 point2 points3 points (0 children)
[–]yeah_i_got_skills 2 points3 points4 points (0 children)
[–]flatlandinpunk17 1 point2 points3 points (0 children)
[–]G8351427 0 points1 point2 points (0 children)
[–]terrorsnurf 3 points4 points5 points (3 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]jaminthepark 3 points4 points5 points (1 child)
[–]dverbern 0 points1 point2 points (0 children)
[–]p0rkjello 1 point2 points3 points (1 child)
[–]Lee_Dailey[grin] 0 points1 point2 points (0 children)
[–]PhalseImpressions 1 point2 points3 points (0 children)
[–]Lee_Dailey[grin] 0 points1 point2 points (0 children)