Monday, 14 March 2011
Set-MailboxCalendarSettings Code Snippet
Thursday, 10 March 2011
Converting Mail User to Mail Enabled User With Mail Forwarding to External EMail Address (Exchange 2007)
$pwd = Read-Host "Enter Password" -Assecurestring
New-Mailuser -Name "Greg Perth" -ExternalEmailAddress "Greg.Perth@hotmail.com" -OrganizationalUnit "Perth" -Password $pwd -UserPrincipalName "Greg.Perth@mycompanydomain.com.au" -SamAccountName "Greg.Perth"
$obj = Get-MailUser -id "Greg Perth"
Disable-MailUser -id "Greg Perth" -confirm:$false
$timer = [diagnostics.stopwatch]::startnew()
$erroractionpreference = "silentlycontinue"
$mailboxsuccess = $false
while (($timer.elapsed.totalseconds -lt 900) -and (!($mailboxsuccess)))
{
$error.clear()
New-MailContact -Name $obj.Name -ExternalEmailAddress $obj.ExternalEmailAddress -OrganizationalUnit "PerthContacts" -Verbose:$false
if($error.count -eq 0)
{
write-host "Mail Contact successfully created"
$mailboxsuccess = $true
}
else
{
write-host "." -nonewline
start-sleep -s 30
}
}
$timer.stop()
$erroractionpreference = "continue"
$secs = "{0:N2}" -f ($timer.elapsed.totalseconds)
write-host "Mail Contact Process ran for: $secs seconds."
Enable-Mailbox -id "Greg Perth" -Database "Mailbox Database" -Verbose:$false
Set-Mailbox -id "Greg Perth" -ForwardingAddress $obj.DistinguishedName -DeliverToMailboxAndForward:$true -Verbose:$false
write-host "*** *** **** "
write-host "Successfully Converted Mail enabled User to Mailbox User with external mail forwarding."
write-host "*** *** ****"
Converting Mail User to Mail Enabled User (Exchange 2007)
Disable-MailUser -id "MailUser Id"
Enable-Mailbox -id "MailUser Id" -Database "Mailbox Database"
NOTE: Executing the Disable-MailUser will remove all the Exchange attributes from AD for "MailUser Id"
Restart Exchange 2007 Services From Powershell
Cut-Paste the following code in Powershell to RESTART Exchange Server 2007 services on your Exchange Server.
Stop-Service MSExchangeAdTopology
Stop-Service MSExchangeAntiSpamUpdate
Stop-Service MSExchangeEdgeSync
Stop-Service MSExchangeFDS
Stop-Service MSExchangeIMAP4
Stop-Service MSExchangeIS
Stop-Service MSExchangeMailSubmission
Stop-Service MSExchangeMailboxAssistants
Stop-Service MSExchangeMonitoring
Stop-Service MSExchangePOP3
Stop-Service MSExchangeRepl
Stop-Service MSExchangeSearch
Stop-Service MSExchangeServiceHost
Stop-Service MSExchangeSA
Stop-Service MSExchangeTransport
Stop-Service MSExchangeTransportLogSearch
Stop-Service msftesql-Exchange -Force
Start-Service MSExchangeAdTopology
Start-Service MSExchangeAntiSpamUpdate
Start-Service MSExchangeEdgeSync
Start-Service MSExchangeFDS
Start-Service MSExchangeIMAP4
Start-Service MSExchangeIS
Start-Service MSExchangeMailSubmission
Start-Service MSExchangeMailboxAssistants
Start-Service MSExchangeMonitoring
Start-Service MSExchangePOP3
Start-Service MSExchangeRepl
Start-Service MSExchangeSearch
Start-Service MSExchangeServiceHost
Start-Service MSExchangeSA
Start-Service MSExchangeTransport
Start-Service MSExchangeTransportLogSearch
Start-Service msftesql-Exchange
After running the above code give it a 30 seconds for all the services to come up.
-------------------------------------------------------------------------------------------------
YOU CAN DO THIS WAY TOO !!
Restart-Service MSExchangeEdgeSync -Force
Restart-Service MSExchangeFDS -Force
Restart-Service MSExchangeIMAP4 -Force
Restart-Service MSExchangeIS -Force
Restart-Service MSExchangeMailSubmission -Force
Restart-Service MSExchangeMailboxAssistants -Force
Restart-Service MSExchangeMonitoring -Force
Restart-Service MSExchangePOP3 -Force
Restart-Service MSExchangeRepl -Force
Restart-Service MSExchangeSearch -Force
Restart-Service MSExchangeServiceHost -Force
Restart-Service MSExchangeSA -Force
Restart-Service MSExchangeTransport -Force
Restart-Service MSExchangeTransportLogSearch -Force
Restart-Service msftesql-Exchange -Force -Force
------------------------------------------------------------------------------------------
Wednesday, 9 March 2011
Automating IIS installation after Installation of Windows Operating System
IIS installation can be troublesome for Server Administartors but not anymore.
If you have just installed your Windows 2003 ENT or Windows 2008 OS than you can follow the steps.
You will need an answere file, similar to the one below and you can save the 2 sections below as a TXT file.
[Components] aspnet=on
complusnetwork=on
dtcnetwork=off
bitsserverextensionsisapi=off
bitsserverextensionsmanager=off
iis_common= on
iis_ftp=off
fp_extensions=off
iis_inetmer=on
iis_nntp=off
iis_smtp=off
iis_asp=on
iis_internetdataconnector=on
sakit_web=on
tswebclient=on
iis_serversideincludes=on
iis_webdav=off
iis_www=on
appsrv_console=on
inetprint=off
[InternetServer]
SvcManualStart=www
PathFTPRoot=
PathWWWRoot=c:\Inetpub\Wwwroot
ApplicationDependency=
ExtensionFile=
DisableWebServiceOnUpgrade=True
(SAVE THE HIGHLIGHTED SECTION AS A TXT FILE ON THE SERVER)
(CHANGE THE SETTINGS IN THE ABOVE SECTION AS PER YOUR REQUIREMENT)
Open the command prompt on the server and type the following command
Sysocmgr.exe /i:sysoc.inf /u:%PathToUnattendFile%
If you still did'nt get it than look at the link below