Showing posts with label create mailbox in exchange 2003. Show all posts
Showing posts with label create mailbox in exchange 2003. Show all posts

Wednesday, March 23, 2011

TO RUN CMDLETS IN POWERSHELL in Exchange 2003

============================
TO RUN CMDLETS IN POWERSHELL
============================
=>While Quest cmdlets run in their own shell, the quest snap-in can also be registered in the Powershell by running the following command, after installing Quest Management Shell.
Go to Powershell and type as below:
Add-PSSnapin Quest.ActiveRoles.ADManagement
=>Upon the shell start, the console may display a message stating that a certain file published by Quest
Software is not trusted on your system. This security message indicates that the certificate the file is
digitally signed with is not trusted on your computer, so the console requires you to enable trust for the
certificate issuer before the file can be run. Press either R (Run once) or A (Always run). To prevent this
message from appearing in the future, it is advisable to choose the second option (A).
=>Try 'Get-Help Get-QADUser' command, its provides the syntax of QADUser command


++++++++++++++++++++++++++++++++++++++++++++++++++++++
HOW TO USE COMMAND TO CREATE A MAILBOX FOR A NEW USER
++++++++++++++++++++++++++++++++++++++++++++++++++++++
/////////////////////////// USERS \\\\\\\\\\\\\\\\\\\\\\\\\
==================
To create new user ---
==================
-----------
SIMPLE ONE
-----------
new-QADUser -name 'user1' -ParentContainer 'CU=Users,DC=msgdevexch3,DC=local' -SamAccountName 'user1' -UserPassword 'P@ssword'


new-QADContact -name 'user1' -ParentContainer 'CN=Users,DC=msgdevexch3,DC=local' -SamAccountName 'user1' -UserPassword 'P@ssword'

=============================
FOR PARTICULAR DOMAIN
=============================
new-QADUser -Service 'exchange.com' -Name 'user2' -ParentContainer 'CN=Users,DC=msgdevexch3,DC=local' -UserPassword 'P@ssword' -LastName 'user2' -FirstName 'user2' -SamAccountName 'user2' -DisplayName 'user2' -Email 'user2@exchange.com'
new-QADUser -name 'sampleuser' -ParentContainer 'CN=Users,DC=msgdevexch3,DC=local' -firstname 'try11' -lastname 'trytry' -SamAccountName 'sampleuser' -UserPassword 'P@ssword'


New-QADUser -Name 'userall' -ParentContainer 'CN=Users,DC=msgdevexch3,DC=local' -UserPassword 'P@ssw0rd' -Email 'userall@exchange.com' -FirstName 'userallFirstname' -Initials 'M' -LastName 'wrewr' -SamAccountName 'userall' -UserPrincipalName 'userall@exchange.com' -DisplayName 'userallhereuserall'


--------------------
ALL IN ONE STATEMENT
--------------------
New-QADUser -Name "user11" -ParentContainer "LDAP_ADDR_VALUE" -UserPassword "P@ssw0rd" [-City ] [-Company ] [-Department ] [-Email ]
[-Fax ] [-FirstName ] [-HomeDirectory ] [-HomeDrive ]
[-HomePhone ] [-Initials ] [-LastName ] [-LogonScript ]
[-Manager ] [-MobilePhone ] [-Notes ] [-Office
] [-Pager ] [-PhoneNumber ] [-PostalCode ]
[-PostOfficeBox ] [-ProfilePath ] [-SamAccountName ]
[-StateOrProvince] [-StreetAddress ] [-Title ]
[-UserPrincipalName ] [-WebPage ] [-ObjectAttributes
] [-Description ] [-DisplayName ]
[-ExcludedProperties ] [-IncludedProperties ] [-DeserializeValues]
[-UseDefaultExcludedProperties] [-Control ] [-Proxy] [-UseGlobalCatalog]
[-Service ] [-ConnectionAccount ] [-ConnectionPassword ]
[-Credential ] [-Connection ] [-WhatIf] [-Confirm]

The above line creates user.

==================
To set user properties
==================
set-qaduser -identity "muthu" -objectAttributes @{givenName='muthu'}

==================
To set user properties and CREATE A MAILBOX---
==================
Please check the below URL: http://www.handigeknakker.nl/?x=entry:entry101222-161855
You can set its value as below:
set-qaduser -identity "user1" -objectAttributes @{givenName=FirstName}
set-qaduser -identity "user1" -objectAttributes @{msExchHomeServerName=MsExchHomeServerName}
set-qaduser -identity "user1" -objectAttributes @{mailnickname=""user1""}
set-qaduser -identity "user1" -objectAttributes @{mDBUseDefaults='TRUE'}
set-qaduser -identity "user1" -objectAttributes @{homeMBD=homeMDB}

$template_user = "Administrator"
$username = 'userall'
$userproperties = get-qaduser -identity "Administrator" -IncludeAllProperties
set-qaduser -identity $username -objectAttributes @{msExchHomeServerName=$userproperties.MsExchHomeServerName;mailnickname="$username";mDBUseDefaults='TRUE';homeMDB=$userproperties.homeMDB;mDBStorageQuota=$mDBStorageQuota;mDBOverQuotaLimit=$mDBOverQuotaLimit;mDBOverHardQuotaLimit=$mDBOverHardQuotaLimit;mDBUseDefaults=$false}




==================
Remove user along with its related
==================
get-QADUser -searchRoot 'user2' | remove-QADObject

==================
ENABLE MAILBOX /USER
==================
Enable-QADUser -Identity 'muthu'

==================
DISABLE MAILBOX /USER
==================
Disable-QADUser -Identity 'muthu05'

==========================================================================================

/////////////////////////// CONTACTS \\\\\\\\\\\\\\\\\\\\\\\\\
==================
TO ADD CONTACT
==================
New-QADObject -ParentContainer 'CN=Users,DC=msgdevexch3,DC=local' -type 'Contact' -NamingProperty 'CN' -Name "usercontact" -ObjectAttributes @{displayName="usercontact";givenName="usercontact1";initials="p";sn="usercontact11";mail="usercontact@exchange.com"}

==================
TO GET CONTACT
==================
Get-QADObject -Identity 'usercontactname@exchange.com' -Type 'contact'

==================
TO SET CONTACT
==================
set-QADObject -identity 'usercontactname@exchange.com' -Type 'contact' -ObjectAttributes @{displayName="usercontact";givenName="usercontact1";initials="p";sn="usercontact11";mail="usercontact@exchange.com"}

==================
TO REMOVE CONTACT
==================
remove-QADObject 'usercontactname' -deleteTree -force -confirm false

get-qadobject -identity 'usercontact' -type 'user'|set-qadobject -objectAttributes @{sn='fsfsdfdf'}

set-qadobject -identity 'usercontact@exchange.com' -ObjectAttributes @{sn='fsfsdfdf'}
==========================================================================================

REFERENCES:

URL: http://www.servolutions.com/support/config_exchange_2003.htm
URL: http://www.quest.com/powershell/activeroles-server.aspx