How to omit powershell parameter from cmdlet if value not provided?

前端 未结 3 1809
青春惊慌失措
青春惊慌失措 2021-01-27 07:21

I\'m trying to execute a below Powershell command to create a new address list on exchange server with parameters like Name, Container, etc.

Container is an

3条回答
  •  情话喂你
    2021-01-27 07:33

    Have a look at the documentation for the -Container parameter in New-AddressList: https://docs.microsoft.com/en-us/powershell/module/exchange/email-addresses-and-address-books/new-addresslist?view=exchange-ps#optional-parameters

    Specifically:

    If you don't use this parameter,the address list is created under the root (\).

    ...

    Default value: None

    $container = $null
    New-AddressList -Container $container
    
    # or...
    
    $container = "\"
    New-AddressList -Container $container
    

提交回复
热议问题