Wednesday, December 23, 2009

resubmit Queue

get-transportserver | get-queue  | where {$_.identity -notlike "*submission"}| retry-queue -resubmit:$true

Tuesday, November 10, 2009

Create EXE files from bat or vbs file

http://renegadetech.blogspot.com/2006/07/how-to-convert-bat-file-or-vbs-file
.html

Good OCS Site

http://www.shudnow.net/2009/01/18/office-communications-server-2007-r2-enterprise-deployment-part-4/

Good Powershell site

http://powershell.com/cs/blogs/tips/default.aspx?PageIndex=2

String function Examples

"Hello".ToLower()
"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

get-mailboxstatistics [mailbox/s] | sort-object TotalItemSize -descending | ft Displayname,@{label="Total Size (MB)";expression={$_.TotalItemSize.Value.ToMB()}}
**********************************************************************
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

Set-MailboxCalendarSettings -Identity "<Mailbox Alias>" -AutomateProcessing
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

$OU="<yourOU>"
$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

Get-Mailbox "Tarun Arora" | Select Name,
@{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 sort messagecount -Descending select -first 10
Get-TransportServer Get-Queue where-object {($_.MessageCount -gt 0)} sort messagecount -Descending Select -First 10

Thursday, August 20, 2009

Create test Mailboxes

1..100 | ForEach { Net User "User$_" MyPassword=01 /ADD /Domain;
Enable-Mailbox "User$_" -Database <MailboxDatabaseName> }

Friday, August 14, 2009

Keep AddressBook to Online Mode when Outlook is in Cached Mode

HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\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.

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

Usefull ShortCuts

System Information MSINFO32.exe

Monday, June 08, 2009

OCS 2007 Notes

Prepare Schema
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[:] /action:DomainPrep

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[:] /Action:CreateDelegation/Delegation:UserAdmin/TrusteeGroup: /TrusteeDomain: /ServiceAccount: /ComponentServiceAccount: /ComputerOU: /UserOU: /UserType:{User Contact InetOrgPerson} /PoolName:


User Administration Delegation

LcsCmd.exe /Domain[:] /Action:CreateDelegation/Delegation:UserAdmin/TrusteeGroup: /TrusteeDomain: /ServiceAccount: /ComponentServiceAccount: /ComputerOU: /UserOU: /UserType:{User Contact InetOrgPerson} /PoolName:

Thursday, May 21, 2009

Important Links

http://samspade.org/

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"

Tuesday, January 13, 2009

Rebuild SYSVOL Tree

http://searchwindowsserver.techtarget.com/tip/0,289483,sid68_gci1320325,00.html

Thursday, January 08, 2009

How to reinstall IIS on Exchange Server

http://support.microsoft.com/kb/320202

Good Powershell script repository

http://www.myitforum.com/myITWiki/Default.aspx?Page=WPScripts&AspxAutoDetectCookieSupport=1

Tuesday, December 16, 2008

Thursday, December 11, 2008

Lost Log Resilience and Transaction Log Activity in Exchange 2007

http://technet.microsoft.com/en-us/library/bb288910.aspx

AutoDatabaseMountDial and ForcedDatabaseMountAfter

1.    Set-MailboxServer <CMSName> -AutoDatabaseMountDial:<Value>

Bb124389.note(en-us,EXCHG.80).gifNote:

<Value> must be set to Lossless, GoodAvailability, or BestAvailability.

 

2.  Set-MailboxServer <CMSName> -ForcedDatabaseMountAfter:<Value> 

Bb124389.note(en-us,EXCHG.80).gifNote:

<Value> must be set to a specified number or "unlimited."

 

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

Mailbox count for each Database

Get-MailboxDatabase Get-MailboxStatistics Group-Object -property:database Sort-Object -property:count Format-Table count, name –AutoSize

EDB File Size

$exchangeservers = Get-ExchangeServer where-object {$_.admindisplayversion.major -eq 8 -and $_.IsMailboxServer -eq $true }
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

Change Public Computer OWA Timeout

set-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Services\MSExchange OWA' -name PublicTimeout -value <Value in Minutes> -type dword

followed by iisreset /noforce

Tuesday, November 11, 2008

Exchange SendAs permissions

Add-ADPermission Info –User “Domain\user” –ExtendedRights “send as”

Friday, October 31, 2008

Mailbox Retention Period.

get-exchangeserver Where {$_.IsMemberOfCluster -match "yes"} Get-MailboxDatabase Set-MailboxDatabase –Whatif –MailboxRetention 60.00:00:00

Public Folder Replication Articles

http://msexchangeteam.com/archive/2006/01/17/417611.aspx


http://technet.microsoft.com/en-us/library/aa998661(EXCHG.80).aspx


http://support.microsoft.com/?kbid=813629


http://www.microsoft.com/downloads/details.aspx?FamilyId=635BE792-D8AD-49E3-ADA4-E2422C0AB424&displaylang=en

Examples of Managed Folder Mailbox Policy

Get-DistributionGroupMember "DL-Name" -ResultSize unlimited | where {$_.RecipientType -eq "UserMailbox"} | Set-Mailbox -ManagedFolderMailboxPolicy "Policy-ABC"

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

File Comparison Tool - good for excel files as well

Get disconnected mailboxes from Exchange 2003 servers

#output to file only 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

For Outlook 2003
HKEY_LOCAL_MACHINE\Software\Microsoft\Office\11.0\Outlook\DisablePST

For Outlook 2007
HKEY_LOCAL_MACHINE\Software\Microsoft\Office\12.0\Outlook\DisablePST

Filterable Properties for the -Filter Parameter in Exchange 2007 RTM

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

For remote VMM tool

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

Get All Disconnected Mailboxes

Get-MailboxStatistics Where {$_.DisconnectDate -ne $null}

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

}

Monday, September 15, 2008

Tuesday, September 09, 2008

Thursday, July 03, 2008

http://blogs.dirteam.com/blogs/sanderberkouwer/archive/2008/06/24/domain-controller-stickiness-prevention.aspx

Wednesday, January 03, 2007

Laptop Power Settings

powercfg /setactive "Always On"

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?