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

Null Valued Expression #40

Open
tux3domike opened this issue Jul 20, 2020 · 4 comments
Open

Null Valued Expression #40

tux3domike opened this issue Jul 20, 2020 · 4 comments

Comments

@tux3domike
Copy link

Trying to get this Module working for the first time and regardless of what execution policy I run under I'm getting the following error when running duoGetUser

PS C:\Program Files\WindowsPowerShell\Modules\Duo> duoGetUser | select *
_duoBuildCall : You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\Duo\Duo.psm1:591 char:20

  • ... $request = _duoBuildCall -method $method -path $path -dOrg $dOrg -pa ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [_duoBuildCall], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull,_duoBuildCall

Powershell Version is 5.1
Import-Module Duo completes without errors and I was even able to run the command to encrypt by secret key after importing the module. It looks like any command I run that actually utilizes the API returns this error.

@hasan1st
Copy link

hasan1st commented Jul 20, 2020

Assuming you've edited the values for $DuoDefaultOrg and $DuoOrgs in Duo_org.ps1 correctly, the API calls might be failing due to TLS version mismatch

Add this code block to your Duo_org.ps1 or your $PROFILE script to force this module to use TLS1.2

try
{
   [Net.ServicePointManager]::SecurityProtocol  = [Net.SecurityProtocolType]::Tls12
}
catch
{
   Write-Warning $_.Exception.Message
}

Ref: https://github.com/mbegan/Duo-PSModule/blob/master/README.md

Good Luck

@tux3domike
Copy link
Author

Just wanted to post an update in case anyone else comes across this. I was able to get it working by going to the files and adding myself with Full Permissions under the security tab for all 3 files in the module. I installed the module under c:\program files\Windows Powershell\ because I wanted it accessible to all users on the system, but that folder has very strict permissions and it seems like it was causing some type of issue. Either way, everything is working now.

@hasan1st
Copy link

If you create the Duo_org.ps1 on a different system than the one you are running it on, you will need to unblock the script first.

You can do that by going to file properties, check the "Unblock" box at the bottom and click ok, or you can use Unblock-File -Path PathHere from powershell.

Good Luck

@insanegod94
Copy link

For me, solving this error required me to either run the Duo_org.ps1 file before using functions from this module or Import-Module Duo_org.ps1 in my main script before importing and calling functions from this module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants