Skip to main content

Posts

Showing posts with the label Powershell

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 +++++++++++++++++++++++++++++++++++++++...

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 '"+...