≡ Menu

The intent of this post is to give some details on how to set quota notification internal in Exchange 2007. During this interval, a wanning message will be sent to users who are exceeding(or near to) their mailbox limits.

Set Quota notification schedule on  a given Mailbox database:

Set-mailboxdatabase -identity “MBX1SG1S1” -QuotaNotificationSchedule (“Sun.6:00 AM-Sun.6:15 AM”, “Mon.6:00 AM-Mon.6:15 AM”, “Tue.6:00 AM-Tue.6:15 AM”, “Wed.6:00 AM-Wed.6:15 AM”, “Thu.6:00 AM-Thu.6:15 AM”, “Fri.6:00 AM-Fri.6:15 AM”, “Sat.6:00 AM-Sat.6:15 AM”)

Set Quota notification schedule on  all Mailbox databases:

Get-MailboxDatabase | Set-mailboxdatabase -QuotaNotificationSchedule (“Sun.6:00 AM-Sun.6:15 AM”, “Mon.6:00 AM-Mon.6:15 AM”, “Tue.6:00 AM-Tue.6:15 AM”, “Wed.6:00 AM-Wed.6:15 AM”, “Thu.6:00 AM-Thu.6:15 AM”, “Fri.6:00 AM-Fri.6:15 AM”, “Sat.6:00 AM-Sat.6:15 AM”)

Set Quota notification schedule on  all Mailbox databases on a single server:

Get-MailboxDatabase -Server MBX1 | Set-mailboxdatabase -QuotaNotificationSchedule (“Sun.6:00 AM-Sun.6:15 AM”, “Mon.6:00 AM-Mon.6:15 AM”, “Tue.6:00 AM-Tue.6:15 AM”, “Wed.6:00 AM-Wed.6:15 AM”, “Thu.6:00 AM-Thu.6:15 AM”, “Fri.6:00 AM-Fri.6:15 AM”, “Sat.6:00 AM-Sat.6:15 AM”)

You can change the notification schedule timings as you want.

Happy Learning..,
Sitaram Pamarthi

{ 0 comments }

Bulk User mailbox creation in Exchange 2007

While working on setting up my test Exchange 2007 setup, I got a requirement to create 100 users in my environment. I know how to do it with Vbscript but creating mailbox enabled users increases the complexity of script a bit. Then I explored PowerShell and came up with below piece of code. It might help you too… 🙂

[PS] C:>$password = Read-Host “Enter the password” -AsStringString
[PS] C:>foreach ($number in 1..100) { new-mailbox -name user$number -Alias user$number -database “MBX1SG1S1” -organizationalUnit “SPDOMAIN.COM/INDIA/Users” -UserPrincipalName user$number@spdomain.com -Displayname User$number -password $password }

Please note that, the password will be applied for all 100 test accounts we are creating. Above code creates 100 test user accounts with mailbox enabled on MBX1
SG1S1″ store.

Happy Learning..,
Sitaram Pamarthi
{ 2 comments }

The above article has good amount of information embedded in it explaining what to do when you delete an exchange cluster resource from a CMS. Exchange clusters are not like any other cluster aware applications which can be restored by simply recreating the resources in cluster group.  One example is, SQL.  You can do simple recreation of cluster resource if you delete one from SQL instance. But when it comes to Exchange, it is little bit different. Each exchange resource maintains variety of references with each other and with active directory. It also stores it’s unique information about exchange clustered resources in active directory; so recreating the cluster resources manually from cluster admin doesn’t make any sense. You might successfully able to create resources using cluster admin, but exchange will not recognize and use it.
So, follow below steps when you delete any exchange related cluster resource from CMS group.  When I say exchange related clustered resource, I mean, Exchange Information Store Instance (CMSNAME), Exchange System Attendant Instance (CMSNAME) and Storage name (CMSNAME).

  • Note down the values NetBIOS name and IP address of the CMS
  • Run Stop-ClusteredMailboxServer -Identity “CMSName” -StopReason:”your comment text goes here”
    

  • Go to command line and run setup.com /clearLocalCMS /cmsName:”CMSName” to clear the stale entries from cluster; setup.com will be available in your installation media.
  • Run setup.com /recoverCMS /cmsName:”CMSName” /cmsIPv4Address:”IPAddress” from command prompt. This uses the configuration in active directory and reinstalls the CMS with the old configurations.

Hope this helps you and use at your own Risk.  🙂

Happy Learning…,
Sitaram Pamarthi
{ 0 comments }

Below powershell code helps you to list the files which are greater than given size(2GB in this case) and output the file sizes in MB/GB format. This command searches for files inside c:\mydata folder. You can run this against any folder.

Get-ChildItem -path c:\mydata -recurse | Where-Object  {
    ($_.Length /1GB) -gt 2 
} | ForEach-Object {
    ($_.length/1GB).Tostring("0.00")
}
Happy Learning,
Sitaram Pamarthi

 

{ 11 comments }

Today, I will take you through some of the PowerShell one-liners which will help you in querying patches installed in your machine.
 List All installed patches:

 
 PS C:>gwmi Win32_QuickFixEngineering | select Description, Hotfixid

 List all patches that are installed in last 30 days:

 PS C:> gwmi Win32_QuickFixEngineering | ? {$_.InstalledOn} | where { (Get-date($_.Installedon)) -gt (get-date).adddays(-30) }

 List all patches installed on specific date:

 PS C:> gwmi Win32_QuickFixEngineering | ? {$_.InstalledOn} | where { (Get-date($_.Installedon)) -gt (get-date 10/31/2009) }

Query for a specific hotfix by providing hotfix ID(KB12345 format):

PS C:> gwmi Win32_QuickFixEngineering | ? {$_.HotfixID -match ” KB975025″ }

List all hotfixes installed by administrator account:

PS C:> gwmi Win32_QuickFixEngineering | ? {$_.InstalledBy -match “administrator” }

You can adopt the above queries and run against remote machine by passing the computer name shown like below.
 PS C:> gwmi Win32_QuickFixEngineering -Computer remotecomp | ? {$_.InstalledOn} | where { (Get-date($_.Installedon)) -gt (get-date).adddays(-30) }

Happy Learning,
Sitaram Pamarthi

{ 6 comments }
It’s a four step process!. You can refer to my previous article if you want to understand about GPPs. In this post, I will take through the practical steps required for implementing Group Policy Preferences in a Windows 2003 Domain based environment. I am not going to talk about configuring any granular settings in GPPs but I will give you idea about introducing GPP infrastructure into your environment.
Step-1 : Install Group Policy Preference client side extensions(CSE) & XMLLite
GPP CSE: You need to deploy the GPP CSE package to all computers which are running with alteast Windows XP SP2/Windows 2003 SP1. This is to make your legacy operating systems understand the new GPP settings. Below are the download locations for GPP CSEs for different OS versions. 

Similarly you need to install XMLLite Low lever parser on computers which are running with atleast Windows XP SP2 or Windows 2003 SP1. Download location is available here.
Step-2: Install a Windows Vista/Windows 7 Computer into your domain.
            Configuration of GPPs is only possible through GPMC installed on Windows Vista/Windows 7 computer. Install one of these operating system on one computer in your network and add it to your domain.
Step-3: Install Remote Server Administration Tool kit
            Based on the OS version(vista/Windows 7) your have installed, download appropriate RSAT and install it. After the installation, you need to enable the GPMC feature.
RSAT download links:
Follow the below steps for enabling GPMC..
a)      Go to Control Panel
b)      Switch the view to “small icons” and select the “program and features” option from control panel. This opens below windows.
c)      Select “Turn Features On or Off” option from above screen and you will ne presented to with a window to select the features.
d)      Navigate to “Remote Server Administration Tools” node and select “Group Policy Management Tools” check box like shown below and click on OK.
e)      This completes configuring the features
Step-4: Start Configuring GPPs
            Now we are done with setup. Go Start-> Run -> type “gpmc.msc” on Windows 7/vista machine to bring up the GPMC management console. Now create a new GPO for desired OU and click on Edit. Now the GPO editor will contain two sections, “Policies” and “Preferences” under User and Computer settings. And need less to say that GPP settings can be configured from “Preferences” section.
{ 0 comments }
My previous article talks about listing domain controllers in a domain in non-powershell world. But with introduction of powershell things changed a lot to give more flexibility to system administrators and developers.
 Below piece of powershell code helps to you get it.
 List domain Controllers in domain:

$localdomain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
$localdomain | % { $_.DomainControllers } | Select name
  

List all domain controllers in forest

 

$localdomain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()$localdomain.forest.domains | % { $_.DomainControllers } | Select name

You can count the no. of domain controllers also.

 

($localdomain.forest.domains | % { $_.DomainControllers } | Select name).count
Happy Learning..,
Sitaram Pamarthi
{ 0 comments }

Problems with opening MMC

While working on some of the MMC related consoles I used to get a error something like below when I try to open the MMC(say dsa.msc or any other).

MMC cannot open the file . This may be because the file does not exist, is not an MMC console, or was created by a later version of MMC. This may also be because you don’t have sufficient access rights to the file

.
When I first came across this issue three years back, I spent numerous amount of time to find the solution and using it successfully since then. Also shared this tip with few of my colleagues who faced this problem. I thought of sharing this with my blog audience to make them not to struggle with this kind of error again.
Solution:
Go to start run and enter the command, “%appdata%/Microsoft/MMC” and click on OK
In the opened folder look for file that matches the mmc name troubling you and renamed it to some like backup and try opening your MMC again. It should work!.
TIP : If you have problems in opening “Active Directory Users and Computers”, you need to deal with the file named dsa.
If you are smart enough and you have old backups of this folder, try to compare the file and see what has changed. It’s just falt file with some values structure in XML. Most probably, you want to look at “MMC_ConsoleFile ConsoleVersion” value. This value should be equivalent to your MMC version. Problem may be different in your case, so compare with backup file to list the diffs which helps in reading the problem.
Happy Learning…,
Sitaram Pamarthi
{ 0 comments }

Understanding WMI event notification

Many people aren’t aware of this beautiful feature introduced with Windows 2000 and continuing in it’s successors. To get a better sense of what it is, lets a take a example. Your CPU is spiking to 100% at mid nights and you got the task of identifying the root cause. The spike is very  sporadic in nature and lasts for very short time. How will you deal with this situation to see which process is taking high CPU?. Here comes the benefit of WMI event notifications. You can trigger a monitoring in your system using WMI event notifications to monitor the CPU utilization and do a process dump when it touches the monitored value. Task is done and you don’t need to spend time in monitoring manually. This is just a example only and you can adopt this to get alerted when a process starts or ends.

I may not be good at explaining the real use of WMI event notifications but I have found beautiful blog entry which explained this in detailed. Read it to become smart administrator.

Trevor Sullivan’s Tech Room

You can also refer to Microsoft Technet Site Article

Happy Learning..,
Sitaram Pamarthi.

{ 0 comments }

Find password last set/reset time using Powershell

This small piece of code helps you to know when a active directory user has changed his password last time. Use your own inventions to make the output appear the way you want.

$user = “user1”
$searcher=New-Object DirectoryServices.DirectorySearcher
$searcher.Filter=”(&(samaccountname=$user))”
$results=$searcher.findone()
$changedtime  = [datetime]::fromfiletime($results.properties.pwdlastset[0])
write-host -b blue -f red The user, $user has changed password last time at $changedtime

It will be more easy if you have Quest PowerShell Cmdlets for active roles installed in your PC. Download it from Quest site and install on your machine and execute the below oneliner in Quest powershell window.

Get-QADUser user1 | ft displayname, PasswordLastSet

Happy Learning..,
Sitaram Pamarthi

{ 7 comments }