There are several PowerShell and Exchange Management Shell cmdlets that provide a credential parameter that allows you to use an alternate set of credentials when running a command. You may need to use alternate credentials when making manual remote shell connections, sending e-mail messages, working in cross-forest scenarios, and more. In this recipe, we'll take a look at how you can create a credential object that can be used with commands that support the
To create a credential object, we can use the
Get-Credential cmdlet. In this example, we store the credential object in a variable that can be used by the
$credential = Get-Credential ...