Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing PSCredentials to New-SFClient #1

Closed
schaepersm opened this issue May 19, 2014 · 4 comments
Closed

Passing PSCredentials to New-SFClient #1

schaepersm opened this issue May 19, 2014 · 4 comments
Labels

Comments

@schaepersm
Copy link

Hi,

following code does not work

$sfUsername = $Lab."Login Name"
$sfPassword = convertto-securestring -String $Lab.Password -AsPlainText -Force
$sfCred = New-Object -typename System.Management.Automation.PSCredential -argumentlist $sfUsername, $sfpassword

$sfLogin = New-SfClient -Account $Lab.Account.Substring(0,9) -Credential $SFcred

looks like New-SFClient does not accept the PSCredentials object.

Even if working with
$SFCred = Get-Credentials
it does display the Webform for logging in

FYI:
$Lab is a CSV I'm importing as I need to work with 20 Accounts

Cheers,
Mauricio

@julianomaldaner
Copy link
Contributor

Committed new version (1.1) that addresses this issue.

@schaepersm
Copy link
Author

Hi,
took a while to check this. Are you sure this has been solved?
I'm running on version 1.3 still having the same issue running these commands:

PS C:\WINDOWS\system32> $sfCred = Get-Credential
cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:

PS C:\WINDOWS\system32> $sfLogin = New-SfClient -Name "$workDir$sfShortAccountName" -Credential $sfCred
New-SfClient : The remote server returned an error: (400) Bad Request.
At line:1 char:12

  • $sfLogin = New-SfClient -Name "$workDir$sfShortAccountName" -Credential $sfCred
  •        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [New-SfClient], WebException
    • FullyQualifiedErrorId : System.Net.WebException,ShareFile.Api.Powershell.NewSfClient

Mauricio

@julianomaldaner
Copy link
Contributor

Hi Mauricio, bad argument handling in our part: when using -Credentials, you have to provide -Account as well. -Account is the subdomain - i.e., the prefix for your sharefile account. If you use "acme.sharefile.com" as your web site, then "acme" is the subdomain.

I've just tested it in my account using 1.3, and it reproduces your issue when -Account is not provided; but works when it does. Hopefully that'll work for you as well! Thanks!

@schaepersm
Copy link
Author

Hi Juliano,

Ouch… seeing it right now in get-help new-sfclient on example two
I can confirm that this does work now

Thank you on your quick reaction!
Mauricio

From: julianomaldaner [mailto:notifications@github.com]
Sent: Wednesday, June 11, 2014 8:00 PM
To: citrix/ShareFile-PowerShell
Cc: Mauricio Schäpers
Subject: Re: [ShareFile-PowerShell] Passing PSCredentials to New-SFClient (#1)

Hi Mauricio, bad argument handling in our part: when using -Credentials, you have to provide -Account as well. -Account is the subdomain - i.e., the prefix for your sharefile account. If you use "acme.sharefile.com" as your web site, then "acme" is the subdomain.

I've just tested it in my account using 1.3, and it reproduces your issue when -Account is not provided; but works when it does. Hopefully that'll work for you as well! Thanks!


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-45776940.

vkvikaskmr pushed a commit to vkvikaskmr/ShareFile-PowerShell that referenced this issue May 5, 2017
* commit '497ad696bc574f26ac2e4af90a07311d246c1508':
  Make .gitignore work
  Correctly dispose of the platform file info object
  Upgrade Client SDK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants