Saturday, April 2, 2011

Fate, Love, Oath

Love deceived peoples in the world,
Would blame their mate in their own word,

Heart would never ever curse thou,
Nor try to explain my feelings towards you,

Thinking u, the one who taught me, what is love?
Getting once love should be in fate,

Fate made us to sink with our frequencies,
Its the same which brought the differences,

You picked up speed and made up to reach heights,
I am lagging behind in your remembrance, Still am in delight,

As I hope, once would make the crest to touch the sky,
And the trough to the deepest point of ocean with my ability,

At the tip of the crest would find myself in zeal,
At the tip of trough, would feel your presence to heal..

Its true, Rage inside persists, without harming both,
As true as, Fate which was not so with both, to have an oath.

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

Pass credential with cmd as arugments to file and get its value for windows2003

Powershell with dynamic parameter addition. I suppose this would be the technique.
param([string]$user, [string]$hostname)
$cmd = "Get-WmiObject -class Win32_Service -computername `$hostname"
if($user -ne ""){
$myCred = Get-Credential $user
$cmd = $cmd + "-credential `$myCred"
}
Invoke-Expression $cmd


LIKE the one below can be taken as test.ps1 file and run to execute the cmdlets.


param($Argument1,$Name,$ParentContainer,$UserPassword,$email,$firstname,$Intials,$lastname,$samaccountname,$userprinicipalName,$displayName,$credntial);

$password = 'P@ssw0rd' | ConvertTo-SecureString -asPlainText -Force

$username = "msgdevexch3.local\administrator"

$credential = New-Object System.Management.Automation.PSCredential($username,$password);
$cmdExe = $Argument1+" -Name '"+$Name+"' -ParentContainer '"+$ParentContainer+"' -UserPassword '"+$UserPassword+"' -Email '"+$email+"'" + "-credential `$credential ";

$cmdExe

Add-PSSnapin Quest.ActiveRoles.ADManagement
invoke-Expression -command $cmdExe;