mkellerman / PSTwitterAPI

PSTwitterAPI - a PowerShell module for the Twitter API
https://mkellerman.github.io/Introducing_PSTwitterAPI/
45 stars 13 forks source link

running Set-TwitterOAuthSettings in script #37

Closed veepee78 closed 4 years ago

veepee78 commented 4 years ago

I have this in script: $ErrorActionPreference = 'Continue'

try { Import-Module PSTwitterAPI Set-TwitterOAuthSettings -ApiKey 'xx' -ApiSecret 'xx' -AccessToken 'xx' -AccessTokenSecret 'xx' ...

this causes error: No OAuthSettings was found. Use 'Set-TwitterOAuthSettings' to set PSTwitterAPI ApiKey & Token. At C:\Program Files\WindowsPowerShell\Modules\PSTwitterAPI\0.0.7\public\Get-TwitterOAuthSettings.ps1:35 char:9

looks like erroraction part in Set-TwitterOAuthSettings in script is being ignored. ... If ($OAuthSettings = Get-TwitterOAuthSettings -AccessToken $AccessToken -ErrorAction SilentlyContinue) ...

If I remove throw from Get-TwitterOAuthSettings, it works.

Set-TwitterOAuthSettings works when run on command line..?

mkellerman commented 4 years ago

I'm not exactly sure how to resolve this. Will need to dig into this.

veepee78 commented 4 years ago

Haven't tried other versions, this happens on powershell 5.1.

mkellerman commented 4 years ago

This was resolved with #35