get-transportserver | get-queue | where {$_.identity -notlike "*submission"}| retry-queue -resubmit:$true
Wednesday, December 23, 2009
resubmit Queue
Tuesday, November 10, 2009
String function Examples
"Hello".ToUpper()
"Hello".EndsWith('lo')
"Hello".StartsWith('he')
"Hello".toLower().StartsWith('he')
"Hello".Contains('l')
"Hello".LastIndexOf('l')
"Hello".IndexOf('l')
"Hello".Substring(3)
"Hello".Substring(3,1)
"Hello".Insert(3, "INSERTED")
"Hello".Length
"Hello".Replace('l', 'x')
"Server1,Server2,Server3".Split(',')
" remove space at ends ".Trim()
" remove space at ends ".Trim(' rem')
Thursday, October 29, 2009
Friday, October 16, 2009
Expression Example with Mailbox Statistics
**********************************************************************
This message is intended for the addressee named and may contain
privileged information or confidential information or both. If you
are not the intended recipient please delete it and notify the sender.
**********************************************************************
Wednesday, October 14, 2009
Auto Accept Calendar Appointments for user type Room
AutoAccept -AllBookInPolicy $true -AllowConflicts $false
-AllowRecurringMeetings $true -DeleteNonCalendarItems $true -DeleteComments
$true -DeleteAttachments $true -BookingWindowInDays 365
Wednesday, September 02, 2009
Populate mailbox store with mailboxes and email
$upnSuffix="@yourdomain"
$database="<database name>"
$firstNamePrefix="Keshav"
$lastNamePrefix="Arora"
$password="password"
$pass =ConvertTo-SecureString $password -AsPlainText -Force
$emlPrefix="emailPrefix_"
$numOfUsers=10
for($i=1;$i -le $numOfUsers;$i++) {
$fn=$firstNamePrefix+$i
$ln=$lastNamePrefix+$i
$alias=$firstNamePrefix+"."+$lastNamePrefix+$i
$displayname= $firstNamePrefix+" "+$lastNamePrefix+" "+$i
Write-Host $i $fn $ln $upnPrefix $displayname
New-Mailbox -Name $alias -Password $pass -UserPrincipalName ($alias + $upnSuffix) -Database $database -OrganizationalUnit $OU -FirstName $fn -Lastname $ln -DisplayName $displayname
$smtpServer="localhost"
$smtp=New-Object Net.Mail.SmtpClient
$smtp.Host="<Your Hub transport Server>"
$to=$emlPrefix+$alias+"@<email domain>"
Write-Host $to
$from="<from address>"
$smtp.Send($from, $to, "My First Email Subject", "Email Body")
}
Multivalued String Export
@{Name='EmailAddresses';Expression={[string]::join(";",
($_.EmailAddresses))}} | Export-CSV EmailAddress.csv
Tuesday, September 01, 2009
Get Mail Queue on all Hub Transport Servers
Get-TransportServer Get-Queue where-object {($_.MessageCount -gt 0)} sort messagecount -Descending Select -First 10
Thursday, August 20, 2009
Create test Mailboxes
Enable-Mailbox "User$_" -Database <MailboxDatabaseName> }
Friday, August 14, 2009
Keep AddressBook to Online Mode when Outlook is in Cached Mode
DWORD DownloadOAB = 0
Tuesday, July 14, 2009
Check all Exchange Clusters Active Nodes in a Forest
Get-MailboxServer | Where-Object {$_.RedundantMachines -ne $null} | Get-ClusteredMailboxServerStatus | Select-Object OperationalMachines
Note: Windows 2008 Clusters must be administered by Windows 2008 OS machines.
Monday, June 22, 2009
Tuesday, June 16, 2009
Difference Between NAT and SNAT
Masquerading an address dynamically is NAT (situations where public\external IP address can change, such as those provided by service providers using DHCP)
When masquerading address is STATIC it is called SNAT
Wednesday, June 10, 2009
Monday, June 08, 2009
OCS 2007 Notes
oLcsCmd.exe /forest /action:SchemaPrep
Verify Schema Preparation
LcsCmd.exe /forest /action:CheckSchemaPrepState
For store Settings
System Container in the Root Domain
Configuration Partition of the Root Domain
To Prepare Forest
oLcsCmd.exe /forest /action:ForestPrep/ global:[systemconfiguration] ] [/groupdomain:
LcsCmd.exe /forest /action:ForestPrep/global:system
Verify Forest Preparation
LcsCmd.exe /forest /action:CheckForestPrepState
Domain Preparation
oLcsCmd.exe /domain[:
Verify Domain Preparation
LcsCmd.exe /domain:corp.litwareinc.com/action:CheckDomainPrepState
Delegation
To Delegate Setup you can either use the Deployment Tool Wizard or LCSCMD.exe
Use LCSCMD.exe to delegate the following
Delegating server administration
Delegating user administration
Delegating read-only user administration
Delegating read-only server administration
For Server Administration, a user must have an account in the Domain Adminsgroup or the RTCUniversalServerAdminsgroup.
Server Administration Delegation
LcsCmd.exe /Domain[:
Friday, June 05, 2009
Thursday, May 21, 2009
Thursday, April 30, 2009
Powershell Default Scope
$AdminSessionADSettings.DefaultScope = "domain.com/All Users"
$AdminSessionADSettings.DefaultScope = "domain.com"
$AdminSessionADSettings.PreferredDomainControllers = "dc1.domain.com"
$AdminSessionADSettings.ViewEntireForest = $True
$AdminSessionADSettings.PreferredGlobalCatalog = "gc1.domain.com"
Friday, February 20, 2009
Tuesday, January 13, 2009
Thursday, January 08, 2009
Good Powershell script repository
Tuesday, December 16, 2008
Thursday, December 11, 2008
AutoDatabaseMountDial and ForcedDatabaseMountAfter
1. Set-MailboxServer <CMSName> -AutoDatabaseMountDial:<Value>
Note: |
<Value> must be set to Lossless, GoodAvailability, or BestAvailability. |
2. Set-MailboxServer <CMSName> -ForcedDatabaseMountAfter:<Value>
Note: |
<Value> must be set to a specified number or "unlimited." |
Tuesday, December 09, 2008
Monday, December 08, 2008
Mailbox count and edb File Size
Script found on the internet
Mailbox Per Server
Get-MailboxDatabase Get-MailboxStatistics Group-Object -property:serverName Sort-Object -property:count Format-Table count, name –AutoSize
Number of Mailboxes
Get-MailboxDatabase Get-MailboxStatistics Group-Object
Get-MailboxDatabase Get-MailboxStatistics Group-Object -property:database Sort-Object -property:count Format-Table count, name –AutoSize
EDB File Size
foreach ($server in $exchangeservers)
{
$db = Get-MailboxDatabase -server $server
foreach ($objItem in $db)
{
$edbfilepath = $objItem.edbfilepath
$path = "`\`\" + $server + "`\" + $objItem.EdbFilePath.DriveName.Remove(1).ToString() + "$" + $objItem.EdbFilePath.PathName.Remove(0,2)
$dbsize = Get-ChildItem $path
$ReturnedObj = New-Object PSObject
$ReturnedObj Add-Member NoteProperty -Name "Server\StorageGroup\Database" -Value $objItem.Identity
$ReturnedObj Add-Member NoteProperty -Name "Size (MB)" -Value ("{0:n2}" -f ($dbsize.Length/1024KB))
Write-Output $ReturnedObj
}
}
Thursday, December 04, 2008
Change the default Scope
$AdminSessionADSettings = [Microsoft.Exchange.Data.Directory.AdminSessionADSettings]::Instance
$AdminSessionADSettings.ViewEntireForest = $true
Friday, November 21, 2008
OWA Customisation
set-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Services\MSExchange OWA' -name PublicTimeout -value <Value in Minutes> -type dword
followed by iisreset /noforce
Tuesday, November 11, 2008
Monday, November 03, 2008
Friday, October 31, 2008
Mailbox Retention Period.
Examples of Managed Folder Mailbox Policy
Get-Mailbox -OrganizationalUnit "OU NAME" -ResultSize unlimited | Set-Mailbox -ManagedFolderMailboxPolicy "Policy-ABC"
Get-Mailbox -ResultSize unlimited | Set-Mailbox -ManagedFolderMailboxPolicy "Policy-ABC"
Set-Mailbox "Foo User" -ManagedFolderMailboxPolicy "Policy-ABC"
Wednesday, October 29, 2008
Get disconnected mailboxes from Exchange 2003 servers
$list = Get-ExchangeServer where {$_.IsExchange2007OrLater -eq $False} `
%{gwmi -co $_ -namespace "root\MicrosoftExchangeV2" -query "SELECT * FROM Exchange_mailbox WHERE DateDiscoveredAbsentInDS IS NOT NULL"}
$list format-Table MailboxDisplayName,ServerName,StorageGroupName,StoreName -autosize out-file 2003_Mailbox.txt
Extract UPN from text file
####### extract-UPN.ps1
####### ::Tarun Arora
####### v1.0
####### This script will extract any UPN ending with $upn(variable below) from a text file
#######
####### Known Issue - If there is a email like user@UPN.com.au, it will extract that as well (not tested)
######################################################
## Update the relevant output file (containing the UPN's)
$outputFile = "c:\scripts\tarun\sortdata\UPN1.txt"
## Update the $ContentPath to the file you want to extract the UPN's
$contentPath= "c:\scripts\tarun\sortdata\content.txt"
## UPN suffix
$upn="@ABC"
################################################
## No need to change anything below this line
##################################################
$content = get-content $contentpath
write-output "UPN" | out-file $outputFile
$word=""
foreach ($line in $content)
{
$len=$line.length
if($len -gt 3)
{
for ($j=0; $j -lt $len;$j++)
{
$i = $line.substring($j,1)
$word=$word+$i
if($word.length -gt 5)
{
if($word.substring($word.length - 4,4) -ilike $upn){write-output $word | out-file $outputfile -append}
}
if(($i -eq " ") -OR ($i -eq [char]10) -OR ($i -eq [char]13) -OR ($i -eq " ")){$word=""}
}
$word=""
}
}
Monday, October 27, 2008
Disable PST files in Outlook
HKEY_LOCAL_MACHINE\Software\Microsoft\Office\11.0\Outlook\DisablePST
For Outlook 2007
HKEY_LOCAL_MACHINE\Software\Microsoft\Office\12.0\Outlook\DisablePST
Active Sync Users with Device Partnership
Get-CASMailbox where {$_.HasActiveSyncDevicePartnership} select Name
Disable IMAP and POP3
Get-Mailbox –Server <ServerName> Set-CASMailbox –POPEnabled:$False
Get-Mailbox –Server <ServerName> Set-CASMailbox –IMAPEnabled:$False
Sunday, October 26, 2008
Virtual Machine Manager Settings
Require Port 5900 for VRMC
Default 8100 for Virtual Machine Manager
Friday, October 24, 2008
GET Active Cluster Nodes
get-exchangeserver Where {$_.IsMemberOfCluster -match "yes"} | get-clusteredmailboxserverstatus | sort-object identity | select OperationalMachines
Command to count maiboxes
get-mailbox -result unlimited -Server <Servername> group database sort name ft -auto name, count
Thursday, October 23, 2008
All Stores Database Size and Mailbox Count
$exchangeservers = Get-ExchangeServer where-object {$_.Name -imatch "CCR" } Sort Name
$AllServers = @()
foreach ($server in $exchangeservers)
{
$db = Get-MailboxDatabase -server $server
foreach ($objItem in $db)
{
$edbfilepath = $objItem.edbfilepath
$Drive = $edbfilepath.DriveName
$DiskUsage = Get-WmiObject win32_logicaldisk -computerName $Server where-Object {$_.DeviceID -match $Drive}
$path = "`\`\" + $server + "`\" + $objItem.EdbFilePath.DriveName.Remove(1).ToString() + "$"+ $objItem.EdbFilePath.PathName.Remove(0,2)
$dbsize = Get-ChildItem $path
$start = $path.LastIndexOf('\')
$dbpath = $path.Substring($start +1).remove($path.Substring($start +1).length -4)
$mailboxpath = "$server\$dbpath"
$mailboxcount = Get-MailboxStatistics -database "$mailboxpath" measure-object
$ReturnedObj = New-Object PSObject
$ReturnedObj Add-Member NoteProperty -Name "Server\StorageGroup\Database" -Value $objItem.Identity
$ReturnedObj Add-Member NoteProperty -Name "Size (MB)" -Value ("{0:n2}" -f ($dbsize.Length/1024KB))
$ReturnedObj Add-Member NoteProperty -Name "Mailbox Count" -Value $mailboxcount.count
$ReturnedObj Add-Member NoteProperty -Name "Drive" -Value $Drive
$ReturnedObj Add-Member NoteProperty -Name "Disk Space (MB)" -Value ("{0:n0}" -f ($DiskUsage.Size/1024KB))
$ReturnedObj Add-Member NoteProperty -Name "Free Space (MB)" -Value ("{0:n0}" -f ($DiskUsage.FreeSpace/1024KB))
[float]$tempfloat = ($DiskUsage.FreeSpace/1000000)/($DiskUsage.Size/1000000)
$tempPercent = [math]::round(($tempfloat * 100),2)
$ReturnedObj Add-Member NoteProperty -Name "% Free" -Value $tempPercent
$AllServers += $ReturnedObj
}
}
$AllServers export-csv c:\DatabaseSize_MailBoxCount.csv -notype –force
Enable Circular Logging
Get-storagegroup –Server “servername” | Set-storagegroup –CircularLoggingEnabled $true
Find Disconnected Mailboxes
$clustnames = @("Server1 ",”Server2”)
$outputfile = "c:\powershell\disconnected.txt"
foreach ($clust in $clustnames)
{
"SERVER = " + $clust >> $outputfile
Get-MailboxStatistics -Server $clust where { $_.DisconnectDate -ne $null } select DisplayName,DisconnectDate >> $outputfile
"`r" >> $outputfile
}
Tuesday, September 23, 2008
Monday, September 15, 2008
Outlook 2007 to use DNS Service Location (SRV) records to locate the Exchange Autodiscover service
http://support.microsoft.com/kb/940881
Tuesday, September 09, 2008
Thursday, July 03, 2008
Friday, January 05, 2007
Wednesday, January 03, 2007
New Process Monitor Utility
This looks cool, and might be useful too if you’re still using Filemon or Regmon.
http://www.microsoft.com/technet/sysinternals/utilities/processmonitor.mspx
Installing Hardware driver Microsoft tool
Just found a great set of utilities to assist in installing drivers into SOEs. It is called Driver Install Framework Tools and is available from Microsoft. One of these tools is a utility called DPInst.exe that will install any drivers it finds within the current working directory (or sub directories if specified in an optional xml file). This means that it is possible to create an XML file that contains all paths for C:\Setup\DRV and launch DPInst.exe and it will install all drivers that are compatible. It also has switches to install a driver even if it is not the best match.
http://www.microsoft.com/whdc/driver/install/DIFxtlsdwn.mspx?