Powershell Script for assigning RoomMailbox owners
Hello! I am working on a series of scripts for our support desk to help manage our Exchange 2007 systems. One of the main requests for them is to be able to assign owners of resource calendars. While this seemed simple enough, I am stuck on having the script filter out UserMailboxes. Here is the code I am currently using (this has went through several variations, but none of them worked). $mailbox = read-host "Please enter the name of the calendar / shared mailbox from Outlook" $owner = read-host "Please enter the name of the person to be made owner of the calendar" $resource = get-mailbox $mailbox |fw recipienttypedetails if ('$resource -ne "UserMailbox"') {add-mailboxpermission $mailbox -accessrights fullaccess -user $owner} else {Write-Host "The mailbox requested is not configured as a resouce mailbox. Please escalate the ticket with this information"} I'm sure I'm missing something, I just can't figure out what.
October 29th, 2010 9:50am

Try changing this: $resource = get-mailbox $mailbox |fw recipienttypedetails to $resource = (get-mailbox $mailbox).recipienttypedetails Just use fw to send formatted output to the console. It doesn't work for setting a variable to an object property.[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Free Windows Admin Tool Kit Click here and download it now
October 29th, 2010 10:12am

That did it. Thank you so much.
October 29th, 2010 10:18am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics