Highlight a phrase and click this icon to search it on Swyx-Forum    Highlight a phrase and click this icon to search it within the Swyx Knowledgebase    Highlight a phrase and click this icon to search it using Goolge    Highlight a phrase and click this icon to search it using Wikipedia

List of Blogs
Search Blogs

Blog Archive

Most recent blog entries

 

Jun24

Written by:Martin
24.06.2011 21:47 

To connect to the server with SwyxWare’s PowerShell module, use use connect-ippbx. It allows to either use your current Windows account or a SwyxWare username and password. When using the latter variant you typically use get-credential to prompt for user name and password. get-credential is a PowerShell cmdlet using the standard Windows credential dialog. We decided to use a credential object for connect-ippbx, because this prevents having the password as normal string parameter, visible in the shell and as clear text string in Powershell memory. Get-credential uses a .NET SecureString which is much safer. However, if your SwyxWare username contains a comma, get-credential doesn’t work, because Windows does not allow comma in user names. Here’s a workaround:

If you’re trying to use the connect-ippbx cmdlet like this:

connect-ippbx -ServerName myserver -UseIpPbxLogin -Credential (get-credential)

get-credential pops up a standard Windows credential dialog. However, that dialog does not accept comma (,) in the user name. Use the following workaround instead:

connect-ippbx -ServerName myserver -UseIpPbxLogin -Credential (new-object System.Management.Automation.PSCredential "lastname, firstname",(read-host -Prompt "Enter password:" -AsSecureString))

The trick is to create a PSCredential object directly and specify username (“Lastname, Firstname” in this example) and password as parameters using read-host to prompt for the password in a secure way.

P.S. Unfortunately even if using securestring on this level is a good idea, it does not make that variant much safer, because the ConfigDataStore API needs a normal string anyway. But that’s no excuse to use the secure variant wherever you can Smile

 

 

Tags:

 


Your name:
Your email:
(Optional) Email used only to show Gravatar.
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment  Cancel 
Blog Help
Sponsors