Sybux
asked on
How to use Encrypted password with Exchange Web Service
Hi,
I'm trying to connect to Exchange Web Service Like this :
The problem is that Exchange Web Service failed to connect as I soon I try to read email I got a 401 Unauthorizied error.
If I type my password in place of "$Password" it's working fine.
Does any1 got an idea or a different approch for using encrypted password in this cmd-let ?
Thx in advance
I'm trying to connect to Exchange Web Service Like this :
$Password = ConvertTo-SecureString -string $Encrypted
$exchService = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService($exchVersion) #connects to the Exchange service
$Credentials = new-object Microsoft.Exchange.WebServices.Data.WebCredentials("username", $Password,"domain")
$exchService.Credentials = $Credentials
The problem is that Exchange Web Service failed to connect as I soon I try to read email I got a 401 Unauthorizied error.
If I type my password in place of "$Password" it's working fine.
Does any1 got an idea or a different approch for using encrypted password in this cmd-let ?
Thx in advance
ASKER
Oops yes you're right, I've just copy/past the wrong line. Sorry. My code is like you said
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
New way to resolve the problem
^^^^^^^^^^^^^^^^^^^^^^^^^^
Don't you mean?
Open in new window