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

Automating settings on a room mailbox

$
0
0

Hi

I'm trying to create a script that will automate some of the settings for room mailboxes for our organization with a PowerShell script, however, I'm a newbie when it comes to this sort of thing and I'm struggling.

One of the guys who worked here while we were migrating to Exchange 2010 wrote a PowerShell script that asks for a number of parameters and then creates a shared mailbox based on those parameters, so I've made a copy and gone in and made some modifications which all work as expected.

I'm trying to create a second script that goes and changes things like the capacity, BookingWindowInDays and MaximumDurationInMinutes etc.

My problem is I don't know how to do the capacity bit.

At the top of my script I've got the following:

# Parameters below are where you enter the information of the rooms, which PowerShell will then use later on in the script

param(
    [parameter(Position=0,Mandatory=$true,ValueFromPipeline=$false,HelpMessage="Room Name")][string]$Name,
    [parameter(Position=1,Mandatory=$true,ValueFromPipeline=$false,HelpMessage="MANAGEMENT Group")][String]$MGRGroup,
 [parameter(Position=2,Mandatory=$true,ValueFromPipeline=$false,HelpMessage="USER Group")][String]$USRGroup,
 [parameter(Position=3,Mandatory=$true,ValueFromPipeline=$false,HelpMessage="Capacity")][String]$Capacity
    )

# Loads the ActiveDirectory module into PowerShell if it hasn't already been loaded. This is because the new-adgroup is an AD commandlet rather than an Exchange one  
  
Import-Module ActiveDirectory -ErrorAction SilentlyContinue

# Setup splatting hashtable
$NewSharedMailbox = @{
    "Shared" = $True
    "Name" = $Name
}
# Check parameters OK and add relevant parameters to splatting hashtable
$Recipient=Get-Recipient $Name -ErrorAction SilentlyContinue

How do I then set the capacity? When I do

# Set room mailbox 'standard config'

write-host
Write-Host -ForegroundColor Green "Setting Room Mailbox Standard Config"

try {get-mailbox -name $name | Set-Mailbox -ResourceCapacity $Capacity }
 catch {
     write-host
  write-host -ForegroundColor Green "Please wait..."
  }

PowerShell asks me for the identity of the Set-Mailbox.

Any advice would be greatly appreciated as its doing my head in! I thought I was making good progress with the create room script, but now I've hit a brick wall.

Thanks in advance!


Viewing all articles
Browse latest Browse all 6937

Trending Articles