Archive for the ‘Powershell’ Category

Remove disconnected mailboxes from the database using Powershell in Exchange 2007

Saturday, January 12th, 2008

Get-MailboxStatistics -database “SERVER\Mailbox Database” | where {$_.disconnectdate -ne $null} | foreach {Remove-mailbox -database $_.database -storemailboxidentity $_.mailboxguid}

Create mail-enabled public folder using Powershell in Exchange 2007

Saturday, January 12th, 2008

New-PublicFolder -Name “test@test.com” -Path \TEST

Enable-MailPublicFolder -Identity “\TEST\test@test.com”

Set-MailPublicFolder -Identity “\TEST\test@test.com” -EmailAddressPolicyEnabled $false

Set-MailPublicFolder -Identity “\TEST\test@test.com” -EmailAddresses “test@test.com”, “test@test.net”, “test@test.org”

Set-MailPublicFolder -Identity “\TEST\test@test.com” -PrimarySmtpAddress test@test.comAdd-PublicFolderClientPermission -Identity “\TEST\test@test.com” -User Username -AccessRights EditorGet-PublicFolderClientPermission -Identity “\TEST\test@test.com” | fl

New certificate in Exchange 2007 step-by-step

Saturday, January 12th, 2008

1. step
New-ExchangeCertificate -generaterequest:1 -domainname domain.com,mail.domain.com,smtp.domain.com,pop3.domain.com -privatekeyexportable:1 -path c:\cert.txt -force:1

2. step
Import certificate request using web access to your Certification authority - logon as administrator! (WEB SERVER!!!)

3. step
Export certificate to a location on the disk… c:\certnew.crt

4. step
Import-ExchangeCertificate -path c:\certnew.cer

5. step
Enable-ExchangeCertificate -thumbprint 5ACC9A5D90E2CFDBAD6E25CD02362B8954506810 -Services “IIS,POP,SMTP,IMAP”

To remove old certificates:
Remove-ExchangeCertificate -Thumbprint …………

Create new autodiscover virtual directory

Saturday, January 12th, 2008

New-AutoDiscoverVirtualDirectory -websitename “SITE-NAME” -WindowsAuthentication $true -DigestAuthentication $false -BasicAuthenticvation $true

View all public folders recursively using Powershell in Exchange 2007

Saturday, January 12th, 2008

get-PublicFolder \ -recur

SenderID configuration using Powershell in Exchange 2007

Saturday, January 12th, 2008

Set-SenderIDConfig -Enabled $true
Set-SenderIDConfig -SpoofedDomainAction StampStatus | Reject | Delete
Set-SenderIDConfig -TempErrorAction StampStatus | Reject | Delete

Check Activesync policy settings using Powershell in Exchange 2007

Saturday, January 12th, 2008

Get-ActiveSyncMailboxPolicy -Identity “POLICYNAME”

Activesync policy to allow phone to be locked immediatly using Powershell in Exchange 2007

Saturday, January 12th, 2008

Set-ActiveSyncMailboxPolicy -identity “POLICYNAME” -MaxInactivityTimeDeviceLock:00:00:00

This script allows you to use instant “lock” on your phone…

Update safelist using Powershell in Exchange 2007

Saturday, January 12th, 2008

get-mailbox -ResultSize Unlimited | where {$_.RecipientType -eq [Microsoft.Exchange.Data.Directory.Recipient.RecipientType]::UserMailbox } | update-safelist

Public folder configuration using Powershell in Exchange 2007

Saturday, January 12th, 2008

Set Public folder primary SMTP address:
Set-MailPublicFolder -Identity PublicFolder@contoso.com -PrimarySmtpAddress info@contoso.com

Set Public folder permissions
Add-PublicFolderClientPermission -Identity “\public@folder.com” -User Username -AccessRights Editor