Michael Leonard
asked on
need assistance with a powershell script
hello, i'm looking for a script that i can schedule to run nightly that will check all accounts in an OU and if it encounters an e2010 mailbox that does not have an "online archive" enabled, to go ahead and enable the online archive and set the limits on it.
I have a Quest commandlets script that I run to enable archive by security group, can someone provide a way to target only accounts in a particular OU that do not have an archive enabled.
i've included part of the Quest script that i use to enabled the online archive.
i belive i would need to start with something like:
get-qaduser -OU "OU=Users,DC=domain,DC=com " -filter {Archive Enabled -ne $True} then pipe these results to the snippet below.
thx in advance.
S.
I have a Quest commandlets script that I run to enable archive by security group, can someone provide a way to target only accounts in a particular OU that do not have an archive enabled.
i've included part of the Quest script that i use to enabled the online archive.
i belive i would need to start with something like:
get-qaduser -OU "OU=Users,DC=domain,DC=com
thx in advance.
S.
Enable-Mailbox $displayname -Archive -ArchiveDatabase $ArchiveDatabaseName
Set-Mailbox –identity $displayname –ArchiveQuota 8GB –ArchiveWarningQuota 7096MB
ASKER
thx Chris, we have multiple databases, if i wanted to target only e2010 users could i use this format
Get-Mailbox -Server "MailboxServer1" then pipe it to where-object ...
would that work?
its just that we have a mixed 2003/2010 environment so if i target an OU i would also be hitting e2003 mailbox enabled accounts.
Get-Mailbox -Server "MailboxServer1" then pipe it to where-object ...
would that work?
its just that we have a mixed 2003/2010 environment so if i target an OU i would also be hitting e2003 mailbox enabled accounts.
Yeah, that would work. You can mix in as many as you wish, so if you wanted those on a specific server and in an OU there's no harm in doing:
Get-Mailbox -Server "MailboxServer" -OrganizationalUnit "OU=somewhere,DC=domain,DC =com"
But I imagine you already knew that :)
Chris
Get-Mailbox -Server "MailboxServer" -OrganizationalUnit "OU=somewhere,DC=domain,DC
But I imagine you already knew that :)
Chris
ASKER
Hi Chris, just tried running that in the lab and here is the error:
Pipeline not executed because a pipeline is already executing. Pipelines cannot be executed concurrently.
+ CategoryInfo : OperationStopped: (Microsoft.Power...tHelper Runspace:E xecutionCm dletHelper Runspace) [],
PSInvalidOperationExceptio n
+ FullyQualifiedErrorId : RemotePipelineExecutionFai led
Pipeline not executed because a pipeline is already executing. Pipelines cannot be executed concurrently.
+ CategoryInfo : OperationStopped: (Microsoft.Power...tHelper
PSInvalidOperationExceptio
+ FullyQualifiedErrorId : RemotePipelineExecutionFai
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thx Chris. that did the trick! appreciate your assistance!
S.
S.
Open in new window
You might be able to make more efficient filters using just Get-Mailbox (rather than Where-Object), but I don't have Exchange 2010 to test that theory against.To check and see what you can use to find things that aren't enabled, start with:
Open in new window
And / Or:Open in new window
Chris