Bart Timmermans

Powershell

October 6th, 2011 Leave a comment Go to comments
  • Exchange Powershell: How to import accepted domains from CSV file

    During migration projects a lot of customers asks me how to import all accepted domains the easy way. The script I provide below is very basic but it will save you a lot of time.

    But first create a CSV file with on the first line AcceptedDomains. Insert all your accepted domains on seperate lines starting from the second line.

    $File = Read-Host "Please enter location and filename of the CSV file (example: D:TempAcceptedDomain.CSV)"

    # Reading of all lines within the specified CSV file.

    $list = Import-Csv $File

    foreach($entry in $list) {

    # Reading the AcceptedDomain variable from the CSV file.

    $AcceptedDomain = $entry.AcceptedDomain

    # Running the powershell command for creation of all Accepted Domains.

    New-AcceptedDomain -Name $AcceptedDomain -DomainName $AcceptedDomain

    }

  • Exchange 2010: Remotely create a mailbox

    I have created an script which will remotely enables a users mailbox.

    # This powershell script creates a remote mailbox.
    # Created by Bart Timmermans
    $Server = Read-Host "(Please enter the hostname of your Exchange 2010 Server)"
    $User = Read-Host "Please enter the username (domainuser)"
    $ServerFull = "HTTP://" + $Server + "/Powershell"

    # Start session to remote Exchange 2010 server.
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $ServerFull -Authentication Kerberos
    Import-PSSession $Session

    # Create new mailbox
    Enable-Mailbox -identity $User

  1. No comments yet.
  1. No trackbacks yet.
Security Code: