Solved

How to change set-mailbox credentials

Posted on 2009-07-07
14
1,474 Views
Last Modified: 2012-06-21
Hi folks,

So, I can do this:

$c = Get-Credential
Get-Mailbox -DomainController dc.test.com -Credential $c username

and it works nicely.  However I can't do the same thing for Set-Mailbox!  There's no -Credential parameter.  How do I specify alternate credentials using Set-Mailbox?  
0
Comment
Question by:lacheur42
  • 7
  • 4
  • 3
14 Comments
 
LVL 6

Expert Comment

by:grandebob
ID: 24797170
We had to use add-adpermission with -accessrights and -extendrights options.
0
 
LVL 1

Author Comment

by:lacheur42
ID: 24797361
I don't really understand what that does - can you give me some syntax?
0
 
LVL 6

Expert Comment

by:grandebob
ID: 24797402
get-help add-adpermission would be a good place to start if you are planning on making scripts, which i think you are planning on. Below is a varient on a line in a script we use to give a user permissions to send as a different email address.

add-adpermission "user1@domain.com" -user "user2@domain.com -accessrights "GenericAll" -extendedrights "Send As"

Open in new window

0
 
LVL 1

Author Comment

by:lacheur42
ID: 24797582
I'm thinking that's not what I need exactly.

I'm on a machine that belongs to one domain (A) and trying to modify my email account on another domain (B) - for get-mailbox, setting the credentials to my domain account on (B) works.

I'd prefer to avoid permanently adding permissions to my domain account (A) to modify my domain account (B), which it seems like you're suggesting (not sure if that would even work...).
0
 
LVL 6

Expert Comment

by:grandebob
ID: 24797688
Your original post didn't say anything about cross domains.

I think I see what you are getting at. Perhaps you can just open powershell using the credentials of the other domain by using the runas command?
0
 
LVL 1

Author Comment

by:lacheur42
ID: 24797972
Sorry - I thought it was going to be a simple answer.  

Yeah, I've tried doing that, but it keeps trying to grab the DC for the machine I'm on, even if I specify it:
Set-Mailbox -DomainController DC.B.com -SimpleDisplayName "First Last" flast

   Set-Mailbox : Active Directory server DC.A.com is not available. Error message: A local error occurred.

It's really irritating that the -credential parameter is missing, I don't get it!
0
 
LVL 1

Author Comment

by:lacheur42
ID: 24798934
Bumping the points.  Any other thoughts?
0
The curse of the end user strikes again      

You’ve updated all your end user’s email signatures. Hooray! But guess what? They’re playing around with the HTML, adding stupid taglines and ruining the imagery. Find out how you can save your signatures from end users today.

 
LVL 70

Expert Comment

by:Chris Dent
ID: 24802841

Hey :)

That does appear to be a bit of a pain. Have you considered approaching it with tools built for AD rather than those build for Exchange?

It would possibly be worth grabbing the Quest cmdlets for this:

http://www.quest.com/activeroles-server/arms.aspx

"Set-QADUser" does allow you to pass credentials via Connect-QADService. Usage combining Connect-QADService and Set-QADuser is in the examples towards the end of "Get-Help Set-QADUser -Full".

Then you could do something like this:

Set-QADUser "UniqueIdForUser" -ObjectAttributes @{displayNamePrintable='SomeValue'}

Chris
0
 
LVL 1

Author Comment

by:lacheur42
ID: 24805578
I have those installed, but I'm not clear on how I would use them to set mailbox-specific properties such as SimpleDisplayName.

Set-QADUser "UniqueIdForUser" -Credential $c -ObjectAttributes @{SimpleDisplayName='SomeValue'}

Doesn't throw an error, but it also doesn't change the value of SimpleDisplayName.
0
 
LVL 70

Expert Comment

by:Chris Dent
ID: 24806562

That's because what's called "Simple Display Name" in the GUI is called displayNamePrintable in the directory, hence it's inclusion in my example :)

Chris
0
 
LVL 1

Author Comment

by:lacheur42
ID: 24816751
Maybe I'm misunderstanding something, but it seems like you're saying the following should work.  It doesn't.

Thanks,
Erik
$c = Get-Credential

Set-QADUser "flast" -ObjectAttributes @{displayNamePrintable='First M Last'}

$mb = Get-Mailbox -DomainController chidc02.huronconsultinggroup.com -Credential $c flast

echo $mb.SimpleDisplayName

Open in new window

0
 
LVL 70

Accepted Solution

by:
Chris Dent earned 250 total points
ID: 24818124

Error messages?

This is what I mean.

Chris
# First set the attribute after authenticating the connection
 

$pw = Read-Host "Please enter password" -AsSecureString

Connect-QADService -Server "chidc02.huronconsulting.com" `

  -ConnectionAccount "SomeDomain\SomeUser" -ConnectionPassword $pw

Set-QADUser "SomeDomain\flast" -ObjectAttributes @{displayNamePrintable='First M Last'}

Disconnect-QADService
 

# Then read it back again
 

$c = Get-Credential

(Get-Mailbox "flast" -DomainController chidc02.huronconsultinggroup.com `

  -Credential $c).SimpleDisplayName

Open in new window

0
 
LVL 1

Author Comment

by:lacheur42
ID: 24819526
Ok, that totally works.  I was just running it as the account, not using the "Connect-QADService", and I wasn't getting an error, it just wasn't updating.  Using your method works like a charm.   In case anyone reads this, -Service not -Server

Thanks!
0
 
LVL 70

Expert Comment

by:Chris Dent
ID: 24821142

Oops sorry, not sure how I managed to put server in there, automatic typing I guess :)

Chris
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now