Exchange 2013 displays credentials using PowerShell commands

Source: Internet
Author: User
Tags argumentlist

When you run the command, there are severalPowerShelland theExchange PowerShellcommand to provide some credential parameters,allows you to use alternate group credentials.When you use a manual remoteShellConnection,Send mail,and work incross-forestin.in this section,we will learn how to create a credential object,You can use commands that support credential parameters-credential

How credentials work

You can use get-credential command to create a credential . in the following example , We store the credential object in a variable , and this variable can be Get-mailbox command to use

$credential = get-credential

Get-mailbox-credential $credential

when you run command , Span style= "font-family: ' The song Body '; > A box will pop up asking for a username and password The This credential is stored in the variable then you can command to use the -credential parameters are called by other commands then the command runs with the specified credentials

providing credential commands is not necessarily an interactive process , You can also use programmatic methods to create a credential object , rather than using get-credential Command :

$user = "Robin\administrator"

$pass = convertto-securestring-asplaintext [email protected]-force

$credential = New-object System.Management.Automation.PSCredential '

-argumentlist $user, $pass

We should have noticed we used the convertto-securestring command to create a secure string object new-object go to create a credential object

If you need to prompt the user for credentials , but you do not want to invoke the Windows Authentication dialog box , You can use the alternate language method is used in the Shell to prompt

user Credentials .

$user = read-host "Please enter your username"

$pass = read-host "Please enter your password"-assecurestring

$credential = New-object System.Management.Automation.PSCredential '

-argumentlist $user, $pass

650) this.width=650; "title=" 01.png "style=" height:94px;width:720px; "border=" 0 "hspace=" 0 "src=" http://s3.51cto.com /wyfs02/m02/59/5c/wkiom1tqxaxtauiaaag8gjbwjog101.jpg "width=" 720 "height=" 94 "alt=" Wkiom1tqxaxtauiaaag8gjbwjog101.jpg "/>

in this syntax, command to prompt the user for user name and password note : $pass object when we use the read-host–assecurestring parameter After creating the credentials I can see the in the following command. :

650) this.width=650; "title=" 02.png "style=" Float:none; "src=" http://s3.51cto.com/wyfs02/M00/59/59/wKioL1TQxO_ Dzwfhaadidxkhq3y065.jpg "alt=" Wkiol1tqxo_dzwfhaadidxkhq3y065.jpg "/>

here we can see , we can get the credentials stored in the object Usernameproperty Object . because the password attribute is stored as a safe character , we need to use getnetworkcredential method to associate credentials NetworkCredential object is converted to a simple string .

This article from "Robin's Home" blog, declined reprint!

Exchange 2013 displays credentials using PowerShell commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.