Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

True/false enable mailbox in bulk add user script

$
0
0

Hi.

I am new to Powershell.

I am creating a powershell script to bulk create users from csv-file.

Some users need mail boxes and others don't. Therefore, I would like to create the coloumn "Mailbox" in my csv-file with the true og false parameter set.

If the value equals "true" then the mail box should be enabled. If value equals "false" then no mailbox shoud be created and script should continue creating home folders etc.

In my script how do I incorporate that if Mailbox = true then enable mailbox?

# Create remote powershell Connection to Exchange server

$ConnectionUri = "http://x.corp.net/powershell/"

$ExSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $ConnectionUri

Import-PSSession $ExSession

# Create mailbox

Enable-Mailbox $User.SamAccountName -database MBX00_x

 

 

$ExSession|remove-pssession

Regards


Viewing all articles
Browse latest Browse all 8583

Trending Articles