Running Get and Set command to set the value

AMaDAC 81 Reputation points
2021-03-31T05:37:24.85+00:00

For Example I run:

Get-CsTeamsMeetingPolicy -Identity Global
with return value of (sample only)

AllowMeetNow : True
MeetingChatEnabledType : Disabled

And for every value should be equal to set command

Set-CsTeamsMeetingPolicy -AllowMeetNow $False -MeetingChatEnabledType Disabled

How do I write if and else statement with parameters to set the -AllowMeetnow to $false and -MeetingChatEnabledType

Please advise or walk through me to forum or link.

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
9,122 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ian Xue (Shanghai Wicresoft Co., Ltd.) 29,971 Reputation points Microsoft Vendor
    2021-03-31T07:48:52.803+00:00

    Hi,

    Why do you want an if statement since only the set command is needed to be executed?

    $global = Get-CsTeamsMeetingPolicy -Identity Global  
    Set-CsTeamsMeetingPolicy -AllowMeetNow $global.AllowMeetNow -MeetingChatEnabledType $global.MeetingChatEnabledType   
    

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful