Wednesday, March 23, 2011

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;


Tuesday, March 22, 2011

Thy absence made me ghoul

Now only memories makes thy presence,
Life sunk in darkness, awaiting for thy condolence.

Nature's signals are going unnoticed,
Scared to keep a step out, but
enticed.

Tears roll down with remembrance,
Behaviour modifies to be aberrant
,

Neither ever held hands nor hugged,
But still feels myself to be clanged,

Each time when you left me alone,
Had hope always, we would be again one,

Now clouds of hope, came behind thy soul,
Myself searching in graveyard like ghoul.

Friday, March 18, 2011


Photos by dhanrajm