Suppressing Text after New-DistributionList

%3CLINGO-SUB%20id%3D%22lingo-sub-122771%22%20slang%3D%22en-US%22%3ESuppressing%20Text%20after%20New-DistributionList%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-122771%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20script%20which%20I%20am%20creating%20a%20distribution%20list%20(New-DistributionList).%26nbsp%3B%20However%2C%20the%20format%20of%20the%20output%20gets%20screwed%20up%20when%20the%20following%20text%20appears%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3ENew!%20Office%20365%20Groups%20are%20the%20next%20generation%20of%20%20distribution%20lists.%0AGroups%20give%20teams%20shared%20tools%20for%20collaborating%20using%20email%2C%20files%2C%20a%20calendar%2C%20and%20more.%0AYou%20can%20start%20right%20away%20using%20the%20New-UnifiedGroup%20cmdlet.%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHow%20do%20you%20suppress%20this%20text%3F%26nbsp%3B%20I%20tried%20to%20pipe%20it%20to%20out-null%20to%20no%20avail.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-122771%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ENew-DistributionList%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESuppress%20Text%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-234322%22%20slang%3D%22en-US%22%3ERe%3A%20Suppressing%20Text%20after%20New-DistributionList%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-234322%22%20slang%3D%22en-US%22%3E%3CP%3EThanks.%26nbsp%3B%20Already%20put%20my%203%20votes%20in...%26nbsp%3B%20%3CSMILE%3E%3C%2FSMILE%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-234308%22%20slang%3D%22en-US%22%3ERe%3A%20Suppressing%20Text%20after%20New-DistributionList%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-234308%22%20slang%3D%22en-US%22%3E%3CP%3EIt%26nbsp%3Bappears%20to%20be%20%22Information%22%20which%20normally%20could%20be%20re-directed%20using%20%22InformationAction%22%20however%20that%20parameter%20has%20not%20been%20exposed%20in%20the%20New-DistributionGroup%20Cmdlet%20for%20Exchange%20Online.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI've%20created%20an%20entry%20in%20UserVoice%20for%20the%20Exchange%20Online%20Administration.%20%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Foffice365.uservoice.com%2Fforums%2F273493-office-365-admin%2Fsuggestions%2F35163415-new-distributiongroup-allow-redirection-of-infor%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Foffice365.uservoice.com%2Fforums%2F273493-office-365-admin%2Fsuggestions%2F35163415-new-distributiongroup-allow-redirection-of-infor%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBut%20you%20are%20correct%2C%20at%20this%20time%20the%20content%20cannot%20be%20captured%20or%20redirected.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-234291%22%20slang%3D%22en-US%22%3ERe%3A%20Suppressing%20Text%20after%20New-DistributionList%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-234291%22%20slang%3D%22en-US%22%3E%3CP%3EWhite.%20So%20it%20is%20not%20a%20warning%20or%20an%20error.%20It%20is%20a%20forced%20statement%20that%20cannot%20be%20blocked%20by%20sending%20it%20to%20Null.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPS%26gt%3B%20New-DistributionGroup%20-name%20%22TEST%20DELETE%22%20-type%20%22Security%22%20-CopyOwnerToMember%20-ManagedBy%20%22my_email_address%40domain.com%22%20-PrimarySmtpAddress%20test_delete%40domain.com%7C%20out-null%3CBR%20%2F%3ENew!%20Office%20365%20Groups%20are%20the%20next%20generation%20of%20distribution%20lists.%3CBR%20%2F%3EGroups%20give%20teams%20shared%20tools%20for%20collaborating%20using%20email%2C%20files%2C%20a%20calendar%2C%20and%20more.%3CBR%20%2F%3EYou%20can%20start%20right%20away%20using%20the%20New-UnifiedGroup%20cmdlet.%3C%2FP%3E%3CP%3E%5BADMIN%5D%20%5BConnected%5D%20%5BUnrestricted%5D%2008%2F20%2F2018%2009%3A37%3A29%20O%3A%5COffice365%3CBR%20%2F%3EPS%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20still%20displays%20the%20feature.%20Messes%20up%20my%20formatting%20on%20the%20page.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-234284%22%20slang%3D%22en-US%22%3ERe%3A%20Suppressing%20Text%20after%20New-DistributionList%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-234284%22%20slang%3D%22en-US%22%3E%3CP%3EI%20don't%20have%20the%20Cmdlet%20in%20front%20of%20me%20but%20that%20output%20could%20be%20minor%20warning%20message%20from%20the%20Cmdlet.%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETrying%20adding%20in%20-warningaction%20'silentlycontinue'%20*or*%20-informationaction%20silentlycontinue%20to%20see%20if%20that%20suppresses%20the%20message.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESilly%20question...%20what%20Colour%20is%20the%20message%3F%20(that%20can%20help%20identify%20the%20type%20of%20message)%3C%2FP%3E%0A%3CP%3ERED%20%3D%20Error%2C%20YELLOW%20%3D%20Warning%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20it's%20neither%20then%20it%20might%20just%20be%20information%20in%20which%20case%20ideally%20-informatinaction%20silentlycontinue%20should%20let%20you%20go%20on%20without%20being%20pestered.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESean%3C%2FP%3E%0A%3CP%3EGood%20friend%20of%20Dr.%20Scripto%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-225214%22%20slang%3D%22en-US%22%3ERe%3A%20Suppressing%20Text%20after%20New-DistributionList%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-225214%22%20slang%3D%22en-US%22%3EAny%20update%20on%20taking%20out%20the%20unwanted%20text%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-134615%22%20slang%3D%22en-US%22%3ERe%3A%20Suppressing%20Text%20after%20New-DistributionList%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-134615%22%20slang%3D%22en-US%22%3EIt%20is%20not%20an%20error%20though.%20%20It%20order%20to%20create%20a%20distribution%20list%2C%20you%20need%20to%20use%20New-DistributionList.%20%20As%20soon%20as%20you%20run%20it%20to%20create%20the%20list%2C%20then%20you%20have%20that%20unwanted%20text%20and%20there%20is%20no%20suppressing%20it.%20%20Oh%20well.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-134611%22%20slang%3D%22en-US%22%3ERe%3A%20Suppressing%20Text%20after%20New-DistributionList%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-134611%22%20slang%3D%22en-US%22%3E%3CP%3EI%20experience%20the%20same%20issue%20and%20I%20agree.%26nbsp%3B%20We%20should%20not%20have%20to%20put%20some%20crap%20code%20to%20deal%20with%20the%20message.%26nbsp%3B%20Microsoft%20should%20just%20not%20present%20that%20message%20or%20allow%20us%20to%20turn%20it%20off%20via%20the%20cmdlet.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECommon%20MS%20think%20things%20through%20would%20you%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-134193%22%20slang%3D%22en-US%22%3ERe%3A%20Suppressing%20Text%20after%20New-DistributionList%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-134193%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20create%20an%20array%20and%20the%20results%20to%20it%2C%20similar%20to%20below%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%24DlArray%20%3D%20%40()%3CBR%20%2F%3E%24DlArray%20%2B%3D%20%22UserPrincipalName%22%20%2B%20%22%2C%22%20%2B%20%22Comment%22%3CBR%20%2F%3E%24DlArray%20%2B%3D%20%22Creating%20security%20group%3A%22%20%2B%20%24_.ApproversGroup%3CBR%20%2F%3E%24DlArray%20%2B%3D%20%22Creating%20security%20group%3A%20SG-%22%20%2B%20%24_.RoomMailbox%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20will%20refine%20the%20results%2C%20you%20can%20add%20some%20logic%20to%20catch%20the%20errors.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-125008%22%20slang%3D%22en-US%22%3ERe%3A%20Suppressing%20Text%20after%20New-DistributionList%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-125008%22%20slang%3D%22en-US%22%3ESaving%20it%20to%20a%20variable%20won't%20work%20either.%20It%20still%20prints%20the%20Office%20365%20group%20message.%20I%20called%20Microsoft%20and%20they%20acknowledged%20the%20message%20and%20stated%20it%20is%20there%20only%20temporary%20but%20they%20have%20no%20timetable%20when%20they%20will%20remove%20it.%20Sometimes%2C%20Microsoft%20just%20does%20not%20think%20things%20through...%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-124796%22%20slang%3D%22en-US%22%3ERe%3A%20Suppressing%20Text%20after%20New-DistributionList%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-124796%22%20slang%3D%22en-US%22%3E%3CP%3ECouldnt%20you%20do%20something%20like%20this%3F%3CBR%20%2F%3EStore%20it%20to%20a%20variable%2C%20then%20give%20the%20output%20depending%20if%20its%20%24null%20or%20not.%3C%2FP%3E%3CPRE%3E%24newDB%20%3D%20New-DistributionGroup%20-Name%20%24ApproversGroup%20-Type%20%22Security%22%20-ManagedBy%20%24ApproverOwners%20-CopyOwnerToMember%20-Members%20%24Approvers%20-PrimarySmtpAddress%20%22%24(%24ApproversGroup.Replace('%20'%2C'_'))%40domain.com%22%20%0A%0AIf(%24newDB%20-ne%20%24null)%20%7B%0A%0A%20%20%20%20%22Completed%20successfully%22%0A%7D%0AElse%7B%22Error%22%7D%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-123605%22%20slang%3D%22en-US%22%3ERe%3A%20Suppressing%20Text%20after%20New-DistributionList%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-123605%22%20slang%3D%22en-US%22%3E%3CP%3ETHe%20output%20looks%20like%20this%3A%3C%2FP%3E%3CPRE%3EPS%26gt%3B.%5CCreate-VacationCalendar.ps1%0ALogging%20into%20Office%20365%0A%0AImporting%20Module%3A%20%20MSOnline...........Done.%0AImporting%20Credentials%20To%20Variable.....Done.%0ASetting%20Variable%20For%20New-PSSession....Done.%0AImporting%20PSSession...................Done.%0AConnecting%20To%20MSOLService.............Done.%0A%0ANew%20vacation%20calendar%20name%3A%20Zeff%20Calendar%0A%0ACreating%20the%20two%20security%20groups%20for%20the%20calendar%3A%20%20SG-Zeff%20Calendar%20Approvers%20and%20SG-Zeff%20Calendar%0A%0AEnter%20the%20owners%20of%20the%20SG-Zeff%20Calendar%20Approvers%20group%20(Press%20just%20the%20Enter%20key%20to%20finish)%0A%20%3A%20zeff_wheelock%40domain.com%0A%20%3A%0A%0AEnter%20the%20internet%20address%20of%20the%20approvers%20for%20the%20calendar%20(Press%20just%20the%20Enter%20key%20to%20finish)%0A%20%3A%20zeff_wheelock%40domain.com%0A%20%3A%0A%0AEnter%20the%20owners%20of%20the%20SG-Zeff%20Calendar%20group%20(Press%20just%20the%20Enter%20key%20to%20finish)%0A%20%3A%20zeff_wheelock%40domain.com%0A%20%3A%0A%0AEnter%20the%20people%20who%20will%20be%20accessing%20the%20calendar%20(Press%20just%20the%20Enter%20key%20to%20finish)%0A%20%3A%20zwheeloc%40domain.com%0A%20%3A%0A%0ACreating%20security%20group%3A%20SG-Zeff%20Calendar%20Approvers...New!%20Office%20365%20Groups%20are%20the%20next%20generation%20of%20distribution%20lis%0Ats.%0AGroups%20give%20teams%20shared%20tools%20for%20collaborating%20using%20email%2C%20files%2C%20a%20calendar%2C%20and%20more.%0AYou%20can%20start%20right%20away%20using%20the%20New-UnifiedGroup%20cmdlet.%0ADone.%0ACreating%20security%20group%3A%20SG-Zeff%20Calendar...New!%20Office%20365%20Groups%20are%20the%20next%20generation%20of%20distribution%20lists.%0AGroups%20give%20teams%20shared%20tools%20for%20collaborating%20using%20email%2C%20files%2C%20a%20calendar%2C%20and%20more.%0AYou%20can%20start%20right%20away%20using%20the%20New-UnifiedGroup%20cmdlet.%0ADone.%0ACreating%20Room%20Mailbox%3A%20Zeff%20Calendar...%0AName%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Alias%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ServerName%20%20%20%20%20%20%20ProhibitSendQuota%0A----%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-----%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20----------%20%20%20%20%20%20%20-----------------%0AZeff%20Calendar%20%20%20%20%20%20%20%20%20%20%20%20%20ZeffCalendar%20%20%20%20%20%20%20%20%20bn6pr02mb2434%20%20%20%2099%20GB%20(106%2C300%2C440%2C576%20bytes)%0ADone.%0ASetting%20calendar%20options....Done.%3C%2FPRE%3E%3CP%3Eit%20should%20look%20like%20this%3A%3C%2FP%3E%3CPRE%3EPS%26gt%3B.%5CCreate-VacationCalendar.ps1%0ALogging%20into%20Office%20365%0A%0AImporting%20Module%3A%20%20MSOnline...........Done.%0AImporting%20Credentials%20To%20Variable.....Done.%0ASetting%20Variable%20For%20New-PSSession....Done.%0AImporting%20PSSession...................Done.%0AConnecting%20To%20MSOLService.............Done.%0A%0ANew%20vacation%20calendar%20name%3A%20Zeff%20Calendar%0A%0ACreating%20the%20two%20security%20groups%20for%20the%20calendar%3A%20%20SG-Zeff%20Calendar%20Approvers%20and%20SG-Zeff%20Calendar%0A%0AEnter%20the%20owners%20of%20the%20SG-Zeff%20Calendar%20Approvers%20group%20(Press%20just%20the%20Enter%20key%20to%20finish)%0A%20%3A%20zeff_wheelock%40domain.com%0A%20%3A%0A%0AEnter%20the%20internet%20address%20of%20the%20approvers%20for%20the%20calendar%20(Press%20just%20the%20Enter%20key%20to%20finish)%0A%20%3A%20zeff_wheelock%40domain.com%3CBR%20%2F%3E%20%3A%0A%0AEnter%20the%20owners%20of%20the%20SG-Zeff%20Calendar%20group%20(Press%20just%20the%20Enter%20key%20to%20finish)%0A%20%3A%20zeff_wheelock%40domain.com%0A%20%3A%0A%0AEnter%20the%20people%20who%20will%20be%20accessing%20the%20calendar%20(Press%20just%20the%20Enter%20key%20to%20finish)%0A%20%3A%20zwheeloc%40domain.com%0A%20%3A%0A%0ACreating%20security%20group%3A%20SG-Zeff%20Calendar%20Approvers...Done.%0ACreating%20security%20group%3A%20SG-Zeff%20Calendar...Done.%0ACreating%20Room%20Mailbox%3A%20Zeff%20Calendar...Done.%0ASetting%20calendar%20options....Done.%3C%2FPRE%3E%3CP%3EFor%20the%20Creating%20Room%20Mailbox%20line%2C%20I%20just%20put%20an%20Out-Null%20to%20suppress%20the%20result%2C%20so%20the%20result%20above%20should%20be%20the%20expected%20outcome%20if%20it%20ran%20successfully.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-123309%22%20slang%3D%22en-US%22%3ERe%3A%20Suppressing%20Text%20after%20New-DistributionList%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-123309%22%20slang%3D%22en-US%22%3E%3CPRE%3EFunction%20Loop(%5Bstring%5D%24Person)%0A%7B%0A%20%20%20%20%24People%20%3D%20%40()%0A%20%20%20%20while%20(%24Person%20-ne%20%22%22)%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%24temp%3DGet-msoluser%20-UserPrincipalName%20%24Person%20-ErrorAction%20SilentlyContinue%0A%20%20%20%20%20%20%20%20if%20(%24temp)%20%7B%24People%2B%3D%24Person%7D%0A%20%20%20%20%20%20%20%20else%20%7BWrite-Host%20%22Not%20a%20valid%20email%20address%3A%20%24Person%22%7D%0A%20%20%20%20%20%20%20%20%24Person%20%3D%20Read-Host%20%22%20%22%0A%20%20%20%20%7D%0A%20%20%20%20return%20%24People%0A%7D%0AFunction%20Create-VacationCalendar%0A%7B%0A%20%20%20%20%22Logging%20into%20Office%20365%22%0A%20%20%20%20%22%20%22%0A%20%20%20%20.%5CConnectToOffice365.ps1%0A%20%20%20%20%22%20%22%0A%0A%20%20%20%20%24RoomMailbox%20%3D%20Read-Host%20%22New%20vacation%20calendar%20name%22%0A%20%20%20%20%24ApproversGroup%20%3D%20%22SG-%24RoomMailbox%20Approvers%22%0A%20%20%20%20%24RegularGroup%20%3D%20%22SG-%24RoomMailbox%22%0A%20%20%20%20%22%20%22%0A%0A%20%20%20%20%22Creating%20the%20two%20security%20groups%20for%20the%20calendar%3A%20%20%24ApproversGroup%20and%20%24RegularGroup%22%0A%20%20%20%20%22%20%22%0A%0A%20%20%20%20%22Enter%20the%20owners%20of%20the%20%24ApproversGroup%20group%20(Press%20just%20the%20Enter%20key%20to%20finish)%22%0A%20%20%20%20%24ApproverOwner%20%3D%20Read-Host%20%22%20%22%0A%20%20%20%20%24ApproverOwners%20%3D%20Loop%20%24ApproverOwner%0A%20%20%20%20%22%20%22%0A%0A%20%20%20%20Write-Host%20%22Enter%20the%20internet%20address%20of%20the%20approvers%20for%20the%20calendar%20(Press%20just%20the%20Enter%20key%20to%20finish)%22%0A%20%20%20%20%24Approver%20%3D%20Read-Host%20%22%20%22%0A%20%20%20%20%24Approvers%20%3D%20Loop%20%24Approver%0A%20%20%20%20%22%20%22%0A%0A%20%20%20%20%22Enter%20the%20owners%20of%20the%20%24RegularGroup%20group%20(Press%20just%20the%20Enter%20key%20to%20finish)%22%0A%20%20%20%20%24UserOwner%20%3D%20Read-Host%20%22%20%22%0A%20%20%20%20%24UserOwners%20%3D%20Loop%20%24UserOwner%0A%20%20%20%20%22%20%22%0A%20%20%20%20%22Enter%20the%20people%20who%20will%20be%20accessing%20the%20calendar%20(Press%20just%20the%20Enter%20key%20to%20finish)%22%0A%20%20%20%20%24User%20%3D%20Read-Host%20%22%20%22%0A%20%20%20%20%24Users%20%3D%20Loop%20%24User%0A%20%20%20%20%22%20%22%0A%0A%20%20%20%20Write-Host%20-NoNewline%20%22Creating%20security%20group%3A%20%24ApproversGroup...%22%0A%3CSTRONG%3E%20%20%20%20New-DistributionGroup%20-Name%20%24ApproversGroup%20-Type%20%22Security%22%20-ManagedBy%20%24ApproverOwners%20-CopyOwnerToMember%20-Members%20%24Approvers%20-PrimarySmtpAddress%20%22%24(%24ApproversGroup.Replace('%20'%2C'_'))%40domain.com%22%20%7C%20Out-Null%3C%2FSTRONG%3E%0A%20%20%20%20Write-Host%20%22Done.%22%0A%0A%20%20%20%20Write-host%20-NoNewline%20%22Creating%20security%20group%3A%20SG-%24RoomMailbox...%22%0A%20%20%20%20%3CSTRONG%3ENew-DistributionGroup%20-name%20%22SG-%24RoomMailbox%22%20-Type%20%22Security%22%20-ManagedBy%20%24UserOwners%20-CopyOwnerToMember%20-Members%20%24Users%20-PrimarySmtpAddress%20%22%24(%24RegularGroup.Replace('%20'%2C'_'))%40domain.com%22%20%7C%20Out-Null%3C%2FSTRONG%3E%0A%20%20%20%20Write-Host%20%22Done.%22%0A%0A%20%20%20%20Write-Host%20-NoNewline%20%22Creating%20Room%20Mailbox%3A%20%24RoomMailbox...%22%0A%20%20%20%20New-Mailbox%20-name%20%24RoomMailbox%20-Room%20-PrimarySmtpAddress%20%22%24(%24RoomMailbox.Replace('%20'%2C'_'))%40harvardpilgrim.org%22%0A%20%20%20%20Write-Host%20%22Done.%22%0A%0A%20%20%20%20Write-Host%20-NoNewline%20%22Setting%20calendar%20options...%22%0A%20%20%20%20while%20(-not%20(Get-CalendarProcessing%20-Identity%20%24RoomMailbox%20-ErrorAction%20SilentlyContinue))%20%7BWrite-host%20-NoNewline%20%22.%22%3BSleep%2010%7D%0A%0A%0A%20%20%20%20%24AutomateProcessing%20%3D%20%22AutoAccept%22%0A%20%20%20%20%24AllowRecurringMeetings%20%3D%20%24True%0A%20%20%20%20%24AllowConflicts%20%3D%20%24True%0A%20%20%20%20%24MaximumDurationInMinutes%20%3D%200%0A%20%20%20%20%24ConflictPercentageAllowed%20%3D%20100%0A%20%20%20%20%24MaximumConflictInstances%20%3D%2010%0A%20%20%20%20%24BookingWindowInDays%20%3D%20365%0A%20%20%20%20%24EnforceSchedulingHorizon%20%3D%20%24False%0A%20%20%20%20%24AddOrganizerToSubject%20%3D%20%24True%0A%20%20%20%20%24DeleteComments%20%3D%20%24False%0A%20%20%20%20%24DeleteSubject%20%3D%20%24False%0A%0A%20%20%20%20Set-CalendarProcessing%20-Identity%20%24RoomMailbox%20%60%0A%20%20%20%20%20%20%20%20-AutomateProcessing%20%24AutomateProcessing%20%60%0A%20%20%20%20%20%20%20%20-AllowRecurringMeetings%20%24AllowRecurringMeetings%20%60%0A%20%20%20%20%20%20%20%20-AllowConflicts%20%24AllowConflicts%20%60%0A%20%20%20%20%20%20%20%20-MaximumDurationInMinutes%20%24MaximumDurationInMinutes%20%60%0A%20%20%20%20%20%20%20%20-ConflictPercentageAllowed%20%24ConflictPercentageAllowed%20%60%0A%20%20%20%20%20%20%20%20-MaximumConflictInstances%20%24MaximumConflictInstances%20%60%0A%20%20%20%20%20%20%20%20-BookingWindowInDays%20%24BookingWindowInDays%20%60%0A%20%20%20%20%20%20%20%20-EnforceSchedulingHorizon%20%24EnforceSchedulingHorizon%20%60%0A%20%20%20%20%20%20%20%20-AddOrganizerToSubject%20%24AddOrganizerToSubject%20%60%0A%20%20%20%20%20%20%20%20-DeleteComments%20%24DeleteComments%20%60%0A%20%20%20%20%20%20%20%20-DeleteSubject%20%24DeleteSubject%20%60%0A%20%20%20%20%20%20%20%20-BookInPolicy%20%24ApproversGroup%20%60%0A%20%20%20%20%20%20%20%20-ResourceDelegates%20%24ApproversGroup%20%7C%20Out-Null%0A%20%20%20%20Write-Host%20%22Done.%22%0A%7D%0ACreate-VacationCalendar%3C%2FPRE%3E%3CP%3E%26nbsp%3BEach%20time%20I%20run%20it%2C%20I%20try%20to%20format%20the%20output%2C%20but%20the%20info%20for%20using%20groups%20keeps%20messing%20the%20output%20up.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-122883%22%20slang%3D%22en-US%22%3ERe%3A%20Suppressing%20Text%20after%20New-DistributionList%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-122883%22%20slang%3D%22en-US%22%3E%3CP%3ECould%20you%20post%20the%20script%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20you%20could%20do%20is%20to%20store%20the%20output%20in%20a%20variable%2C%20then%20output%20it%20with%20a%20small%20delay.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Frequent Contributor

I have a script which I am creating a distribution list (New-DistributionList).  However, the format of the output gets screwed up when the following text appears:

 

New! Office 365 Groups are the next generation of  distribution lists.
Groups give teams shared tools for collaborating using email, files, a calendar, and more.
You can start right away using the New-UnifiedGroup cmdlet.

 

How do you suppress this text?  I tried to pipe it to out-null to no avail.

13 Replies
Highlighted

Could you post the script?

 

What you could do is to store the output in a variable, then output it with a small delay.

Highlighted
Function Loop([string]$Person)
{
    $People = @()
    while ($Person -ne "")
    {
        $temp=Get-msoluser -UserPrincipalName $Person -ErrorAction SilentlyContinue
        if ($temp) {$People+=$Person}
        else {Write-Host "Not a valid email address: $Person"}
        $Person = Read-Host " "
    }
    return $People
}
Function Create-VacationCalendar
{
    "Logging into Office 365"
    " "
    .\ConnectToOffice365.ps1
    " "

    $RoomMailbox = Read-Host "New vacation calendar name"
    $ApproversGroup = "SG-$RoomMailbox Approvers"
    $RegularGroup = "SG-$RoomMailbox"
    " "

    "Creating the two security groups for the calendar:  $ApproversGroup and $RegularGroup"
    " "

    "Enter the owners of the $ApproversGroup group (Press just the Enter key to finish)"
    $ApproverOwner = Read-Host " "
    $ApproverOwners = Loop $ApproverOwner
    " "

    Write-Host "Enter the internet address of the approvers for the calendar (Press just the Enter key to finish)"
    $Approver = Read-Host " "
    $Approvers = Loop $Approver
    " "

    "Enter the owners of the $RegularGroup group (Press just the Enter key to finish)"
    $UserOwner = Read-Host " "
    $UserOwners = Loop $UserOwner
    " "
    "Enter the people who will be accessing the calendar (Press just the Enter key to finish)"
    $User = Read-Host " "
    $Users = Loop $User
    " "

    Write-Host -NoNewline "Creating security group: $ApproversGroup..."
    New-DistributionGroup -Name $ApproversGroup -Type "Security" -ManagedBy $ApproverOwners -CopyOwnerToMember -Members $Approvers -PrimarySmtpAddress "$($ApproversGroup.Replace(' ','_'))@domain.com" | Out-Null
    Write-Host "Done."

    Write-host -NoNewline "Creating security group: SG-$RoomMailbox..."
    New-DistributionGroup -name "SG-$RoomMailbox" -Type "Security" -ManagedBy $UserOwners -CopyOwnerToMember -Members $Users -PrimarySmtpAddress "$($RegularGroup.Replace(' ','_'))@domain.com" | Out-Null
    Write-Host "Done."

    Write-Host -NoNewline "Creating Room Mailbox: $RoomMailbox..."
    New-Mailbox -name $RoomMailbox -Room -PrimarySmtpAddress "$($RoomMailbox.Replace(' ','_'))@harvardpilgrim.org"
    Write-Host "Done."

    Write-Host -NoNewline "Setting calendar options..."
    while (-not (Get-CalendarProcessing -Identity $RoomMailbox -ErrorAction SilentlyContinue)) {Write-host -NoNewline ".";Sleep 10}


    $AutomateProcessing = "AutoAccept"
    $AllowRecurringMeetings = $True
    $AllowConflicts = $True
    $MaximumDurationInMinutes = 0
    $ConflictPercentageAllowed = 100
    $MaximumConflictInstances = 10
    $BookingWindowInDays = 365
    $EnforceSchedulingHorizon = $False
    $AddOrganizerToSubject = $True
    $DeleteComments = $False
    $DeleteSubject = $False

    Set-CalendarProcessing -Identity $RoomMailbox `
        -AutomateProcessing $AutomateProcessing `
        -AllowRecurringMeetings $AllowRecurringMeetings `
        -AllowConflicts $AllowConflicts `
        -MaximumDurationInMinutes $MaximumDurationInMinutes `
        -ConflictPercentageAllowed $ConflictPercentageAllowed `
        -MaximumConflictInstances $MaximumConflictInstances `
        -BookingWindowInDays $BookingWindowInDays `
        -EnforceSchedulingHorizon $EnforceSchedulingHorizon `
        -AddOrganizerToSubject $AddOrganizerToSubject `
        -DeleteComments $DeleteComments `
        -DeleteSubject $DeleteSubject `
        -BookInPolicy $ApproversGroup `
        -ResourceDelegates $ApproversGroup | Out-Null
    Write-Host "Done."
}
Create-VacationCalendar

 Each time I run it, I try to format the output, but the info for using groups keeps messing the output up.

Highlighted

THe output looks like this:

PS>.\Create-VacationCalendar.ps1
Logging into Office 365

Importing Module:  MSOnline...........Done.
Importing Credentials To Variable.....Done.
Setting Variable For New-PSSession....Done.
Importing PSSession...................Done.
Connecting To MSOLService.............Done.

New vacation calendar name: Zeff Calendar

Creating the two security groups for the calendar:  SG-Zeff Calendar Approvers and SG-Zeff Calendar

Enter the owners of the SG-Zeff Calendar Approvers group (Press just the Enter key to finish)
 : zeff_wheelock@domain.com
 :

Enter the internet address of the approvers for the calendar (Press just the Enter key to finish)
 : zeff_wheelock@domain.com
 :

Enter the owners of the SG-Zeff Calendar group (Press just the Enter key to finish)
 : zeff_wheelock@domain.com
 :

Enter the people who will be accessing the calendar (Press just the Enter key to finish)
 : zwheeloc@domain.com
 :

Creating security group: SG-Zeff Calendar Approvers...New! Office 365 Groups are the next generation of distribution lis
ts.
Groups give teams shared tools for collaborating using email, files, a calendar, and more.
You can start right away using the New-UnifiedGroup cmdlet.
Done.
Creating security group: SG-Zeff Calendar...New! Office 365 Groups are the next generation of distribution lists.
Groups give teams shared tools for collaborating using email, files, a calendar, and more.
You can start right away using the New-UnifiedGroup cmdlet.
Done.
Creating Room Mailbox: Zeff Calendar...
Name                      Alias                ServerName       ProhibitSendQuota
----                      -----                ----------       -----------------
Zeff Calendar             ZeffCalendar         bn6pr02mb2434    99 GB (106,300,440,576 bytes)
Done.
Setting calendar options....Done.

it should look like this:

PS>.\Create-VacationCalendar.ps1
Logging into Office 365

Importing Module:  MSOnline...........Done.
Importing Credentials To Variable.....Done.
Setting Variable For New-PSSession....Done.
Importing PSSession...................Done.
Connecting To MSOLService.............Done.

New vacation calendar name: Zeff Calendar

Creating the two security groups for the calendar:  SG-Zeff Calendar Approvers and SG-Zeff Calendar

Enter the owners of the SG-Zeff Calendar Approvers group (Press just the Enter key to finish)
 : zeff_wheelock@domain.com
 :

Enter the internet address of the approvers for the calendar (Press just the Enter key to finish)
 : zeff_wheelock@domain.com
: Enter the owners of the SG-Zeff Calendar group (Press just the Enter key to finish) : zeff_wheelock@domain.com : Enter the people who will be accessing the calendar (Press just the Enter key to finish) : zwheeloc@domain.com : Creating security group: SG-Zeff Calendar Approvers...Done. Creating security group: SG-Zeff Calendar...Done. Creating Room Mailbox: Zeff Calendar...Done. Setting calendar options....Done.

For the Creating Room Mailbox line, I just put an Out-Null to suppress the result, so the result above should be the expected outcome if it ran successfully.

Highlighted

Couldnt you do something like this?
Store it to a variable, then give the output depending if its $null or not.

$newDB = New-DistributionGroup -Name $ApproversGroup -Type "Security" -ManagedBy $ApproverOwners -CopyOwnerToMember -Members $Approvers -PrimarySmtpAddress "$($ApproversGroup.Replace(' ','_'))@domain.com" 

If($newDB -ne $null) {

    "Completed successfully"
}
Else{"Error"}
Highlighted
Saving it to a variable won't work either. It still prints the Office 365 group message. I called Microsoft and they acknowledged the message and stated it is there only temporary but they have no timetable when they will remove it. Sometimes, Microsoft just does not think things through...
Highlighted

You create an array and the results to it, similar to below:

 

$DlArray = @()
$DlArray += "UserPrincipalName" + "," + "Comment"
$DlArray += "Creating security group:" + $_.ApproversGroup
$DlArray += "Creating security group: SG-" + $_.RoomMailbox

 

This will refine the results, you can add some logic to catch the errors.

Highlighted

I experience the same issue and I agree.  We should not have to put some crap code to deal with the message.  Microsoft should just not present that message or allow us to turn it off via the cmdlet.

 

Common MS think things through would you?

Highlighted
It is not an error though. It order to create a distribution list, you need to use New-DistributionList. As soon as you run it to create the list, then you have that unwanted text and there is no suppressing it. Oh well.
Highlighted
Any update on taking out the unwanted text?
Highlighted

I don't have the Cmdlet in front of me but that output could be minor warning message from the Cmdlet.  

Trying adding in -warningaction 'silentlycontinue' *or* -informationaction silentlycontinue to see if that suppresses the message.

 

Silly question... what Colour is the message? (that can help identify the type of message)

RED = Error, YELLOW = Warning

 

If it's neither then it might just be information in which case ideally -informatinaction silentlycontinue should let you go on without being pestered.

 

Sean

Good friend of Dr. Scripto

Highlighted

White. So it is not a warning or an error. It is a forced statement that cannot be blocked by sending it to Null.

 

PS> New-DistributionGroup -name "TEST DELETE" -type "Security" -CopyOwnerToMember -ManagedBy "my_email_address@domain.com" -PrimarySmtpAddress test_delete@domain.com| out-null
New! Office 365 Groups are the next generation of distribution lists.
Groups give teams shared tools for collaborating using email, files, a calendar, and more.
You can start right away using the New-UnifiedGroup cmdlet.

[ADMIN] [Connected] [Unrestricted] 08/20/2018 09:37:29 O:\Office365
PS>

 

It still displays the feature. Messes up my formatting on the page.

Highlighted

It appears to be "Information" which normally could be re-directed using "InformationAction" however that parameter has not been exposed in the New-DistributionGroup Cmdlet for Exchange Online.

 

I've created an entry in UserVoice for the Exchange Online Administration.   

https://office365.uservoice.com/forums/273493-office-365-admin/suggestions/35163415-new-distribution...

 

But you are correct, at this time the content cannot be captured or redirected.

 

Highlighted

Thanks.  Already put my 3 votes in...  <smile>